1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 12:33:33 +02:00
Commit Graph

6894 Commits

Author SHA1 Message Date
Chris Lattner
27fa922841 Remove the SmallVector ctor that converts from a SmallVectorImpl. This
conversion open the door for many nasty implicit conversion issues, and
can be easily solved by initializing with (V.begin(), V.end()) when 
needed.

This patch includes many small cleanups for sdisel also.

llvm-svn: 50340
2008-04-28 06:44:42 +00:00
Chris Lattner
89339f3a90 restore the copy ctor in SmallVector. This fixes serious
errors I introduced in my last patch.

llvm-svn: 50338
2008-04-28 06:32:08 +00:00
Chris Lattner
a03159bc35 generalize SmallVector copy ctor, there is no requirement for
the initialization vector to have the same fixed size, just the
same element type.

llvm-svn: 50334
2008-04-28 06:01:06 +00:00
Chris Lattner
39a4281deb Implement a signficant optimization for inline asm:
When choosing between constraints with multiple options,
like "ir", test to see if we can use the 'i' constraint and
go with that if possible.  This produces more optimal ASM in
all cases (sparing a register and an instruction to load it),
and fixes inline asm like this:

void test () {
  asm volatile (" %c0 %1 " : : "imr" (42), "imr"(14));
}

Previously we would dump "42" into a memory location (which
is ok for the 'm' constraint) which would cause a problem
because the 'c' modifier is not valid on memory operands.

Isn't it great how inline asm turns 'missed optimization'
into 'compile failed'??

Incidentally, this was the todo in 
PowerPC/2007-04-24-InlineAsm-I-Modifier.ll

Please do NOT pull this into Tak.

llvm-svn: 50315
2008-04-27 00:37:18 +00:00
Chris Lattner
b83aaaa855 Move a bunch of inline asm code out of line.
llvm-svn: 50313
2008-04-27 00:09:47 +00:00
Chris Lattner
b5bd654163 A few inline asm cleanups:
- Make targetlowering.h fit in 80 cols.
  - Make LowerAsmOperandForConstraint const.
  - Make lowerXConstraint -> LowerXConstraint
  - Make LowerXConstraint return a const char* instead of taking a string byref.

llvm-svn: 50312
2008-04-26 23:02:14 +00:00
Nick Lewycky
1f831c0f57 Remove 'unwinds to' support from mainline. This patch undoes r47802 r47989
r48047 r48084 r48085 r48086 r48088 r48096 r48099 r48109 and r48123.

llvm-svn: 50265
2008-04-25 16:53:59 +00:00
Gordon Henriksen
cd80583c68 PR2245: Misleading parameter name in llvm-c/Core.h:LLVMConstArray
Applying fix by Frits van Bommel.

llvm-svn: 50250
2008-04-25 03:21:19 +00:00
Ted Kremenek
247bdc8ec7 Implement != for DenseSet iterators.
llvm-svn: 50236
2008-04-24 23:49:45 +00:00
Ted Kremenek
100956926c Added iterator support for DenseSet.
llvm-svn: 50235
2008-04-24 23:48:12 +00:00
Evan Cheng
1a97cb159e - Check if a register is livein before removing it. It may have already been removed.
- Do not iterate over SmallPtrSet, the order of iteration is not deterministic.

llvm-svn: 50209
2008-04-24 09:06:33 +00:00
Anton Korobeynikov
b1ad6979dc Add facility for pre-RA passes
llvm-svn: 50165
2008-04-23 18:22:28 +00:00
Anton Korobeynikov
73935826d4 Make stack alignment options global for all targets
llvm-svn: 50157
2008-04-23 18:18:10 +00:00
Dan Gohman
3c6f2b3a6f Fix some whitespace.
llvm-svn: 50151
2008-04-23 17:50:15 +00:00
Chris Lattner
39e4b2e5d2 Enforce that multiple return values have to have at least one result.
llvm-svn: 50137
2008-04-23 05:36:34 +00:00
Nick Lewycky
97179cb16f Whoops! Undo r50087, unbreak the build.
llvm-svn: 50088
2008-04-22 05:20:06 +00:00
Nick Lewycky
e708ae5ffd Reverse r47989. Part of removing 'unwinds to' support.
llvm-svn: 50087
2008-04-22 05:16:51 +00:00
Chris Lattner
57e11a167d Move SplitBlockPredecessors out of loopsimplify into BasicBlockUtils.h
as a global helper function.  At the same type, switch it from taking
a vector of predecessors to an arbitrary sequential input.  This allows
us to switch LoopSimplify to use a SmallVector for various temporary
vectors that it passed into SplitBlockPredecessors.

llvm-svn: 50020
2008-04-21 01:28:02 +00:00
Chris Lattner
368e2b28bf add a handy helper method to instruction, useful for determining
whether it is used outside of some block.  This can be used to see
if there are any non-local references, for example.

llvm-svn: 50004
2008-04-20 22:11:30 +00:00
Chris Lattner
c8c74f39db Add a new Jump Threading pass, which will handle cases
such as those in PR2235.  Right now the pass is not very
effective. :)

llvm-svn: 50000
2008-04-20 20:35:01 +00:00
Dale Johannesen
15969b664d Check we aren't trying to convert PPC long double.
This fixes the testsuite failure on ppcf128-4.ll.

llvm-svn: 49994
2008-04-20 18:23:46 +00:00
Nicolas Geoffray
c80229e1c7 Cosmetic changes, as suggested by Evan. No functionality changes.
llvm-svn: 49993
2008-04-20 17:44:19 +00:00
Chris Lattner
d299f7b8cf Allow argpromote to promote struct arguments with a specified number
of elements.  Patch by Matthijs Kooijman!

llvm-svn: 49962
2008-04-19 19:50:01 +00:00
Nicolas Geoffray
f005e6fa3b Enable jitting with a known memory size.
llvm-svn: 49924
2008-04-18 20:59:31 +00:00
Dan Gohman
cfdb39da9c Remove the implicit conversion from SDOperandPtr to SDOperand*; this
may fix a build error on Visual Studio.

llvm-svn: 49876
2008-04-17 23:02:12 +00:00
Argyrios Kyrtzidis
2f4e52ee48 Bring in uint32_t, uint64_t, and int64_t types for MSVC.
llvm-svn: 49854
2008-04-17 13:56:31 +00:00
Roman Levenstein
2a2a386127 Minor clean-up based on Dan's comments.
llvm-svn: 49844
2008-04-17 09:29:48 +00:00
Scott Michel
4b37c88f48 Workaround for PR2207, in which pred_iterator assert gets triggered due to a
wee problem in Xcode 2.[45]/gcc 4.0.1.

llvm-svn: 49831
2008-04-16 23:46:39 +00:00
Dan Gohman
14ff970e58 Fix a copy+paste error in a comment.
llvm-svn: 49820
2008-04-16 21:57:29 +00:00
Nicolas Geoffray
1f3211af01 Correlate stubs with functions in JIT: when emitting a stub, the JIT tells the memory manager which function
the stub will resolve.

llvm-svn: 49814
2008-04-16 20:46:05 +00:00
Eric Christopher
3630cecfe4 Fix comment.
llvm-svn: 49813
2008-04-16 20:45:31 +00:00
Nicolas Geoffray
82baa2d2c6 Infrastructure for getting the machine code size of a function and an instruction. X86, PowerPC and ARM are implemented
llvm-svn: 49809
2008-04-16 20:10:13 +00:00
Bill Wendling
45432e8339 Add "empty()" method to sys::Path and remove unnecessary whitespace.
Patch by Mikhail Glushenkov!

llvm-svn: 49803
2008-04-16 18:27:02 +00:00
Roman Levenstein
728d59166f Ongoing work on improving the instruction selection infrastructure:
Rename SDOperandImpl back to SDOperand.
Introduce the SDUse class that represents a use of the SDNode referred by
an SDOperand. Now it is more similar to Use/Value classes.

Patch is approved by Dan Gohman.

llvm-svn: 49795
2008-04-16 16:15:27 +00:00
Gabor Greif
32b4942a0a merge of r49785 (from branches/ggreif/use-diet): pass V to dyn_cast by const reference, this avoids copy-constructing and destructing all the time. especially important if these constructors are not accessible
llvm-svn: 49787
2008-04-16 11:43:47 +00:00
Evan Cheng
6d05ce493b Rewrite LiveVariable liveness computation. The new implementation is much simplified. It eliminated the nasty recursive routines and removed the partial def / use bookkeeping. There is also potential for performance improvement by replacing the conservative handling of partial physical register definitions. The code is currently disabled until live interval analysis is taught of the name scheme.
This patch also fixed a couple of nasty corner cases.

llvm-svn: 49784
2008-04-16 09:46:40 +00:00
Owen Anderson
030428b435 Major repairs to the post-dominators implementation. Patch from Florian Brandner!
llvm-svn: 49768
2008-04-16 04:21:16 +00:00
Chris Lattner
3d52eb61ca fix off by one error.
llvm-svn: 49766
2008-04-16 04:10:37 +00:00
Chris Lattner
f24665de72 give smallstring some methods to do 'itoa'.
llvm-svn: 49765
2008-04-16 04:05:02 +00:00
Dale Johannesen
f45cadf9d2 Make 64-to-32 bit truncations explicit (prevent warnings).
All values here fit in 32 bits.

llvm-svn: 49736
2008-04-15 18:44:59 +00:00
Nicolas Geoffray
7e0110f724 Change Divided flag to Split, as suggested by Evan
llvm-svn: 49715
2008-04-15 08:08:50 +00:00
Evan Cheng
cff9295e43 Sort sub-registers and super-registers lists according to super-sub register relations. e.g. X86::RAX sub-register list is EAX, AX, AL, AH (order of last two are not guaranteed).
llvm-svn: 49714
2008-04-15 07:56:03 +00:00
Dan Gohman
3b99b3c807 Treat EntryToken nodes as "passive" so that they aren't added to the
ScheduleDAG; they don't correspond to any actual instructions so they
don't need to be scheduled.

This fixes a bug where the EntryToken was being scheduled multiple
times in some cases, though it ended up not causing any trouble because 
EntryToken doesn't expand into anything. With this fixed the schedulers
reliably schedule the expected number of units, so we can check this
with an assertion.

This requires a tweak to test/CodeGen/X86/loop-hoist.ll because it
ends up getting scheduled differently in a trivial way, though it was
enough to fool the prcontext+grep that the test does.

llvm-svn: 49701
2008-04-15 01:22:18 +00:00
Dan Gohman
dfa422fe9e In -view-sunit-dags, display "special" chain dependencies as cyan
instead of blue to distinguish them from regular dependencies.

llvm-svn: 49696
2008-04-14 23:15:07 +00:00
Dan Gohman
14dce3e51c Teach AliasSetTracker about VAArgInst.
llvm-svn: 49674
2008-04-14 18:34:50 +00:00
Dan Gohman
8d46278998 Fix const-correctness issues with the SrcValue handling in the
memory intrinsic expansion code.

llvm-svn: 49666
2008-04-14 17:55:48 +00:00
Dale Johannesen
edcba1161f Reverse sense of unwind-tables option. This means
stack tracebacks on Darwin x86-64 won't work by default;
nevertheless, everybody but me thinks this is a good idea.

llvm-svn: 49663
2008-04-14 17:54:17 +00:00
Dan Gohman
237a69b49c Clean up some comments.
llvm-svn: 49661
2008-04-14 17:45:20 +00:00
Chris Lattner
f63bdaf0b5 add a new CallGraphNode::removeCallEdgeFor method, tidy some comments.
llvm-svn: 49617
2008-04-13 19:41:25 +00:00
Chris Lattner
f5e5f92891 Add support for equality comparison of CallSite's.
llvm-svn: 49616
2008-04-13 19:40:26 +00:00
Nicolas Geoffray
ad5556e8ba Add a divided flag for the first piece of an argument divided into mulitple parts. Fixes PR1643
llvm-svn: 49611
2008-04-13 13:40:22 +00:00
Duncan Sands
c5f548f784 Merge LLVMBuilder and FoldingBuilder, calling
the result IRBuilder.  Patch by Dominic Hamon.

llvm-svn: 49604
2008-04-13 06:22:09 +00:00
Dan Gohman
15edbf989f Drop ISD::MEMSET, ISD::MEMMOVE, and ISD::MEMCPY, which are not Legal
on any current target and aren't optimized in DAGCombiner. Instead
of using intermediate nodes, expand the operations, choosing between
simple loads/stores, target-specific code, and library calls,
immediately.

Previously, the code to emit optimized code for these operations
was only used at initial SelectionDAG construction time; now it is
used at all times. This fixes some cases where rep;movs was being
used for small copies where simple loads/stores would be better.

This also cleans up code that checks for alignments less than 4;
let the targets make that decision instead of doing it in
target-independent code. This allows x86 to use rep;movs in
low-alignment cases.

Also, this fixes a bug that resulted in the use of rep;stos for
memsets of 0 with non-constant memory size when the alignment was
at least 4. It's better to use the library in this case, which
can be significantly faster when the size is large.

This also preserves more SourceValue information when memory
intrinsics are lowered into simple loads/stores.

llvm-svn: 49572
2008-04-12 04:36:06 +00:00
Evan Cheng
b389b78462 Use of implicit_def is not part of live interval. Create empty intervals for the uses when the live interval is being spilled.
llvm-svn: 49542
2008-04-11 17:53:36 +00:00
Chris Lattner
01e31663c8 improvements for IntrusiveRefCntPtr, patch by Mikhail Glushenkov
llvm-svn: 49538
2008-04-11 16:42:06 +00:00
Evan Cheng
52208a738f Allow registers defined by implicit_def to be clobbered.
llvm-svn: 49512
2008-04-10 23:47:53 +00:00
Dan Gohman
aa52f1c5b0 Fix a typo in a comment.
llvm-svn: 49502
2008-04-10 22:27:06 +00:00
Dan Gohman
b3a511b236 Make isVectorClearMaskLegal's operand list const.
llvm-svn: 49446
2008-04-09 20:09:42 +00:00
Dan Gohman
b05ea92f80 Fix some minor errors in comments.
llvm-svn: 49445
2008-04-09 20:08:06 +00:00
Dan Gohman
0586403622 Add const qualifiers.
llvm-svn: 49443
2008-04-09 18:31:41 +00:00
Dan Gohman
f03c4d87c0 Update comments to use 2.0 syntax type names.
llvm-svn: 49442
2008-04-09 18:24:25 +00:00
Chris Lattner
02cc33d0ad ConstantFP::get should be static.
llvm-svn: 49434
2008-04-09 17:16:28 +00:00
Owen Anderson
ca7e0e21f3 Factor a bunch of functionality related to memcpy and memset transforms out of
GVN and into its own pass.

llvm-svn: 49419
2008-04-09 08:23:16 +00:00
Evan Cheng
94983505c5 Unbreak teh build.
llvm-svn: 49417
2008-04-09 07:06:01 +00:00
Chris Lattner
9d4d2f566e add a version of ConstantFP::get that doesn't take a redundant Type* value,
start migrating code over to use it.

llvm-svn: 49413
2008-04-09 00:45:01 +00:00
Chris Lattner
6e11e1a381 make ConstantFP::isExactlyValue work for long double as well.
llvm-svn: 49410
2008-04-09 00:03:58 +00:00
Devang Patel
f08f0a6de6 Add CreateGetResult()
llvm-svn: 49398
2008-04-08 20:41:22 +00:00
Devang Patel
dd9f2ea01f Add multiple value return instruction constructor.
llvm-svn: 49374
2008-04-08 07:30:13 +00:00
Duncan Sands
f86399a00f Convenience method for setting the nounwind
attribute for a function.

llvm-svn: 49373
2008-04-08 07:23:58 +00:00
Dale Johannesen
ec0fe04044 Implement new llc flag -disable-required-unwind-tables.
Corresponds to -fno-unwind-tables (usually default in gcc).

llvm-svn: 49361
2008-04-08 00:10:24 +00:00
Ted Kremenek
be2279d470 Make getDirnameSep a static method (not part of Path's interface).
llvm-svn: 49354
2008-04-07 22:01:32 +00:00
Ted Kremenek
82b7e8d306 Added method Path::getDirname().
llvm-svn: 49352
2008-04-07 21:53:57 +00:00
Sam Bishop
41916aad58 Added support for Create() calls that take an argument besides the
deserializer.

llvm-svn: 49350
2008-04-07 21:36:46 +00:00
Dan Gohman
d7301ea935 Rename MemOperand to MachineMemOperand. This was suggested by
review feedback from Chris quite a while ago. No functionality
change.

llvm-svn: 49348
2008-04-07 19:35:22 +00:00
Owen Anderson
4ad5a5201c Add operator= implementations to SparseBitVector, allowing it to be used in GVN. This results
in both time and memory savings for GVN.  For example, one testcase went from 10.5s to 6s with
this patch.

llvm-svn: 49345
2008-04-07 17:38:23 +00:00
Roman Levenstein
b40d332929 Re-commit of the r48822, where the infinite looping problem discovered
by Dan Gohman is fixed.

llvm-svn: 49330
2008-04-07 10:06:32 +00:00
Owen Anderson
93ab00f1d9 Make GVN more memory efficient, particularly on code that contains a large number of
allocations, which GVN can't optimize anyways.

llvm-svn: 49329
2008-04-07 09:59:07 +00:00
Gabor Greif
6c6b8a57f3 API changes for class Use size reduction, wave 1.
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.

llvm-svn: 49277
2008-04-06 20:25:17 +00:00
Evan Cheng
9045e3dd2f Forgot this.
llvm-svn: 49247
2008-04-05 02:17:58 +00:00
Duncan Sands
9931451472 If a value is cast to its own type, then the cast
is not needed.

llvm-svn: 49210
2008-04-04 08:28:13 +00:00
Chris Lattner
0891662a49 Make ExecutionEngine::updateGlobalMapping return the old mapping.
llvm-svn: 49206
2008-04-04 04:47:41 +00:00
Ted Kremenek
2184f6cc1d Add member template version of SerializeTrait<T>::Create that also accepts
an optional argument for us by T's Create method.

llvm-svn: 49169
2008-04-03 16:44:37 +00:00
Evan Cheng
ff9c1655de Special handling of zero-sized live intervals.
llvm-svn: 49167
2008-04-03 16:40:27 +00:00
Evan Cheng
6250bfbd3e - Treat a live range defined by an implicit_def as a zero-sized one.
- Eliminate an implicit_def when it's being spilled.

llvm-svn: 49166
2008-04-03 16:39:43 +00:00
Evan Cheng
53c8db51dd Start of a series of patches related to implicit_def.
There is no point in creating a long live range defined by an implicit_def. Scheduler now duplicates implicit_def instruction for each of its uses. Therefore, if an implicit_def node has multiple uses, it will become a number of very short live ranges, rather than a long one. This will make coalescer's job easier.

llvm-svn: 49164
2008-04-03 16:36:07 +00:00
Evan Cheng
497c607fae Backing out 48222 temporarily.
llvm-svn: 49124
2008-04-03 03:13:16 +00:00
David Greene
0ca05878fe Iterators folloring a SmallVector erased element are invalidated so
don't access cached iterators from after the erased element.

Re-apply 49056 with SmallVector support.

llvm-svn: 49106
2008-04-02 18:24:46 +00:00
Evan Cheng
748a0c9215 Now that I am told MachineRegisterInfo also tracks physical register uses / defs, I can do away with the horribleness I introduced a while back. It's impossible to detect if there is any use of a physical register below an instruction (and before any def of the register) with some cheap book keeping.
llvm-svn: 49105
2008-04-02 18:04:08 +00:00
Evan Cheng
4e841d67ed Remove #include<map> from LiveVariables.h. Not referenced.
llvm-svn: 49099
2008-04-02 17:23:50 +00:00
Torok Edwin
b96b953a5c Add new file Support/DataFlow.h.
It allows Use-Def and Def-Use relations to be treated as graphs.

llvm-svn: 49088
2008-04-02 14:57:52 +00:00
Anton Korobeynikov
d3330dfbf6 Add new CC lowering rule: provide a list of registers, which can be 'shadowed',
when some another register is used for argument passing.
Currently is used on Win64.

llvm-svn: 49079
2008-04-02 05:23:57 +00:00
Dale Johannesen
79633a914f Recommitting EH patch; this should answer most of the
review feedback.
-enable-eh is still accepted but doesn't do anything.
EH intrinsics use Dwarf EH if the target supports that,
and are handled by LowerInvoke otherwise.
The separation of the EH table and frame move data is,
I think, logically figured out, but either one still
causes full EH info to be generated (not sure how to
split the metadata correctly).
MachineModuleInfo::needsFrameInfo is no longer used and
is removed.

llvm-svn: 49064
2008-04-02 00:25:04 +00:00
Chris Lattner
d141d16ed7 Change the MemoryBuffer::getFile* methods to take just a pointer to the
start of a filename, not a filename+length.  All clients can produce a
null terminated name, and the system api's require null terminated 
strings anyway.

llvm-svn: 49041
2008-04-01 18:04:03 +00:00
Chris Lattner
4614369b45 MappedFile is dead, remove it.
llvm-svn: 49035
2008-04-01 06:20:44 +00:00
Chris Lattner
2e3d2c6ec8 Stub out some sys::Path::MapInFilePages/UnMapFilePages methods.
llvm-svn: 49030
2008-04-01 06:00:12 +00:00
Chris Lattner
5ba3ea7b4c change the archive stuff to use MemoryBuffer instead of mappedfile.
MemoryBuffer is higher level and more closely matches the model
needed.

llvm-svn: 49029
2008-04-01 04:26:46 +00:00
Chris Lattner
a638713d10 prune unneeded #includes
llvm-svn: 49028
2008-04-01 04:00:45 +00:00
Chris Lattner
9f1dcb3372 rewrite SourceFile to be in terms of MemoryBuffer, not MappedFile.
llvm-svn: 49027
2008-04-01 03:59:34 +00:00
Chris Lattner
0ee9b20a1b Make MappedFile::map return a const correct pointer, don't leak address space on Unix platforms.
llvm-svn: 49026
2008-04-01 03:49:38 +00:00
Chris Lattner
b29e4e90bc Remove the MappedFile::charBase member, rename base -> getBase() and
make getBase() return a const-correct pointer.

llvm-svn: 49025
2008-04-01 03:40:53 +00:00
Chris Lattner
50d56e0f2b add an accessor.
llvm-svn: 49023
2008-04-01 03:20:31 +00:00
Chris Lattner
f2309c208a Remove MappedFile support for mapping files for write and exec
and shared.  This complicates the design, is not used, and probably
doesn't even work.

llvm-svn: 49022
2008-04-01 03:10:22 +00:00
Chris Lattner
b04ab612bf remove extraneous #include
llvm-svn: 49021
2008-04-01 03:01:15 +00:00
Chris Lattner
c7cc29f2a9 update comment.
llvm-svn: 49010
2008-04-01 00:54:39 +00:00
Chris Lattner
c3d03d3f10 cleanup the MappedFile API and comments. This removes and updates
tons of out of date comments (really nothing throws here!) and fixes
some other fairly glaring issues: "size" used to return the size of 
the file *and* change it, depending on how you called it.

llvm-svn: 49009
2008-04-01 00:53:25 +00:00
Chris Lattner
a0b425c6bc remove DEFINING_FILE_FOR for MappedFile.h
llvm-svn: 49008
2008-04-01 00:35:55 +00:00
Evan Cheng
38a755499d Move reMaterialize() from TargetRegisterInfo to TargetInstrInfo.
llvm-svn: 48995
2008-03-31 20:40:39 +00:00
Torok Edwin
348c0b39a0 test commit
llvm-svn: 48984
2008-03-31 17:09:58 +00:00
Erick Tryzelaar
847ee3e279 Expose Function::viewCFG and Function::viewCFGOnly to bindings.
llvm-svn: 48982
2008-03-31 16:22:09 +00:00
Chris Lattner
49e9edd6f6 Fix "Control reaches the end of non-void function" warnings,
patch by David Chisnall.

llvm-svn: 48963
2008-03-30 18:22:13 +00:00
Evan Cheng
4d86275d23 Cosmetic change.
llvm-svn: 48935
2008-03-29 01:04:05 +00:00
Duncan Sands
80f14df923 Rename getAnyLoad to getLoad is suggested by Evan.
llvm-svn: 48914
2008-03-28 09:45:24 +00:00
Duncan Sands
3d613421f1 Implement LegalizeTypes support for softfloat LOAD.
In order to handle indexed nodes I had to introduce
a new constructor, and since I was there I factorized
the code in the various load constructors.

llvm-svn: 48894
2008-03-27 20:23:40 +00:00
Dan Gohman
199ab29337 Avoid creating chain dependencies from CopyToReg nodes to load and store
nodes. This doesn't currently have much impact the generated code, but it
does produce simpler-looking SelectionDAGs, and consequently
simpler-looking ScheduleDAGs, because there are fewer spurious
dependencies.

In particular, CopyValueToVirtualRegister now uses the entry node as the
input chain dependency for new CopyToReg nodes instead of calling getRoot
and depending on the most recent memory reference.

Also, rename UnorderedChains to PendingExports and pull it up from being
a local variable in SelectionDAGISel::BuildSelectionDAG to being a
member variable of SelectionDAGISel, so that it doesn't have to be
passed around to all the places that need it.

llvm-svn: 48893
2008-03-27 19:56:19 +00:00
Chris Lattner
7f9e824685 when a node is removed from an ilist, set its next/prev pointers to
null.  This means that uses of invalidated iterators will explode violently
with:
ilist:143: failed assertion `NodePtr && "++'d off the end of an ilist!"'

instead of happening to work "most of the time".

llvm-svn: 48859
2008-03-27 02:43:03 +00:00
Erick Tryzelaar
0efea4df76 Expose ExecutionEngine::getTargetData() to c and ocaml bindings.
llvm-svn: 48851
2008-03-27 00:27:14 +00:00
Dale Johannesen
4524d3a1d1 Fix a bug in Darwin EH: FDE->CIE pointer must
be relocatable.  Describe why .set is needed better.

llvm-svn: 48848
2008-03-26 23:31:39 +00:00
Roman Levenstein
55b8822511 Use a linked data structure for the uses lists of an SDNode, just like
LLVM Value/Use does and MachineRegisterInfo/MachineOperand does.
This allows constant time for all uses list maintenance operations.

The idea was suggested by Chris. Reviewed by Evan and Dan.
Patch is tested and approved by Dan.

On normal use-cases compilation speed is not affected. On very big basic
blocks there are compilation speedups in the range of 15-20% or even better. 

llvm-svn: 48822
2008-03-26 12:39:26 +00:00
Dan Gohman
2b96ce84aa Add explicit keywords.
llvm-svn: 48801
2008-03-25 22:06:05 +00:00
Dan Gohman
22002efa15 A quick nm audit turned up several fixed tables and objects that were
marked read-write. Use const so that they can be allocated in a
read-only segment.

llvm-svn: 48800
2008-03-25 21:45:14 +00:00
Devang Patel
71f3156ea3 Add optimize-for-size knob.
llvm-svn: 48793
2008-03-25 21:02:35 +00:00
Bill Wendling
d098d38269 De-constify the input to the "operator >>" method as it is modified.
Patch by dekruijf@cs.wisc.edu!

llvm-svn: 48782
2008-03-25 18:16:52 +00:00
Sam Bishop
752e0f8fad Make a note of the fact that EmitOwnedPtr() has nothing to do with the
OwningPtr<> class.

llvm-svn: 48763
2008-03-25 04:41:18 +00:00
Owen Anderson
e540be453a Revert r48676. I had plans for using it, but now it's just dead code.
llvm-svn: 48743
2008-03-24 21:29:58 +00:00
Dan Gohman
a55da994b0 Remove an unnecessary #include.
llvm-svn: 48729
2008-03-24 16:58:44 +00:00
Dan Gohman
fec60bb357 Shrink the size of AllocationInst by using its SubclassData
field to store the alignment value instead of haing a
separate field.

llvm-svn: 48727
2008-03-24 16:55:58 +00:00
Evan Cheng
d01a2a18f8 Increasing the inline limit from (overly conservative) 200 to 300. Given each BB costs 20 and each instruction costs 5, 200 means a 4 BB function + 24 instructions (actually less because caller's size also contributes to it).
Furthermore, double the limit when more than 10% of the callee instructions are vector instructions. Multimedia kernels tend to love inlining.

llvm-svn: 48725
2008-03-24 06:37:48 +00:00
Gordon Henriksen
52f3a08237 Objective Caml bindings for basic block, function, global, and arg iterators.
llvm-svn: 48711
2008-03-23 22:21:29 +00:00
Anton Korobeynikov
bd6711c1c9 Use C-style comments :)
llvm-svn: 48705
2008-03-23 13:44:17 +00:00
Anton Korobeynikov
261bddcbeb Add first proof-of-concept universal compiler driver framework based
on ideas mentioned in PR686.
Written by Mikhail Glushenkov and contributed by Codedgers, Inc.

Old llvmc will be removed soon after new one will have all its properties.

llvm-svn: 48699
2008-03-23 08:57:20 +00:00
Anton Korobeynikov
f858d272a8 Typo fixes
llvm-svn: 48681
2008-03-22 07:48:08 +00:00
Owen Anderson
de2d3aca1b Add a comment, and fix a bug where AllocateRW recurred to AllocateRWX instead of itself.
llvm-svn: 48677
2008-03-22 02:59:54 +00:00
Owen Anderson
5654dda62c Add an AllocateRW to match AllocateRWX.
llvm-svn: 48676
2008-03-22 02:33:53 +00:00
Evan Cheng
874aee2eec Teach DAG combiner to commute commutable binary nodes in order to achieve sdisel CSE.
llvm-svn: 48673
2008-03-22 01:55:50 +00:00
Dan Gohman
a363ba510c Don't include <map> in Pass.h, which doesn't need it. This requires
adding <map> to many files that actually do need it.

llvm-svn: 48667
2008-03-21 23:51:57 +00:00
Dan Gohman
479c8ef76d Specialize FORCE_DEFINING_FILE_TO_BE_LINKED using a GCC trick
to avoid using constructor calls for static objects. This reduces
the number of objects requiring static constructors in a typical
LLVM build by around 20%.

llvm-svn: 48665
2008-03-21 23:38:23 +00:00
Andrew Lenharth
2ff2bcbde8 FunctionExtractorPass has been superceded by GVExtractorPass
llvm-svn: 48648
2008-03-21 16:46:53 +00:00
Duncan Sands
a53967843f Make it possible to get an empty struct using
the new StructType::get method.  The second NULL
is to pacify the gcc warning mechanism.  This
patch compiles but is otherwise untested.

llvm-svn: 48645
2008-03-21 15:53:17 +00:00
Duncan Sands
4153fc30c9 Introduce a new node for holding call argument
flags.  This is needed by the new legalize types
infrastructure which wants to expand the 64 bit
constants previously used to hold the flags on
32 bit machines.  There are two functional changes:
(1) in LowerArguments, if a parameter has the zext
attribute set then that is marked in the flags;
before it was being ignored; (2) PPC had some bogus
code for handling two word arguments when using the
ELF 32 ABI, which was hard to convert because of
the bogusness.  As suggested by the original author
(Nicolas Geoffray), I've disabled it for the moment.
Tested with "make check" and the Ada ACATS testsuite.

llvm-svn: 48640
2008-03-21 09:14:45 +00:00
Evan Cheng
4ae9fee64c Undo 48570. Correctly match mmx shift instructions with an immediate operand.
llvm-svn: 48627
2008-03-21 00:40:09 +00:00
Gordon Henriksen
dca0a5c5dc C and Objective Caml bindings for mem2reg and reg2mem.
Patch by Erick Tryzelaar.

llvm-svn: 48602
2008-03-20 17:16:03 +00:00
Nick Lewycky
3903f2f24e ubyte and sbyte? what are those?
llvm-svn: 48585
2008-03-20 06:19:51 +00:00
Evan Cheng
6f729b2820 Add intrinsics to match mmx shift builtin's with immediate operand.
llvm-svn: 48569
2008-03-19 23:38:52 +00:00
Devang Patel
5e8cbbea65 PassInfo keep tracks whether a pass is an analysis pass or not.
llvm-svn: 48554
2008-03-19 21:56:59 +00:00
Duncan Sands
486fdbb67f Fix comment.
llvm-svn: 48543
2008-03-19 10:59:59 +00:00
Chris Lattner
1642451cf7 add some convenience methods for creating GEP instructions and
struct types.  Patch by David Chisnall, with some tweaks.

llvm-svn: 48531
2008-03-19 05:06:05 +00:00
Gordon Henriksen
e4b3339de8 C bindings for Module-, Function-, and BasicBlock::iterator.
llvm-svn: 48528
2008-03-19 03:47:18 +00:00
Gordon Henriksen
15006d5da0 C and Objective Caml bindings for the various getParent methods of the IR.
Based on Erick Tryzelaar's patch.

llvm-svn: 48523
2008-03-19 01:11:35 +00:00
Evan Cheng
3d9309c11d Fix live variables issues:
1. If part of a register is re-defined, an implicit kill and an implicit def are added to denote read / mod / write. However, this should only be necessary if the register is actually read later. This is a performance issue.
2. If a sub-register is being defined, and it doesn't have a previous use, do not add a implicit kill to the last use of a super-register:
   = EAX, AX<imp-use,kill>
...
AX =
In this case, EAX is live but AX is killed, this is wrong and will cause the coalescer to do bad things.

llvm-svn: 48521
2008-03-19 00:52:20 +00:00
Devang Patel
38f181fa8c Do not use virtual function to identify an analysis pass.
llvm-svn: 48520
2008-03-19 00:48:41 +00:00
Scott Michel
889ee011f7 Dial down gcc's warnings: don't use 0UL when 0U suffices (and when the
variables and methods themselves only use unsigned.)

llvm-svn: 48492
2008-03-18 16:55:06 +00:00
Dale Johannesen
4d0221c45b Get rid of compilation warnings. Per Devang.
llvm-svn: 48478
2008-03-18 01:52:17 +00:00
Devang Patel
811ca3ddba Identify Analysis pass.
Do not run analysis pass again if analysis info is still available.
This fixes PR1441.

llvm-svn: 48476
2008-03-18 00:39:19 +00:00
Nate Begeman
f50ef51ded __builtin_ia32_movntdqa reads memory
llvm-svn: 48431
2008-03-16 21:15:47 +00:00
Gordon Henriksen
04a60ddcd2 C and Objective Caml bindings for the TargetData class.
llvm-svn: 48422
2008-03-16 20:08:03 +00:00
Gordon Henriksen
8c33afc50c C and Objective Caml bindings for several scalar transforms.
Patch originally by Erick Tryzelaar, but has been modified somewhat.

llvm-svn: 48419
2008-03-16 16:32:40 +00:00
Gordon Henriksen
b7259e6e65 Remove unnecessary includes.
llvm-svn: 48418
2008-03-16 15:55:43 +00:00
Gordon Henriksen
caeafc4911 C and Objective Caml bindings for PassManagers.
llvm-svn: 48413
2008-03-16 04:20:44 +00:00
Christopher Lamb
b4f4b41048 Make insert_subreg a two-address instruction, vastly simplifying LowerSubregs pass. Add a new TII, subreg_to_reg, which is like insert_subreg except that it takes an immediate implicit value to insert into rather than a register.
llvm-svn: 48412
2008-03-16 03:12:01 +00:00
Evan Cheng
9af68f56c5 Remove isImplicitDef TargetInstrDesc flag.
llvm-svn: 48381
2008-03-15 00:19:36 +00:00
Evan Cheng
11d2c09adc Replace all target specific implicit def instructions with a target independent one: TargetInstrInfo::IMPLICIT_DEF.
llvm-svn: 48380
2008-03-15 00:03:38 +00:00
Gordon Henriksen
7ebaba8579 Expose Module::dump via C and Ocaml.
Patch by Erick Tryzelaar.

llvm-svn: 48379
2008-03-14 23:58:56 +00:00
Gabor Greif
6ff874e81c move the Use destructor where it belongs to
llvm-svn: 48376
2008-03-14 22:03:02 +00:00
Evan Cheng
b49600c090 Back out r48353. Not needed.
llvm-svn: 48375
2008-03-14 22:01:01 +00:00
Chris Lattner
b549d83ca6 Restore this member, which is used on win32.
llvm-svn: 48372
2008-03-14 21:17:54 +00:00
Dan Gohman
37a26f973f Update comments; getPassName no longer uses RTTI.
llvm-svn: 48369
2008-03-14 18:27:04 +00:00
Dan Gohman
9ca724cee0 Move the PMStack class out of Pass.h and into PassManagers.h.
llvm-svn: 48367
2008-03-14 18:14:29 +00:00
Evan Cheng
98eaed9fbc Add an MO_Undef MachineOperandType, intended for INSERT_SUBREG. Next up MO_Undead.
llvm-svn: 48353
2008-03-14 01:47:49 +00:00
Evan Cheng
d466e7a521 Forgot this.
llvm-svn: 48349
2008-03-14 00:17:29 +00:00
Dan Gohman
89e8681ac5 Fix a typo in a comment.
llvm-svn: 48345
2008-03-13 23:04:27 +00:00
Devang Patel
2c38efe128 Remove unused GetAddressOfSymbol()
Thanks Daniel Dunbar!

llvm-svn: 48340
2008-03-13 16:55:34 +00:00
Christopher Lamb
0f1c32eb63 Get rid of a pseudo instruction and replace it with subreg based operation on real instructions, ridding the asm printers of the hack used to do this previously. In the process, update LowerSubregs to be careful about eliminating copies that have side affects.
Note: the coalescer will have to be careful about this too, when it starts coalescing insert_subreg nodes.
llvm-svn: 48329
2008-03-13 05:47:01 +00:00
Chris Lattner
a14cdebdd9 move a bunch of trivial methods to be inline.
llvm-svn: 48326
2008-03-13 05:00:21 +00:00
Chris Lattner
d4a9aafc3f Various improvements suggested by Duncan
llvm-svn: 48325
2008-03-13 04:33:03 +00:00
Evan Cheng
a3b56a661c Improve VarInfo::removeKill() by using std::find instead of linear search.
llvm-svn: 48321
2008-03-13 02:42:55 +00:00
Dan Gohman
abf6c9aa1d Change PMTopLevelManager's PassManagers vector element type from
Pass* to PMDataManager*. PMDataManager is more specific than Pass,
so this more accurately describes the objects that are being stored.

This eliminates the need for several dynamic_casts to PMDataManager*.
It does introduce one dynamic_cast though, in dumpPasses(). Give
this one a comment describing why a dynamic_cast is being used.

llvm-svn: 48315
2008-03-13 01:48:32 +00:00
Dan Gohman
70f4b55e3f Change PMStack::push to accept a PMDataManager* instead of
a Pass*. PMDataManager* is what it actually holds, so this
makes it clearer.

llvm-svn: 48314
2008-03-13 01:21:31 +00:00
Dan Gohman
6c18f26790 Fix a typo in a comment.
llvm-svn: 48313
2008-03-13 01:08:50 +00:00
Dan Gohman
339b887ff6 No need for typedefs with enums in C++.
llvm-svn: 48312
2008-03-13 01:07:53 +00:00
Evan Cheng
b9fc5d6d07 Refactor some code out of MachineSink into a MachineInstr query.
llvm-svn: 48311
2008-03-13 00:44:09 +00:00
Evan Cheng
620fd19798 Experimental scheduler change to schedule / coalesce the copies added for function livein's. Take 2008-03-10-RegAllocInfLoop.ll, the schedule looks like this after these copies are inserted:
entry: 0x12049d0, LLVM BB @0x1201fd0, ID#0:
Live Ins: %EAX %EDX %ECX
        %reg1031<def> = MOVPC32r 0
        %reg1032<def> = ADD32ri %reg1031, <es:_GLOBAL_OFFSET_TABLE_>, %EFLAGS<imp-def>
        %reg1028<def> = MOV32rr %EAX
        %reg1029<def> = MOV32rr %EDX
        %reg1030<def> = MOV32rr %ECX
        %reg1027<def> = MOV8rm %reg0, 1, %reg0, 0, Mem:LD(1,1) [0x1201910 + 0]
        %reg1025<def> = MOV32rr %reg1029
        %reg1026<def> = MOV32rr %reg1030
        %reg1024<def> = MOV32rr %reg1028

The copies unnecessarily increase register pressure and it will end up requiring a physical register to be spilled.

With -schedule-livein-copies:
entry: 0x12049d0, LLVM BB @0x1201fa0, ID#0:
Live Ins: %EAX %EDX %ECX
        %reg1031<def> = MOVPC32r 0
        %reg1032<def> = ADD32ri %reg1031, <es:_GLOBAL_OFFSET_TABLE_>, %EFLAGS<imp-def>
        %reg1024<def> = MOV32rr %EAX
        %reg1025<def> = MOV32rr %EDX
        %reg1026<def> = MOV32rr %ECX
        %reg1027<def> = MOV8rm %reg0, 1, %reg0, 0, Mem:LD(1,1) [0x12018e0 + 0]

Much better!

llvm-svn: 48307
2008-03-12 22:19:41 +00:00
Duncan Sands
05eb212b2d Don't try to extract an i32 from an f64. This
getCopyToParts problem was noticed by the new
LegalizeTypes infrastructure.  In order to avoid
this kind of thing in the future I've added a
check that EXTRACT_ELEMENT is only used with
integers.  Once LegalizeTypes is up and running
most likely BUILD_PAIR and EXTRACT_ELEMENT can
be removed, in favour of using apints instead.

llvm-svn: 48294
2008-03-12 20:30:08 +00:00
Chris Lattner
7925cc72c0 Reimplement the parameter attributes support, phase #1. hilights:
1. There is now a "PAListPtr" class, which is a smart pointer around
   the underlying uniqued parameter attribute list object, and manages
   its refcount.  It is now impossible to mess up the refcount.
2. PAListPtr is now the main interface to the underlying object, and
   the underlying object is now completely opaque.
3. Implementation details like SmallVector and FoldingSet are now no
   longer part of the interface.
4. You can create a PAListPtr with an arbitrary sequence of
   ParamAttrsWithIndex's, no need to make a SmallVector of a specific 
   size (you can just use an array or scalar or vector if you wish).
5. All the client code that had to check for a null pointer before
   dereferencing the pointer is simplified to just access the 
   PAListPtr directly.
6. The interfaces for adding attrs to a list and removing them is a
   bit simpler.

Phase #2 will rename some stuff (e.g. PAListPtr) and do other less 
invasive changes.

llvm-svn: 48289
2008-03-12 17:45:29 +00:00
Evan Cheng
59831b0358 Document an implementation detail about EXTRACT_SUBREG and INSERT_SUBREG sub-register operand.
llvm-svn: 48283
2008-03-12 07:52:15 +00:00
Dan Gohman
8e3c88c4e9 Use PassManagerBase instead of FunctionPassManager for functions
that merely add passes. This allows them to be used with either
FunctionPassManager or PassManager, or even with a custom new
kind of pass manager.

llvm-svn: 48256
2008-03-11 22:29:46 +00:00
Anton Korobeynikov
38bc6e43f7 Add helper for ultimate aliasee resoltion
llvm-svn: 48255
2008-03-11 22:28:56 +00:00
Devang Patel
5f5912ba27 Fix getOperand() for ReturnInst.
llvm-svn: 48229
2008-03-11 17:35:03 +00:00
Dan Gohman
2b0112a65a Give PassManager and FunctionPassManager a common base class, with
add(Pass *) as a pure virtual member function. This will allow all
the various addPassesTo* functions in LLVM to avoid hard-coding what
type of PassManager is used. 

llvm-svn: 48226
2008-03-11 16:41:42 +00:00
Evan Cheng
af1c76846d When the register allocator runs out of registers, spill a physical register around the def's and use's of the interval being allocated to make it possible for the interval to target a register and spill it right away and restore a register for uses. This likely generates terrible code but is before than aborting.
llvm-svn: 48218
2008-03-11 07:19:34 +00:00
Dan Gohman
67aed9bbb0 Implement more support for fp-to-i128 and i128-to-fp conversions.
llvm-svn: 48189
2008-03-10 23:03:31 +00:00
Evan Cheng
067ecbc341 Revert 48125, 48126, and 48130 for now to unbreak some x86-64 tests.
llvm-svn: 48167
2008-03-10 19:31:26 +00:00
Dale Johannesen
2bbe0d95cf Use uint64_t not unsigned long long.
llvm-svn: 48154
2008-03-10 17:05:01 +00:00
Scott Michel
bb8e8fca47 Give TargetLowering::getSetCCResultType() a parameter so that ISD::SETCC's
return ValueType can depend its operands' ValueType.

This is a cosmetic change, no functionality impacted.

llvm-svn: 48145
2008-03-10 15:42:14 +00:00
Christopher Lamb
32e5ce3d96 Allow insert_subreg into implicit, target-specific values.
Change insert/extract subreg instructions to be able to be used in TableGen patterns.
Use the above features to reimplement an x86-64 pseudo instruction as a pattern.

llvm-svn: 48130
2008-03-10 06:12:08 +00:00
Dale Johannesen
e6b0009792 Increase ISD::ParamFlags to 64 bits. Increase the ByValSize
field to 32 bits, thus enabling correct handling of ByVal
structs bigger than 0x1ffff.  Abstract interface a bit.
Fixes gcc.c-torture/execute/pr23135.c and 
gcc.c-torture/execute/pr28982b.c in gcc testsuite (were ICE'ing
on ppc32, quietly producing wrong code on x86-32.)

llvm-svn: 48122
2008-03-10 02:17:22 +00:00
Nick Lewycky
50c8d20ca2 Update the block cloner which fixes bugpoint on code using unwind_to (phew!)
and also update the cloning interface's major user, the loop optimizations.

llvm-svn: 48088
2008-03-09 05:24:34 +00:00
Nick Lewycky
c64eb33c52 Two things. Preserve the unwind_to when splitting a BB.
Add the ability to remove just one instance of a BB from a phi node. This fixes
the compile error in the tree now.

llvm-svn: 48085
2008-03-09 05:04:48 +00:00
Nick Lewycky
e13db2c263 Not all users of a BB are Instructions any more.
llvm-svn: 48047
2008-03-08 07:48:41 +00:00
Dan Gohman
8ff072e188 Remove unused runPass methods.
llvm-svn: 48044
2008-03-08 01:43:56 +00:00
Evan Cheng
dba1dfe962 Implement x86 support for @llvm.prefetch. It corresponds to prefetcht{0|1|2} and prefetchnta instructions.
llvm-svn: 48042
2008-03-08 00:58:38 +00:00
Dan Gohman
e2d3f86306 There is no killUse.
llvm-svn: 48034
2008-03-07 22:24:41 +00:00
Devang Patel
494c61fd20 Add new sretpromotion pass.
llvm-svn: 48032
2008-03-07 21:07:34 +00:00
Devang Patel
a96cf89c33 RetVal is not used when there are more then one return operands.
llvm-svn: 48022
2008-03-07 20:08:07 +00:00
Andrew Lenharth
6c788376e9 add a pass that can extract all kinds of global values, not just functions. Update llvm-extract to use it and optionally extract a global variable if you want it too
llvm-svn: 48015
2008-03-07 19:51:57 +00:00
Gordon Henriksen
5da39fa644 Cleanup some comments in the OCaml bindings.
Patch by Erick Tryzelaar.

llvm-svn: 48014
2008-03-07 19:13:06 +00:00
Bill Wendling
b33eee09d2 When setting the "unused" info, take into account something like this:
%r3<def> = OR %x3<kill>, %x3

We don't want to mark the %r3 as unused even though it's a sub-register of %x3.

llvm-svn: 48003
2008-03-06 23:22:43 +00:00
Gabor Greif
d746841e93 fix typos
llvm-svn: 47994
2008-03-06 10:36:00 +00:00
Nick Lewycky
5f274047bd Treat BBs that use BBs as proper predecessors and successors in the CFG.
llvm-svn: 47989
2008-03-06 06:54:53 +00:00
Dale Johannesen
8322b6fb70 Clarify that CALLSEQ_START..END may not be nested,
and add some protection against creating such.

llvm-svn: 47957
2008-03-05 19:14:03 +00:00
Evan Cheng
e0b3c221ab Add a target lowering hook to control whether it's worthwhile to compress fp constant.
For x86, if sse2 is available, it's not a good idea since cvtss2sd is slower than a movsd load and it prevents load folding. On x87, it's important to shrink fp constant since fldt is very expensive.

llvm-svn: 47931
2008-03-05 01:30:59 +00:00
Dan Gohman
b987fe16e4 Codegen support for i128 SINT_TO_FP.
llvm-svn: 47928
2008-03-05 01:08:17 +00:00
Evan Cheng
18064ddb5b Refactor code. Remove duplicated functions that basically do the same thing as
findRegisterUseOperandIdx, findRegisterDefOperandIndx. Fix some naming inconsistencies.

llvm-svn: 47927
2008-03-05 00:59:57 +00:00
Devang Patel
26d0fac377 Revert SmallVector ctor variants.
llvm-svn: 47908
2008-03-04 21:54:56 +00:00
Devang Patel
27426dedc0 Add FunctionType ctor variant that takes SmallVector params.
llvm-svn: 47895
2008-03-04 18:57:05 +00:00
Evan Cheng
acb7d77409 Fix 80 column violations.
llvm-svn: 47877
2008-03-04 03:19:19 +00:00
Evan Cheng
b5b16810ac Rename isOperand() to isOperandOf() (and other similar methods). It always confuses me.
llvm-svn: 47872
2008-03-04 00:41:45 +00:00
Bill Wendling
8d64999daf This is the initial check-in for adding register scavenging to PPC. (Currently,
PPC-64 doesn't work.) This also lowers the spilling of the CR registers so that
it uses a register other than the default R0 register (the scavenger scrounges
for one). A significant part of this patch fixes how kill information is
handled.

llvm-svn: 47863
2008-03-03 22:19:16 +00:00
Devang Patel
d0d7028a2b s/isReturnStruct()/hasStructRetAttr()/g
llvm-svn: 47857
2008-03-03 21:46:28 +00:00
Chris Lattner
5b84600196 Stub out a Path::GetMainExecutable call to find the path to the
main executable of a program.  This needs to be implemented on windows.

llvm-svn: 47835
2008-03-03 02:55:43 +00:00
Chris Lattner
d1fc75add0 make operand accessors const-correct
llvm-svn: 47814
2008-03-02 05:32:05 +00:00
Chris Lattner
ffde7a642a Add a new ShuffleVectorInst::getMaskValue method.
llvm-svn: 47813
2008-03-02 05:28:33 +00:00
Nick Lewycky
b02fe64d8b Add an unwind_to field to basic blocks, making them Users instead of Values.
This is the first checkin for PR1269, the new EH infrastructure.

llvm-svn: 47802
2008-03-02 02:48:09 +00:00
Dale Johannesen
cfd005f2ea Add MVT::is128BitVector and is64BitVector. Shrink
unaligned load/store code using them.  Per review
of unaligned load/store vector patch.

llvm-svn: 47782
2008-03-01 03:40:57 +00:00
Devang Patel
cb72d92471 Add pass to promote sret.
This pass transforms 

  %struct._Point = type { i32, i32, i32, i32, i32, i32 }
  define internal void @foo(%struct._Point* sret  %agg.result)

into

  %struct._Point = type { i32, i32, i32, i32, i32, i32 }
  define internal %struct._Point @foo()

This pass updates foo() clients appropriately to use
getresult instruction to extract return values.

This pass is not yet ready for prime time.

llvm-svn: 47776
2008-02-29 23:34:08 +00:00
Anton Korobeynikov
875da2420a Use enumeration for preffered EH dwarf encoding reason
llvm-svn: 47770
2008-02-29 22:09:08 +00:00
Evan Cheng
5beb036eab Don't fill eh frames even though these are text sections.
llvm-svn: 47765
2008-02-29 19:36:59 +00:00
Dan Gohman
2b8022a8c6 Add support to APInt for shift and rotate operations with APInt
instead of uint32_t for the shift/rotate count operand type.

llvm-svn: 47741
2008-02-29 01:40:47 +00:00
Dan Gohman
45a26a462f Add a method to APFloat to convert directly from APInt.
llvm-svn: 47738
2008-02-29 01:26:11 +00:00
Dale Johannesen
310201ba32 Interface of getByValTypeAlignment differed between
generic & x86 versions; change generic to follow x86
and improve comments.  Add PPC version (not right
for non-Darwin.)

llvm-svn: 47734
2008-02-28 22:31:51 +00:00
Duncan Sands
6a4acca399 Document that the shuffle mask may contain undef
values.

llvm-svn: 47719
2008-02-28 17:12:11 +00:00
Evan Cheng
f8b1257d2e Add a quick and dirty "loop aligner pass". x86 uses it to align its loops to 16-byte boundaries.
llvm-svn: 47703
2008-02-28 00:43:03 +00:00
Devang Patel
351830e819 Remove dead code.
llvm-svn: 47700
2008-02-27 23:33:51 +00:00
Anton Korobeynikov
7bd4b77e30 Preparation step for some cleanup/generalization in EH information emission:
provide TAI hook for selection of EH data emission format. Currently unused.

llvm-svn: 47699
2008-02-27 23:33:50 +00:00
Anton Korobeynikov
ecfe55a801 Assert on invalid PHINode::addIncoming() arguments. Patch by Erick Tryzelaar!
llvm-svn: 47697
2008-02-27 22:37:28 +00:00
Nick Kledzik
f32192eb76 fixes from review of first commit
llvm-svn: 47695
2008-02-27 22:25:36 +00:00
Evan Cheng
da92e34fe3 Fix a bug in dead spill slot elimination.
llvm-svn: 47687
2008-02-27 19:57:11 +00:00
Dan Gohman
0cfccf801d Add -analyze support to postdomtree.
llvm-svn: 47680
2008-02-27 18:38:29 +00:00
Duncan Sands
cadfe810f3 LegalizeTypes support for INSERT_VECTOR_ELT.
llvm-svn: 47669
2008-02-27 10:18:23 +00:00
Evan Cheng
295ae42ede Don't track max alignment during stack object allocations since they can be deleted later. Let PEI compute it.
llvm-svn: 47668
2008-02-27 10:04:56 +00:00
Bill Wendling
2cae66e28b Final de-tabification.
llvm-svn: 47663
2008-02-27 06:33:05 +00:00
Chris Lattner
d2a01e1994 Add path separator support, patch by Sam Bishop.
llvm-svn: 47662
2008-02-27 06:17:10 +00:00
Evan Cheng
7553230e3a Spiller now remove unused spill slots.
llvm-svn: 47657
2008-02-27 03:04:06 +00:00
Dan Gohman
938e74654b Convert the last remaining users of the non-APInt form of
ComputeMaskedBits to use the APInt form, and remove the
non-APInt form.

llvm-svn: 47654
2008-02-27 01:23:58 +00:00
Devang Patel
c68e26f9fe Add comment.
llvm-svn: 47653
2008-02-27 01:20:54 +00:00
Dan Gohman
689d8cac04 Convert SimplifyDemandedMask and ShrinkDemandedConstant to use APInt.
Change several cases in SimplifyDemandedMask that don't ever do any
simplifying to reuse the logic in ComputeMaskedBits instead of
duplicating it.

llvm-svn: 47648
2008-02-27 00:25:32 +00:00
Devang Patel
5c00c6bafa Remove unncessary ReturnInst constructors.
llvm-svn: 47633
2008-02-26 22:12:58 +00:00
Bill Wendling
8fb166bf6c Rename PrintableName to Name.
llvm-svn: 47629
2008-02-26 21:47:57 +00:00
Anton Korobeynikov
ba0d97969e Update per review. Patch by Mikhail Glushenkov!
llvm-svn: 47628
2008-02-26 21:44:24 +00:00
Bill Wendling
50f5c4be14 Change "Name" to "AsmName" in the target register info. Gee, a refactoring tool
would have been a Godsend here!

llvm-svn: 47625
2008-02-26 21:11:01 +00:00
Nick Kledzik
7ebb5aa81a first commit of new LTO system. It is not hooked up in the llvm/tools/Makefile, so no one will build it be default yet
llvm-svn: 47621
2008-02-26 20:26:43 +00:00
Devang Patel
0be97b2118 Use SmallVector while constructing ReturnInst.
llvm-svn: 47619
2008-02-26 19:38:17 +00:00
Devang Patel
e5766a12da Avoid const_casts
llvm-svn: 47616
2008-02-26 19:15:26 +00:00
Devang Patel
6d492c3caf Remove unnecessary getOperand/setOperand overriders.
Simplify getReturnValue()

llvm-svn: 47614
2008-02-26 19:08:13 +00:00
Devang Patel
e0f9c6f281 Unify to ReturnInst::init() member functions.
llvm-svn: 47611
2008-02-26 18:49:29 +00:00
Devang Patel
b35d15edf9 Optimize most common case by using single RetVal in ReturnInst.
llvm-svn: 47607
2008-02-26 17:56:20 +00:00
Bill Wendling
ebb707d162 Detabify
llvm-svn: 47597
2008-02-26 10:49:39 +00:00
Evan Cheng
40c26c71c0 Refactor inline asm constraint matching code out of SDIsel into TargetLowering.
llvm-svn: 47587
2008-02-26 02:33:44 +00:00
Devang Patel
5b3d61f5ed Pass const vectors by reference.
llvm-svn: 47577
2008-02-26 00:12:13 +00:00
Eli Friedman
c1fb49b19f Add missing include (for ptrdiff_t).
llvm-svn: 47576
2008-02-25 23:35:32 +00:00
Dan Gohman
4089604796 Factor the assert for indexed loads/stores out of LoadSDNode
and StoreSDNode into LSBaseSDNode.

llvm-svn: 47570
2008-02-25 22:16:29 +00:00
Chris Lattner
6292d580de add an assertion to catch a null PATypeHolder, patch by Erick Tryzelaar
llvm-svn: 47563
2008-02-25 21:28:46 +00:00
Dan Gohman
012abf0109 Convert MaskedValueIsZero and all its users to use APInt. Also add
a SignBitIsZero function to simplify a common use case.

llvm-svn: 47561
2008-02-25 21:11:39 +00:00
Chris Lattner
a2c10fa860 add LSBaseSDNode::getOffset at Dan's request.
llvm-svn: 47558
2008-02-25 19:31:21 +00:00
Chris Lattner
9fb1d740a6 prune #includes, fit in 80 cols.
llvm-svn: 47556
2008-02-25 19:21:38 +00:00
Chris Lattner
93caf1f29d make this self contained.
llvm-svn: 47555
2008-02-25 19:20:57 +00:00
Dan Gohman
4f288e3298 Add a new method to SDNode/SDOperand named getValueSizeInBits
that combines getValueType and MVT::getSizeInBits, since this
occurrs frequently.

llvm-svn: 47552
2008-02-25 19:08:02 +00:00
Evan Cheng
fc540545f1 Correctly determine whether a argument load can be folded into its uses.
llvm-svn: 47545
2008-02-25 08:50:41 +00:00
Bill Wendling
a369a6add8 Some platforms use the same name for 32-bit and 64-bit registers (like
%r3 on PPC) in their ASM files. However, it's hard for humans to read
during debugging. Adding a new field to the register data that lets you
specify a different name to be printed than the one that goes into the
ASM file -- %x3 instead of %r3, for instance.

llvm-svn: 47534
2008-02-24 00:56:13 +00:00
Scott Michel
36bbc39272 Merge current work back to tree to minimize diffs and drift. Major highlights
for CellSPU modifications:

- SPUInstrInfo.td refactoring: "multiclass" really is _your_ friend.
- Other improvements based on refactoring effort in SPUISelLowering.cpp,
  esp. in SPUISelLowering::PerformDAGCombine(), where zero amount shifts and
  rotates are now eliminiated, other scalar-to-vector-to-scalar silliness
  is also eliminated.
- 64-bit operations are being implemented, _muldi3.c gcc runtime now
  compiles and generates the right code. More work still needs to be done.

llvm-svn: 47532
2008-02-23 18:41:37 +00:00
Devang Patel
a56b43b442 Remove unnecessary "inline" keywords.
llvm-svn: 47516
2008-02-23 01:11:02 +00:00
Devang Patel
63d29fccdf Use dyn_cast instead of isa + cast.
llvm-svn: 47511
2008-02-23 00:47:00 +00:00
Evan Cheng
676068324b Forgot this.
llvm-svn: 47510
2008-02-23 00:46:11 +00:00
Devang Patel
f674975a65 To support multiple return values, now ret instruction supports multiple operands instead of one aggregate operand.
llvm-svn: 47508
2008-02-23 00:35:18 +00:00
Dale Johannesen
ae08bdb4cf Split ParameterAttributes.h, putting the complicated
stuff into ParamAttrsList.h.  Per feedback from
ParamAttrs changes.

llvm-svn: 47504
2008-02-22 22:17:59 +00:00
Evan Cheng
c7ef6dc2db Remove an invalid assertion now that there are implicit virtual register operands.
llvm-svn: 47493
2008-02-22 19:25:04 +00:00
Devang Patel
f7d8b7679b Add StripDeadPrototypes pass.
llvm-svn: 47488
2008-02-22 18:39:29 +00:00
Dale Johannesen
a96eb3a1d8 Pass alignment on ByVal parameters, from FE, all
the way through.  It is now used for codegen.

llvm-svn: 47484
2008-02-22 17:49:45 +00:00
Anton Korobeynikov
fd4b209731 Add smart refcounting pointer class to ADT back (known before as IntrusiveSPtr.h).
llvm-svn: 47482
2008-02-22 17:26:05 +00:00
Anton Korobeynikov
5eaa8e774e Unbreak build for VC2008. Patch by Argiris Kirtzidis!
llvm-svn: 47480
2008-02-22 10:11:21 +00:00
Evan Cheng
fa73e0c64e Enable re-materialization of instructions which have virtual register operands if
the definition of the operand also reaches its uses.

llvm-svn: 47475
2008-02-22 09:24:50 +00:00
Devang Patel
8ae63af4b1 Read and write getresult.
llvm-svn: 47471
2008-02-22 02:49:49 +00:00
Chris Lattner
7d3c05df5b minor cleanups to LSBaseSDNode.
llvm-svn: 47469
2008-02-22 01:54:35 +00:00
Andrew Lenharth
b8f9871711 Better names as per Evan's request
llvm-svn: 47435
2008-02-21 16:11:38 +00:00
Andrew Lenharth
db9cd46f5d Atomic op support. If any gcc test uses __sync builtins, it might start failing on archs that haven't implemented them yet
llvm-svn: 47430
2008-02-21 06:45:13 +00:00
Anton Korobeynikov
9f8c4b85cf Add convenient helper to get suffix of the file
llvm-svn: 47397
2008-02-20 19:41:22 +00:00
Dan Gohman
62071ec646 Remove inline keywords from in-class function definitions, for
consistency.

llvm-svn: 47393
2008-02-20 19:29:58 +00:00
Devang Patel
de35f122f2 getresult type is the type of indexed aggregate element
llvm-svn: 47392
2008-02-20 19:26:55 +00:00
Devang Patel
6266d7147e Specify GetResultInst index as an unsigned.
llvm-svn: 47390
2008-02-20 19:10:47 +00:00
Devang Patel
aae784581e Fix typo. Add const version of getAggregateValue() accessor member function.
llvm-svn: 47386
2008-02-20 18:36:16 +00:00
Dan Gohman
48d03d5a2d Add explicit keywords.
llvm-svn: 47382
2008-02-20 16:44:09 +00:00
Dan Gohman
00fed8a97e Add an intersects method to APInt, to capture a common idiom.
llvm-svn: 47379
2008-02-20 16:08:11 +00:00
Anton Korobeynikov
9c87c6526e Add 'sink' cmdline option. Patch by Mikhail Glushenkov!
llvm-svn: 47377
2008-02-20 12:38:07 +00:00
Anton Korobeynikov
c41f5b6af4 Fix newly-introduced 4.3 warnings
llvm-svn: 47375
2008-02-20 12:07:57 +00:00
Anton Korobeynikov
b2dfae5fed And final pack of warnings silencing
llvm-svn: 47372
2008-02-20 11:27:04 +00:00
Anton Korobeynikov
7dd00942cc Update gcc 4.3 warnings fix patch with recent head changes
llvm-svn: 47368
2008-02-20 11:10:28 +00:00
Anton Korobeynikov
0c5e186924 Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
llvm-svn: 47367
2008-02-20 11:08:44 +00:00
Bill Wendling
becea18656 Fixed typo.
llvm-svn: 47365
2008-02-20 09:14:09 +00:00
Bill Wendling
9a2a1ddf6e More constification of things. More comments added. No functionality
changes. (Sorry for any formatting changes that creeped in.)

llvm-svn: 47362
2008-02-20 07:36:31 +00:00
Nick Lewycky
0b6cdd1eff Add 'umax' similar to 'smax' SCEV. Closes PR2003.
Parse reversed smax and umax as smin and umin and express them with negative
or binary-not SCEVs (which are really just subtract under the hood).

Parse 'xor %x, -1' as (-1 - %x).

Remove dead code (ConstantInt::get always returns a ConstantInt).

Don't use getIntegerSCEV(-1, Ty). The first value is an int, then it gets
passed into a uint64_t. Instead, create the -1 directly from
ConstantInt::getAllOnesValue().

llvm-svn: 47360
2008-02-20 06:48:22 +00:00
Dan Gohman
28b341cbf5 Add some comments to Intrinsic::getDeclaration to clarify how to
get declarations for overloaded intrinsics.

llvm-svn: 47353
2008-02-20 01:07:51 +00:00