Commit Graph

6731 Commits

Author SHA1 Message Date
Evan Cheng 0515472470 Unbreak teh build.
llvm-svn: 49417
2008-04-09 07:06:01 +00:00
Chris Lattner b5b3e3136b 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 8ca9450885 make ConstantFP::isExactlyValue work for long double as well.
llvm-svn: 49410
2008-04-09 00:03:58 +00:00
Devang Patel 0a14b5b649 Add CreateGetResult()
llvm-svn: 49398
2008-04-08 20:41:22 +00:00
Devang Patel 3d840ded0d Add multiple value return instruction constructor.
llvm-svn: 49374
2008-04-08 07:30:13 +00:00
Duncan Sands 57d3a36386 Convenience method for setting the nounwind
attribute for a function.

llvm-svn: 49373
2008-04-08 07:23:58 +00:00
Dale Johannesen 344aec2952 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 a518bb79b1 Make getDirnameSep a static method (not part of Path's interface).
llvm-svn: 49354
2008-04-07 22:01:32 +00:00
Ted Kremenek c042bf1db5 Added method Path::getDirname().
llvm-svn: 49352
2008-04-07 21:53:57 +00:00
Sam Bishop 3a13067557 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 3bc3ddd638 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 ed92b41a39 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 51f532f92d 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 0c1e634cbb 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 e9ecc68d8f 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 c975d7b30d Forgot this.
llvm-svn: 49247
2008-04-05 02:17:58 +00:00
Duncan Sands 4cbca05d4e 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 ee1817300a Make ExecutionEngine::updateGlobalMapping return the old mapping.
llvm-svn: 49206
2008-04-04 04:47:41 +00:00
Ted Kremenek 73ac2048f9 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 6d07b625aa Special handling of zero-sized live intervals.
llvm-svn: 49167
2008-04-03 16:40:27 +00:00
Evan Cheng 20aed56504 - 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 916802a78e 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 025cea1126 Backing out 48222 temporarily.
llvm-svn: 49124
2008-04-03 03:13:16 +00:00
David Greene 586740f401 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 d8616064d8 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 be3d44c3cb Remove #include<map> from LiveVariables.h. Not referenced.
llvm-svn: 49099
2008-04-02 17:23:50 +00:00
Torok Edwin 21b8bed571 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 20c9e4cbee 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 fd967cf3fa 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 6f2ffdb73f 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 18356d8857 MappedFile is dead, remove it.
llvm-svn: 49035
2008-04-01 06:20:44 +00:00
Chris Lattner 3089e1d82e Stub out some sys::Path::MapInFilePages/UnMapFilePages methods.
llvm-svn: 49030
2008-04-01 06:00:12 +00:00
Chris Lattner d4310a27aa 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 014dea94b2 prune unneeded #includes
llvm-svn: 49028
2008-04-01 04:00:45 +00:00
Chris Lattner 4ac7bb0294 rewrite SourceFile to be in terms of MemoryBuffer, not MappedFile.
llvm-svn: 49027
2008-04-01 03:59:34 +00:00
Chris Lattner 64959dcf03 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 bcfa564759 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 5a7d4e4f6d add an accessor.
llvm-svn: 49023
2008-04-01 03:20:31 +00:00
Chris Lattner 62385ba3a0 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 f5b0b76d28 remove extraneous #include
llvm-svn: 49021
2008-04-01 03:01:15 +00:00
Chris Lattner ac17d39469 update comment.
llvm-svn: 49010
2008-04-01 00:54:39 +00:00
Chris Lattner efecfbc113 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 1fa4dca692 remove DEFINING_FILE_FOR for MappedFile.h
llvm-svn: 49008
2008-04-01 00:35:55 +00:00
Evan Cheng ed6e34fe41 Move reMaterialize() from TargetRegisterInfo to TargetInstrInfo.
llvm-svn: 48995
2008-03-31 20:40:39 +00:00
Torok Edwin 44a34aa67c test commit
llvm-svn: 48984
2008-03-31 17:09:58 +00:00
Erick Tryzelaar 4a0da98825 Expose Function::viewCFG and Function::viewCFGOnly to bindings.
llvm-svn: 48982
2008-03-31 16:22:09 +00:00
Chris Lattner 0f760dfe09 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 1c76b558c4 Cosmetic change.
llvm-svn: 48935
2008-03-29 01:04:05 +00:00
Duncan Sands 35c7cdac07 Rename getAnyLoad to getLoad is suggested by Evan.
llvm-svn: 48914
2008-03-28 09:45:24 +00:00
Duncan Sands f740509e58 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 cad51cb671 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 cb058e41a2 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 8ac07c2834 Expose ExecutionEngine::getTargetData() to c and ocaml bindings.
llvm-svn: 48851
2008-03-27 00:27:14 +00:00
Dale Johannesen 87c6ada5de 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 358e04a185 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 c60c67fc37 Add explicit keywords.
llvm-svn: 48801
2008-03-25 22:06:05 +00:00
Dan Gohman bdc24adaaf 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 246a52740b Add optimize-for-size knob.
llvm-svn: 48793
2008-03-25 21:02:35 +00:00
Bill Wendling e9e706a249 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 1c077ae1b7 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 c905fe9407 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 9654eca3ab Remove an unnecessary #include.
llvm-svn: 48729
2008-03-24 16:58:44 +00:00
Dan Gohman aa583d75b1 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 3471ae8c5d 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 07a45f4edb Objective Caml bindings for basic block, function, global, and arg iterators.
llvm-svn: 48711
2008-03-23 22:21:29 +00:00
Anton Korobeynikov 058014972a Use C-style comments :)
llvm-svn: 48705
2008-03-23 13:44:17 +00:00
Anton Korobeynikov 70548d835e 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 a56dcc977e Typo fixes
llvm-svn: 48681
2008-03-22 07:48:08 +00:00
Owen Anderson 5b993fd70d 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 c1e4e3e9a1 Add an AllocateRW to match AllocateRWX.
llvm-svn: 48676
2008-03-22 02:33:53 +00:00
Evan Cheng 31604a62f6 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 9988569af8 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 5a6ac79738 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 74d154ce57 FunctionExtractorPass has been superceded by GVExtractorPass
llvm-svn: 48648
2008-03-21 16:46:53 +00:00
Duncan Sands dec270a6db 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 d97eea372a 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 92b4488202 Undo 48570. Correctly match mmx shift instructions with an immediate operand.
llvm-svn: 48627
2008-03-21 00:40:09 +00:00
Gordon Henriksen b81777a354 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 183e524b2d ubyte and sbyte? what are those?
llvm-svn: 48585
2008-03-20 06:19:51 +00:00
Evan Cheng bbba76fc99 Add intrinsics to match mmx shift builtin's with immediate operand.
llvm-svn: 48569
2008-03-19 23:38:52 +00:00
Devang Patel 718da668ab 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 9a4a089f07 Fix comment.
llvm-svn: 48543
2008-03-19 10:59:59 +00:00
Chris Lattner f5ec84c4f3 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 054817ce06 C bindings for Module-, Function-, and BasicBlock::iterator.
llvm-svn: 48528
2008-03-19 03:47:18 +00:00
Gordon Henriksen 265f780c22 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 44c0b4f754 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 af75ab8130 Do not use virtual function to identify an analysis pass.
llvm-svn: 48520
2008-03-19 00:48:41 +00:00
Scott Michel 08ef1b2bdb 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 69683fa5ee Get rid of compilation warnings. Per Devang.
llvm-svn: 48478
2008-03-18 01:52:17 +00:00
Devang Patel 864970e9b6 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 39afeaf834 __builtin_ia32_movntdqa reads memory
llvm-svn: 48431
2008-03-16 21:15:47 +00:00
Gordon Henriksen ab4b7d36cd C and Objective Caml bindings for the TargetData class.
llvm-svn: 48422
2008-03-16 20:08:03 +00:00
Gordon Henriksen 82a0e74f43 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 9657149875 Remove unnecessary includes.
llvm-svn: 48418
2008-03-16 15:55:43 +00:00
Gordon Henriksen 878114bf16 C and Objective Caml bindings for PassManagers.
llvm-svn: 48413
2008-03-16 04:20:44 +00:00
Christopher Lamb d3d0ad3f58 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 ec7533b620 Remove isImplicitDef TargetInstrDesc flag.
llvm-svn: 48381
2008-03-15 00:19:36 +00:00
Evan Cheng 0e7b00d79f 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 6c6075e326 Expose Module::dump via C and Ocaml.
Patch by Erick Tryzelaar.

llvm-svn: 48379
2008-03-14 23:58:56 +00:00
Gabor Greif 0269b82fd9 move the Use destructor where it belongs to
llvm-svn: 48376
2008-03-14 22:03:02 +00:00
Evan Cheng 31715f1a83 Back out r48353. Not needed.
llvm-svn: 48375
2008-03-14 22:01:01 +00:00
Chris Lattner 2daab52500 Restore this member, which is used on win32.
llvm-svn: 48372
2008-03-14 21:17:54 +00:00
Dan Gohman 94f57c56f9 Update comments; getPassName no longer uses RTTI.
llvm-svn: 48369
2008-03-14 18:27:04 +00:00
Dan Gohman 87ea2aba62 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 3108798ecb 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 05d41356d0 Forgot this.
llvm-svn: 48349
2008-03-14 00:17:29 +00:00
Dan Gohman 7350880641 Fix a typo in a comment.
llvm-svn: 48345
2008-03-13 23:04:27 +00:00
Devang Patel af305d2342 Remove unused GetAddressOfSymbol()
Thanks Daniel Dunbar!

llvm-svn: 48340
2008-03-13 16:55:34 +00:00
Christopher Lamb dd55d3f1b2 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 c994c0295a move a bunch of trivial methods to be inline.
llvm-svn: 48326
2008-03-13 05:00:21 +00:00
Chris Lattner 4d650c4bee Various improvements suggested by Duncan
llvm-svn: 48325
2008-03-13 04:33:03 +00:00
Evan Cheng 0ceb8eb150 Improve VarInfo::removeKill() by using std::find instead of linear search.
llvm-svn: 48321
2008-03-13 02:42:55 +00:00
Dan Gohman 73caf5ff10 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 11eecd635c 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 abf8892706 Fix a typo in a comment.
llvm-svn: 48313
2008-03-13 01:08:50 +00:00
Dan Gohman 37f10d4aeb No need for typedefs with enums in C++.
llvm-svn: 48312
2008-03-13 01:07:53 +00:00
Evan Cheng 399e1101ba Refactor some code out of MachineSink into a MachineInstr query.
llvm-svn: 48311
2008-03-13 00:44:09 +00:00
Evan Cheng 65e9d5f1a8 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 87de65fc29 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 8a923e7c28 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 136a24742c 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 24570836b2 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 da7db7d9a1 Add helper for ultimate aliasee resoltion
llvm-svn: 48255
2008-03-11 22:28:56 +00:00
Devang Patel 5aafa6ee1f Fix getOperand() for ReturnInst.
llvm-svn: 48229
2008-03-11 17:35:03 +00:00
Dan Gohman d3a20c9e1e 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 e88a625ecd 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 f4300950f1 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 d4e1d9eeb2 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 a1cc15fec4 Use uint64_t not unsigned long long.
llvm-svn: 48154
2008-03-10 17:05:01 +00:00
Scott Michel a6729e8666 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 4ba3f0430b 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 4e622ec86d 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 11fc6f8765 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 cc24104703 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 35e92c7bea Not all users of a BB are Instructions any more.
llvm-svn: 48047
2008-03-08 07:48:41 +00:00
Dan Gohman 39b0ac4e59 Remove unused runPass methods.
llvm-svn: 48044
2008-03-08 01:43:56 +00:00
Evan Cheng 95cf661534 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 6c11f47c54 There is no killUse.
llvm-svn: 48034
2008-03-07 22:24:41 +00:00
Devang Patel 2fbf7eef9c Add new sretpromotion pass.
llvm-svn: 48032
2008-03-07 21:07:34 +00:00
Devang Patel 6c8219e732 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 3f13b6630a 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 a49d435b27 Cleanup some comments in the OCaml bindings.
Patch by Erick Tryzelaar.

llvm-svn: 48014
2008-03-07 19:13:06 +00:00
Bill Wendling 55bfd8c3f7 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 ad19df0687 fix typos
llvm-svn: 47994
2008-03-06 10:36:00 +00:00
Nick Lewycky 19b0df202e 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 8ee39c61f2 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 0a62cb44ce 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 d9d874b0cd Codegen support for i128 SINT_TO_FP.
llvm-svn: 47928
2008-03-05 01:08:17 +00:00
Evan Cheng 6325446666 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 b2fae1d13f Revert SmallVector ctor variants.
llvm-svn: 47908
2008-03-04 21:54:56 +00:00
Devang Patel 5dc63480db Add FunctionType ctor variant that takes SmallVector params.
llvm-svn: 47895
2008-03-04 18:57:05 +00:00
Evan Cheng b9bd5a879d Fix 80 column violations.
llvm-svn: 47877
2008-03-04 03:19:19 +00:00
Evan Cheng 567d2e5b57 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 632ea65072 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 9d91785987 s/isReturnStruct()/hasStructRetAttr()/g
llvm-svn: 47857
2008-03-03 21:46:28 +00:00
Chris Lattner e209be4985 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 bf6acfb71d make operand accessors const-correct
llvm-svn: 47814
2008-03-02 05:32:05 +00:00
Chris Lattner f724e34ddc Add a new ShuffleVectorInst::getMaskValue method.
llvm-svn: 47813
2008-03-02 05:28:33 +00:00
Nick Lewycky 3cc9be0b59 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 208cc8f1b9 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 4eedfd2421 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 0e8b146152 Use enumeration for preffered EH dwarf encoding reason
llvm-svn: 47770
2008-02-29 22:09:08 +00:00
Evan Cheng 26edb59d97 Don't fill eh frames even though these are text sections.
llvm-svn: 47765
2008-02-29 19:36:59 +00:00
Dan Gohman 105c1d4106 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 35723eb4f6 Add a method to APFloat to convert directly from APInt.
llvm-svn: 47738
2008-02-29 01:26:11 +00:00
Dale Johannesen cbde4c2206 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 e28886a913 Document that the shuffle mask may contain undef
values.

llvm-svn: 47719
2008-02-28 17:12:11 +00:00
Evan Cheng c799065cc3 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 a1a6882519 Remove dead code.
llvm-svn: 47700
2008-02-27 23:33:51 +00:00
Anton Korobeynikov ae24cca0e4 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 b3666760ce Assert on invalid PHINode::addIncoming() arguments. Patch by Erick Tryzelaar!
llvm-svn: 47697
2008-02-27 22:37:28 +00:00
Nick Kledzik 91a6dcff32 fixes from review of first commit
llvm-svn: 47695
2008-02-27 22:25:36 +00:00
Evan Cheng fdc732ab9a Fix a bug in dead spill slot elimination.
llvm-svn: 47687
2008-02-27 19:57:11 +00:00
Dan Gohman 61377a3dc8 Add -analyze support to postdomtree.
llvm-svn: 47680
2008-02-27 18:38:29 +00:00
Duncan Sands 5d5bc484d0 LegalizeTypes support for INSERT_VECTOR_ELT.
llvm-svn: 47669
2008-02-27 10:18:23 +00:00
Evan Cheng 8ae8e2d50b 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 97925ec704 Final de-tabification.
llvm-svn: 47663
2008-02-27 06:33:05 +00:00
Chris Lattner 6fca938971 Add path separator support, patch by Sam Bishop.
llvm-svn: 47662
2008-02-27 06:17:10 +00:00
Evan Cheng 6d56368caf Spiller now remove unused spill slots.
llvm-svn: 47657
2008-02-27 03:04:06 +00:00
Dan Gohman f19609abe8 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 5bc621c680 Add comment.
llvm-svn: 47653
2008-02-27 01:20:54 +00:00
Dan Gohman ae2b6fbb8e 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 a58b1c9b6b Remove unncessary ReturnInst constructors.
llvm-svn: 47633
2008-02-26 22:12:58 +00:00
Bill Wendling d7a258d325 Rename PrintableName to Name.
llvm-svn: 47629
2008-02-26 21:47:57 +00:00
Anton Korobeynikov 9eeaae50ca Update per review. Patch by Mikhail Glushenkov!
llvm-svn: 47628
2008-02-26 21:44:24 +00:00
Bill Wendling c24ea4fb41 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 07b4a62234 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 a736c001b6 Use SmallVector while constructing ReturnInst.
llvm-svn: 47619
2008-02-26 19:38:17 +00:00
Devang Patel 060e79c729 Avoid const_casts
llvm-svn: 47616
2008-02-26 19:15:26 +00:00
Devang Patel 85e38bfb2e Remove unnecessary getOperand/setOperand overriders.
Simplify getReturnValue()

llvm-svn: 47614
2008-02-26 19:08:13 +00:00
Devang Patel c38eb52787 Unify to ReturnInst::init() member functions.
llvm-svn: 47611
2008-02-26 18:49:29 +00:00
Devang Patel ae682fb940 Optimize most common case by using single RetVal in ReturnInst.
llvm-svn: 47607
2008-02-26 17:56:20 +00:00
Bill Wendling 293285f883 Detabify
llvm-svn: 47597
2008-02-26 10:49:39 +00:00
Evan Cheng ccc0c996a4 Refactor inline asm constraint matching code out of SDIsel into TargetLowering.
llvm-svn: 47587
2008-02-26 02:33:44 +00:00
Devang Patel 767338ccec Pass const vectors by reference.
llvm-svn: 47577
2008-02-26 00:12:13 +00:00
Eli Friedman ad7d8edeeb Add missing include (for ptrdiff_t).
llvm-svn: 47576
2008-02-25 23:35:32 +00:00
Dan Gohman 8c7a9228de 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 0f5a7ddc39 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 1f372edd97 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 451aea8e81 add LSBaseSDNode::getOffset at Dan's request.
llvm-svn: 47558
2008-02-25 19:31:21 +00:00