Commit Graph

8126 Commits

Author SHA1 Message Date
Devang Patel
cf3a4487c0 Validate dbg_* intrinsics before lowering them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62286 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-15 23:41:32 +00:00
Dan Gohman
fc54c55296 Generalize the HazardRecognizer interface so that it can be used
to support MachineInstr-based scheduling in addition to
SDNode-based scheduling.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62284 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-15 22:18:12 +00:00
Dan Gohman
c475c3608a Simplify the MachineLICM pass by having it only traverse outer
loops, hoisting instructions all the way out in one step rather
than hoisting them one nest level at a time. Also, make a few
other code simplifications. This speeds up MachineLICM
by several fold.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62283 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-15 22:01:38 +00:00
Rafael Espindola
bb46f52027 Add the private linkage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62279 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-15 20:18:42 +00:00
Devang Patel
f193ff0590 Use lightweight DebugInfo objects directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62276 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-15 19:26:23 +00:00
Dan Gohman
79ce276083 Move a few containers out of ScheduleDAGInstrs::BuildSchedGraph
and into the ScheduleDAGInstrs class, so that they don't get
destructed and re-constructed for each block. This fixes a
compile-time hot spot in the post-pass scheduler.

To help facilitate this, tidy and do some minor reorganization
in the scheduler constructor functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62275 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-15 19:20:50 +00:00
Dan Gohman
c13cf130c4 Make getWidenVectorType const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62265 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-15 17:34:08 +00:00
Dan Gohman
73e0914848 Const-qualify getPreIndexedAddressParts and friends.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-15 16:29:45 +00:00
Dale Johannesen
2f46bb8178 Fix the time regression I introduced in 464.h264ref with
my earlier patch to this file.

The issue there was that all uses of an IV inside a loop
are actually references to Base[IV*2], and there was one
use outside that was the same but LSR didn't see the base
or the scaling because it didn't recurse into uses outside
the loop; thus, it used base+IV*scale mode inside the loop
instead of pulling base out of the loop.  This was extra bad
because register pressure later forced both base and IV into
memory.  Doing that recursion, at least enough
to figure out addressing modes, is a good idea in general;
the change in AddUsersIfInteresting does this.  However,
there were side effects....

It is also possible for recursing outside the loop to
introduce another IV where there was only 1 before (if
the refs inside are not scaled and the ref outside is).
I don't think this is a common case, but it's in the testsuite.
It is right to be very aggressive about getting rid of
such introduced IVs (CheckForIVReuse and the handling of
nonzero RewriteFactor in StrengthReduceStridedIVUsers).
In the testcase in question the new IV produced this way
has both a nonconstant stride and a nonzero base, neither
of which was handled before.  And when inserting 
new code that feeds into a PHI, it's right to put such 
code at the original location rather than in the PHI's 
immediate predecessor(s) when the original location is outside 
the loop (a case that couldn't happen before)
(RewriteInstructionToUseNewBase); better to avoid making
multiple copies of it in this case.

Also, the mechanism for keeping SCEV's corresponding to GEP's
no longer works, as the GEP might change after its SCEV
is remembered, invalidating the SCEV, and we might get a bad
SCEV value when looking up the GEP again for a later loop.  
This also couldn't happen before, as we weren't recursing
into GEP's outside the loop.

Also, when we build an expression that involves a (possibly
non-affine) IV from a different loop as well as an IV from
the one we're interested in (containsAddRecFromDifferentLoop),
don't recurse into that.  We can't do much with it and will
get in trouble if we try to create new non-affine IVs or something.

More testcases are coming.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62212 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-14 02:35:31 +00:00
Ted Kremenek
07c2a78c2b Add member template MallocAllocator::Allocate(Num) (to match the same function in BumpPtrAllocator).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62202 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-14 00:38:21 +00:00
Devang Patel
bbdc8207d5 Removoe MachineModuleInfo methods (and related DebugInfoDesc class hierarchy) that were used to handle debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62199 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-13 23:54:55 +00:00
Devang Patel
e2051627b8 Keep "has debug info" big in MachineModuleInfo to avoid circular dependency between AsmPrinter and CodeGen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62191 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-13 23:02:17 +00:00
Devang Patel
35fe7344ae Undo previous checkin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62190 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-13 22:54:57 +00:00
Devang Patel
c48c550e13 Use DwarfWriter to record dbg variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62185 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-13 21:44:10 +00:00
Devang Patel
bb8c5959c8 Use dwarf writer to decide whether the module has debug info or not.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62184 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-13 21:25:00 +00:00
Nick Lewycky
789558db70 Wind SCEV back in time, to Nov 18th. This 'fixes' PR3275, PR3294, PR3295,
PR3296 and PR3302.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62160 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-13 09:18:58 +00:00
Chris Lattner
3ff704fa2b add a new insertAfter method, patch by Tom Jablin!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62158 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-13 07:43:51 +00:00
Owen Anderson
0c2e7b9ab6 Fix fallout from r62144. Evan, please double check this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62150 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-13 06:05:10 +00:00
Devang Patel
83489bb770 Use DebugInfo interface to lower dbg_* intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62127 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-13 00:35:13 +00:00
Devang Patel
486938f7a1 Add classof() methods to support isa<> and other related facilities.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62104 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-12 21:38:43 +00:00
Duncan Sands
ceb4d1aecb Rename getABITypeSize to getTypePaddedSize, as
suggested by Chris.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62099 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-12 20:38:59 +00:00
Devang Patel
ccca7fe6a3 Add DwarfWriter interface to mainipulate source location info.
( May be this info should be directly handled by the dwarf writer ? )


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62096 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-12 19:17:34 +00:00
Rafael Espindola
c775ea1376 Remove some dead code from the days llvm had type planes.
There might be more dead code, but with llvm-gcc bootstrap broken on linux x86-64 it is had to test :-(



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62088 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-12 15:53:25 +00:00
Evan Cheng
c29a56dedb Fix PR3241: Currently EmitCopyFromReg emits a copy from the physical register to a virtual register unless it requires an expensive cross class copy. That means we are only treating "expensive to copy" register dependency as physical register dependency.
Also future proof the scheduler to handle "normal" physical register dependencies. The code is not exercised yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62074 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-12 03:19:55 +00:00
Chris Lattner
a62c302ddd add nocapture attribute to llvm.mem* intrinsics and have tblgen
parse them.  tblgen doesn't yet do anything with this info though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62065 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-12 01:12:03 +00:00
Gabor Greif
0e182c3962 drats! remove tabs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62056 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-11 22:39:04 +00:00
Gabor Greif
255b26ea35 simplify CallSite helper class to not consult the Instruction's
opcode on each delegation.
Instead the information is cached on construction and the cached flag used thereafter.
Introduced two predicates: isCall and isInvoke.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62055 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-11 22:33:22 +00:00
Evan Cheng
5c3c5a4d9c Duplicated node may produce a non-physical register def.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62015 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 22:44:02 +00:00
Misha Brukman
3a54b3dc87 Removed trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62000 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 19:25:42 +00:00
Devang Patel
6e7a1617ac Request DwarfWriter. This will be used to handle dbg_* intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61999 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 19:11:50 +00:00
Mikhail Glushenkov
f8c430b3da Add a --check-graph option to llvmc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61989 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 16:16:27 +00:00
Chris Lattner
3bc6ced4c0 add a helper method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61978 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 05:27:40 +00:00
Chris Lattner
6688d75114 fit in 80 cols
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61977 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 04:58:01 +00:00
Dale Johannesen
e345566f8e Adjustments to last patch based on review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61969 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 01:30:11 +00:00
Devang Patel
eb3fc28914 Convert DwarfWriter into a pass.
Now Users request DwarfWriter through getAnalysisUsage() instead of creating an instance of DwarfWriter object directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61955 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 23:40:34 +00:00
Dan Gohman
5d5ee80ea8 Delete unnecessary parens around return values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61950 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 22:19:34 +00:00
Dan Gohman
a82a918507 Correct the form of the atomic opcode names in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61947 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 22:14:50 +00:00
Dale Johannesen
4362387c74 Do not inline functions with (dynamic) alloca into
functions that don't already have a (dynamic) alloca.
Dynamic allocas cause inefficient codegen and we shouldn't
propagate this (behavior follows gcc).  Two existing tests
assumed such inlining would be done; they are hacked by
adding an alloca in the caller, preserving the point of
the tests.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61946 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 21:45:23 +00:00
Bill Wendling
38593664b0 * Don't explicitly cast "0" to "void*". This doesn't work well with specialized
StringMapEntryInitializer classes. Leave it for the compiler to figure out what
 the type is and what "0" should be transformed into.

* Un-disable the unit tests which test the StringMapEntryInitializer class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61922 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 08:26:46 +00:00
Misha Brukman
538fbb5086 Remove extra blank line and space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61916 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 06:11:51 +00:00
Misha Brukman
8bb5e99013 * Added unittests for StringMap
* Fixed but in StringMap::clear()
* Removed trailing whitespace

Original patch by Talin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61914 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 04:48:20 +00:00
Misha Brukman
e21a6bae80 * Fixed spelling of "sentinel"
* Removed trailing whitespace


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61907 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 02:21:23 +00:00
Bob Wilson
850168c370 Assert that VectorType::getTruncatedElementVectorType is not used with
odd bit-width vector elements.  Add a check in the verifier for this also.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61899 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-07 23:44:27 +00:00
Chris Lattner
71c3f45990 remove DebugInfoBuilder, it has been subsumed by Analysis/DebugInfo.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61898 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-07 23:25:06 +00:00
Dan Gohman
00ffd505d3 Add empty() methods for register def lists.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61890 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-07 22:28:56 +00:00
Evan Cheng
8f90b6eb2f The coalescer does not coalesce a virtual register to a physical register if any of the physical register's sub-register live intervals overlaps with the virtual register. This is overly conservative. It prevents a extract_subreg from being coalesced away:
v1024 = EDI  // not killed
      =
      = EDI

One possible solution is for the coalescer to examine the sub-register live intervals in the same manner as the physical register. Another possibility is to examine defs and uses (when needed) of sub-registers. Both solutions are too expensive. For now, look for "short virtual intervals" and scan instructions to look for conflict instead.

This is a small win on x86-64. e.g. It shaves 403.gcc by ~80 instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61847 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-07 02:08:57 +00:00
Bob Wilson
bc03979536 Improve support for type-generic vector intrinsics by teaching TableGen how
to handle LLVMMatchType intrinsic parameters, and by adding new subclasses
of LLVMMatchType to match vector types with integral elements that are 
either twice as wide or half as wide as the elements of the matched type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61834 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-07 00:09:01 +00:00
Chris Lattner
b9f08a00af no need to negate the APInt for 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61777 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-06 00:06:25 +00:00
Chris Lattner
159c35b3ee Change m_ConstantInt and m_SelectCst to take their constant integers
as template arguments instead of as instance variables, exposing more
optimization opportunities to the compiler earlier.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61776 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 23:53:12 +00:00
Chris Lattner
06ebbcc71d make m_ConstantInt(int64_t) safely match ConstantInt's that are larger than i64.
This fixes an instcombine crash on PR3235.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61775 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 23:45:50 +00:00
Bill Wendling
d60de51878 Revert r61415 and r61484. Duncan was correct that these weren't needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61765 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 22:53:45 +00:00
Devang Patel
8526cc03a5 Extract source location info from DebugInfo.
Add methods to add source location info in a DIE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61761 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 22:35:52 +00:00
Duncan Sands
676b9dfe2f Add a note about passing MVT::Other to getSetCCResultType.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61756 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 21:33:06 +00:00
Devang Patel
a22d57d6f8 Add classof() methods so that dwarf writer can decide what DIDescriptor is in its hand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61740 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 19:55:07 +00:00
Dan Gohman
50b84f44e4 Add <climits>, to get the definition of CHAR_BIT. This should fix
build errors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61736 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 19:47:30 +00:00
Dan Gohman
11df7e5157 TargetLowering.h #includes SelectionDAGNodes.h, so it doesn't need its
own OpActionsCapacity magic number; it can just use ISD::BUILTIN_OP_END,
as long as it takes care to round up when needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61733 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 19:40:39 +00:00
Devang Patel
86ae142c51 Construct stuct field DIEs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61729 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 18:59:44 +00:00
Devang Patel
c69bf2c832 Construct enumerator DIE using DebugInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61726 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 18:38:38 +00:00
Devang Patel
68afdc3ab0 Construct array/vector type DIEs using DebugInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61724 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 18:33:01 +00:00
Devang Patel
2c1623ae0b Now, getTag() is used by DwarfWriter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61718 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 18:06:21 +00:00
Dan Gohman
d68a07650c Tidy up #includes, deleting a bunch of unnecessary #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61715 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 17:59:02 +00:00
Gabor Greif
84fb959489 eliminate tabs from my previous commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61695 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 16:28:14 +00:00
Gabor Greif
fd095b6389 Get rid of the tagging functions and use PointerIntPair.
This means that we have to include an additional header.

This patch should be functionally equivalent. I cannot outrule any performance
degradation, though I do not expect any.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61694 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 16:05:32 +00:00
Nick Lewycky
1186bf1350 Add a mechanism to specify attributes in getOrInsertFunction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61645 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-04 22:54:40 +00:00
Nick Lewycky
30b64129f5 Add utility functions for marking parameters as noalias or nocapture.
Clean up some of the existing code by making it use hasFnAttr/addFnAttr 
and round it off by creating removeFnAttr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61627 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-04 18:21:35 +00:00
Dan Gohman
2c8a1522db Add several more unimplemented operator overloads to ilist_iterator
to help catch errors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61622 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-04 03:22:42 +00:00
Chris Lattner
723a59c17e add #include guards, thanks Dan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61619 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-04 01:28:00 +00:00
Dan Gohman
223942a420 Remove the code from the scheduler that commuted two-address
instructions to avoid copies, because TwoAddressInstructionPass
also does this optimization.  The scheduler's version didn't
account for live-out values, which resulted in spurious commutes
and missed opportunities.

Now, TwoAddressInstructionPass handles all the opportunities,
instead of just those that the scheduler missed. The result is
usually the same, though there are occasional trivial differences
resulting from the avoidance of spurious commutes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61611 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-03 18:01:46 +00:00
Misha Brukman
630fcb8678 * Alphabetized system headers per the style guide
* Minor spacing and comment cleanups


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61590 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 20:26:30 +00:00
Chris Lattner
df98617b23 Reimplement the old and horrible bison parser for .ll files with a nice
and clean recursive descent parser.

This change has a couple of ramifications:
1. The parser code is about 400 lines shorter (in what we maintain, not
   including what is autogenerated).
2. The code should be significantly faster than the old code because we 
   don't have to work around bison's poor handling of datatypes with 
   ctors/dtors.  This also makes the code much more resistant to memory 
   leaks.
3. We now get caret diagnostics from the .ll parser, woo.
4. The actual diagnostics emited from the parser are completely different
   so a bunch of testcases had to be updated.
5. I now disallow "%ty = type opaque %ty = type i32".  There was no good
   reason to support this, it was just an accident of the old 
   implementation.  I have no reason to think that anyone is actually using
   this.
6. The syntax for sticking a global variable has changed to make it 
   unambiguous.  I don't think anyone is depending on this since only clang
   supports this and it is not solid yet, so I'm not worried about anything
   breaking.
7. This gets rid of the last use of bison, and along with it the .cvs files.
   I'll prune this from the makefiles as a subsequent commit.

There are a few minor cleanups that can be done after this commit (suggestions
welcome!) but this passes dejagnu testing and is ready for its time in the
limelight.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61558 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 07:01:27 +00:00
Nick Lewycky
ccc776fd83 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61554 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 05:01:22 +00:00
Duncan Sands
5480c0469e Fix PR3274: when promoting the condition of a BRCOND node,
promote from i1 all the way up to the canonical SetCC type.
In order to discover an appropriate type to use, pass
MVT::Other to getSetCCResultType.  In order to be able to
do this, change getSetCCResultType to take a type as an
argument, not a value (this is also more logical).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61542 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-01 15:52:00 +00:00
Bill Wendling
d5b207baab Some compilers are picky about accessing the first element of a std::vector if
there's nothing in the vector. Pacify them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61536 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-01 01:14:31 +00:00
Duncan Sands
17da06ffbd Don't analyze arguments already marked 'nocapture'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61532 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-31 18:08:59 +00:00
Misha Brukman
3fa0de2727 Fixed grammar and capitalization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61531 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-31 17:44:36 +00:00
Duncan Sands
9e89ba31f1 Rename AddReadAttrs to FunctionAttrs, and teach it how
to work out (in a very simplistic way) which function
arguments (pointer arguments only) are only dereferenced
and so do not escape.  Mark such arguments 'nocapture'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61525 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-31 16:14:43 +00:00
Chris Lattner
033ff38411 Add a new Attribute::getAlignmentFromAttrs method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61517 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-31 08:41:38 +00:00
Bill Wendling
998dee96d3 Linux wants the FDE initial location and address range to be forced to 32-bit.
Darwin doesn't. Make this optional for platforms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61484 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-29 22:12:11 +00:00
Chris Lattner
b76ec320dc move select validation logic into a shared place where the select ctor,
verifier, asm parser, etc can share it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61461 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-29 00:12:50 +00:00
Owen Anderson
169d408027 Forgot to commit this file.
Add a clear() method to remove all ranges and value numbers for a live interval.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61459 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-28 21:57:02 +00:00
Chris Lattner
793b2e3f6f implement simplify_type for PATypeHolder so that isa<FooType>(PATypeHolder)
works.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61448 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-27 07:47:40 +00:00
Bill Wendling
722f5f1cfb Darwin likes for the EH frame to be non-local.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61420 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-24 08:05:17 +00:00
Bill Wendling
d4121bef3c GCC doesn't emit DW_EH_PE_sdata4 for the FDE encoding on Darwin. I'm not sure
about other platforms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61415 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-24 05:25:49 +00:00
Dan Gohman
0b1d4a798d Clean up the atomic opcodes in SelectionDAG.
This removes all the _8, _16, _32, and _64 opcodes and replaces each
group with an unsuffixed opcode. The MemoryVT field of the AtomicSDNode
is now used to carry the size information. In tablegen, the size-specific
opcodes are replaced by size-independent opcodes that utilize the
ability to compose them with predicates.

This shrinks the per-opcode tables and makes the code that handles
atomics much more concise.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61389 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23 21:37:04 +00:00
Dan Gohman
c9a5b9e38b Rename BuildSchedUnits to BuildSchedGraph, and refactor the
code in ScheduleDAGSDNodes' BuildSchedGraph into separate functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61376 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23 18:36:58 +00:00
Dan Gohman
1bda0541f0 Comment MO_FPImmediate and doxygenate surrounding comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61374 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23 18:20:16 +00:00
Dan Gohman
00d448a341 Refactor a bunch of code out of AsmPrinter::EmitGlobalConstant into separate
functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61345 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22 21:14:27 +00:00
Dan Gohman
361c31da5e Add an assertion to the ScheduleDAGInstrs class to catch SUnits
reallocations. We don't do cloning on MachineInstr schedule DAGs,
but this is a worthwhile sanity check regardless.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61343 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22 21:08:08 +00:00
Dan Gohman
fb8a1356b2 Add an accesor for the isNormalMemory field in the SDep class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61342 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22 21:06:56 +00:00
Dan Gohman
983bbbaf36 Add an assertion to catch SUnits reallocations. And add a doxygen
comment for the ScheduleDAGSDNodes class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61341 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22 21:06:20 +00:00
Dan Gohman
b5544940c1 Clarify a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61338 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22 19:44:39 +00:00
Dan Gohman
edf22b97d0 Reword the comment for ConstantInt's getLimitedValue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61280 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-20 17:06:39 +00:00
Dan Gohman
fce4028718 LiveInterval::removeKills and isKill don't need 'this' and
can be static member functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61278 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-20 16:44:40 +00:00
Evan Cheng
5379f412bc Fix PR3149. If an early clobber def is a physical register and it is tied to an input operand, it effectively extends the live range of the physical register. Currently we do not have a good way to represent this.
172     %ECX<def> = MOV32rr %reg1039<kill>
180     INLINEASM <es:subl $5,$1
        sbbl $3,$0>, 10, %EAX<def>, 14, %ECX<earlyclobber,def>, 9, %EAX<kill>,
36, <fi#0>, 1, %reg0, 0, 9, %ECX<kill>, 36, <fi#1>, 1, %reg0, 0
188     %EAX<def> = MOV32rr %EAX<kill>
196     %ECX<def> = MOV32rr %ECX<kill>
204     %ECX<def> = MOV32rr %ECX<kill>
212     %EAX<def> = MOV32rr %EAX<kill>
220     %EAX<def> = MOV32rr %EAX
228     %reg1039<def> = MOV32rr %ECX<kill>

The early clobber operand ties ECX input to the ECX def.

The live interval of ECX is represented as this:
%reg20,inf = [46,47:1)[174,230:0)  0@174-(230) 1@46-(47)

The right way to represent this is something like
%reg20,inf = [46,47:2)[174,182:1)[181:230:0)  0@174-(182) 1@181-230 @2@46-(47)

Of course that won't work since that means overlapping live ranges defined by two val#.

The workaround for now is to add a bit to val# which says the val# is redefined by a early clobber def somewhere. This prevents the move at 228 from being optimized away by SimpleRegisterCoalescing::AdjustCopiesBackFrom.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61259 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 20:58:01 +00:00
Gordon Henriksen
95ca7314fd Add dyn_cast_or_null bindings for some additional classes missed in r61252.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61253 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 18:51:17 +00:00
Gordon Henriksen
2a9c671a51 C bindings for dyn_cast_or_null.
This operation can be used to build dyn_cast, isa, and cast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61252 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 18:39:45 +00:00
Chris Lattner
38e7721455 Add support for writing LLVM IR to a specified BitstreamWriter.
Patch by Lukasz Janyst!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61251 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 18:37:59 +00:00
Rafael Espindola
2f6fea90a5 Fix bug 3202.
The EH_frame and .eh symbols are now private, except for darwin9 and earlier.
The patch also fixes the definition of PrivateGlobalPrefix on pcc linux.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61242 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 10:55:56 +00:00
Nick Lewycky
f23d0d392a Resubmit support for the 'nocapture' attribute.
The problematic part of this patch is that we were out of attribute bits,
requiring some fancy bit hacking to make it fit (by shrinking alignment)
without breaking existing users or the file format.

This change will require users to rebuild llvm-gcc to match llvm.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61239 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 06:39:12 +00:00
Dan Gohman
5b200d8a13 Fix RegScavenger::forward() to work on basic blocks containing exactly
one instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61236 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 00:45:13 +00:00
Dan Gohman
9755faab60 Delete the RegScavenging constructor that takes a MachineBasicBlock
argument. Nothing was using it, and it set the MBB member without
calling enterBasicBlock, which was problematic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61234 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 00:34:32 +00:00
Mon P Wang
87c8a8f304 Added support for vector widening.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61209 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18 20:03:17 +00:00
Devang Patel
854967effe Today the front-ends (llvm-gcc and clang) generate multiple llvm.dbg.compile_units to identify source file for various debug entities. Each llvm.dbg.compile_unit matches one file on the disk. However, the backend only supports one DW_TAG_compile_unit per .o file. The backend selects first compile_unit from the vector to construct DW_TAG_compile_unit entry, which is not correct in all cases.
First step to resolve this is, record file name and directory directly in debug info for various debug entities. 



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61164 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-17 22:39:29 +00:00
Chris Lattner
851ba39dab This adds some missing functions to the C binding:
- ability to insert previously created instructions using a builder
- creation of aliases
- creation of inline asm constants

Patch by Zoltan Varga!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61153 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-17 21:39:50 +00:00
Dan Gohman
89bf4f2f5e Fix the comments for getDepth and getHeight.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61120 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-17 04:24:23 +00:00
Mikhail Glushenkov
5c2b6b26c9 Some enhancements for the 'case' expression.
Add (error) and (empty).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61117 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-17 02:47:01 +00:00
Bill Wendling
6fa311c233 Temporarily revert r61019, r61030, and r61040. These were breaking LLVM Release
builds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61094 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 19:06:48 +00:00
Torok Edwin
6e68106a47 Add -print-dbginfo pass that prints LLVM IR with comments inserted to show
which source/line a certain BB/instruction comes from, original variable names,
and original (unmangled) C++ name of functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61085 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 09:09:19 +00:00
Torok Edwin
620f28095b Add utility functions to search for DbgStopPointInst corresponding to an
instruction or BasicBlock, and to search for DbgDeclareInst corresponding to a
variable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61084 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 09:07:36 +00:00
Dan Gohman
8749b61178 Add initial support for back-scheduling address computations,
especially in the case of addresses computed from loop induction
variables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61075 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 03:35:01 +00:00
Dan Gohman
3f23744df4 Fix some register-alias-related bugs in the post-RA scheduler liveness
computation code. Also, avoid adding output-depenency edges when both
defs are dead, which frequently happens with EFLAGS defs.

Compute Depth and Height lazily, and always in terms of edge latency
values. For the schedulers that don't care about latency, edge latencies
are set to 1.

Eliminate Cycle and CycleBound, and LatencyPriorityQueue's Latencies array.
These are all subsumed by the Depth and Height fields.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61073 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 03:25:46 +00:00
Dan Gohman
c6b680eee5 Move addPred and removePred out-of-line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61067 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 01:05:52 +00:00
Dan Gohman
ffa391272b Make addPred and removePred return void, since the return value is not
currently used by anything.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61066 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 01:00:55 +00:00
Dan Gohman
c3df7a8884 Add a getSDep() access function to SUnitIterator to return the
current SDep.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61064 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 00:51:33 +00:00
Dan Gohman
e7c1c660ad Reorder some SDep methods. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61063 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 00:48:53 +00:00
Dan Gohman
537add3492 SDep's operator== should compare the Latency field too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61062 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 00:47:19 +00:00
Dan Gohman
2b00aebda9 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61035 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15 17:26:50 +00:00
Nick Lewycky
382da62ec2 It turns out that "align 1" and unaligned are different. Add a bias to the
alignment attribute such that 0 means unaligned.

This will probably require a rebuild of llvm-gcc because of the change to
Attributes.h. If you see many test failures on "make check", please rebuild
your llvm-gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61030 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15 07:29:55 +00:00
Chris Lattner
9e59c64c14 Implement initial support for PHI translation in memdep. This means that
memdep keeps track of how PHIs affect the pointer in dep queries, which 
allows it to eliminate the load in cases like rle-phi-translate.ll, which
basically end up being:

BB1:
   X = load P
   br BB3
BB2:
   Y = load Q
   br BB3
BB3:
   R = phi [P] [Q]
   load R

turning "load R" into a phi of X/Y.  In addition to additional exposed
opportunities, this makes memdep safe in many cases that it wasn't before
(which is required for load PRE) and also makes it substantially more 
efficient.  For example, consider:


bb1:  // has many predecessors.
   P = some_operator()
   load P

In this example, previously memdep would scan all the predecessors of BB1
to see if they had something that would mustalias P.  In some cases (e.g.
test/Transforms/GVN/rle-must-alias.ll) it would actually find them and end
up eliminating something.  In many other cases though, it would scan and not
find anything useful.  MemDep now stops at a block if the pointer is defined
in that block and cannot be phi translated to predecessors.  This causes it
to miss the (rare) cases like rle-must-alias.ll, but makes it faster by not
scanning tons of stuff that is unlikely to be useful.  For example, this
speeds up GVN as a whole from 3.928s to 2.448s (60%)!.  IMO, scalar GVN 
should be enhanced to simplify the rle-must-alias pointer base anyway, which
would allow the loads to be eliminated.

In the future, this should be enhanced to phi translate through geps and 
bitcasts as well (as indicated by FIXMEs) making memdep even more powerful.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61022 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15 03:35:32 +00:00
Nick Lewycky
e642658480 Introducing nocapture, a parameter attribute for pointers to indicate that the
callee will not introduce any new aliases of that pointer.

The attributes had all bits allocated already, so I decided to collapse
alignment. Alignment was previously stored as a 16-bit integer from bits 16 to
32 of the attribute, but it was required to be a power of 2. Now it's stored in
log2 encoded form in five bits from 16 to 21. That gives us 11 more bits of
space.

You may have already noticed that you only need four bits to encode a 16-bit
power of two, so why five bits? Because the AsmParser accepted 32-bit
alignments, even though we couldn't store them (they were silently discarded).
Now we can store them in memory, but not in the bitcode.

The bitcode format was already storing these as 64-bit VBR integers. So, the
bitcode format stays the same, keeping the alignment values stored as 16 bit
raw values. There's some hideous code in the reader and writer that deals with
this, waiting to be ripped out the moment we run out of bits again and have to
replace the parameter attributes table encoding.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61019 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15 01:34:58 +00:00
Duncan Sands
b6862bbe34 Reapply r60997, this time without forgetting that
target constants are allowed to have an illegal
type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61006 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-14 09:43:15 +00:00
Bill Wendling
2d8cc31521 Temporarily revert r60997. It was causing this failure:
Running /Users/void/llvm/llvm.src/test/CodeGen/Generic/dg.exp ...
FAIL: /Users/void/llvm/llvm.src/test/CodeGen/Generic/asm-large-immediate.ll
Failed with exit(1) at line 1
while running:  llvm-as < /Users/void/llvm/llvm.src/test/CodeGen/Generic/asm-large-immediate.ll |  llc | /usr/bin/grep 68719476738
Assertion failed: ((TypesNeedLegalizing || getTypeAction(VT) == Legal) && "Illegal type introduced after type legalization?"), function HandleOp, file /Users/void/llvm/llvm.src/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp, line 493.
0   llc               0x0085392e char const* std::find<char const*, char>(char const*, char const*, char const&) + 98
1   llc               0x00853e63 llvm::sys::PrintStackTraceOnErrorSignal() + 593
2   libSystem.B.dylib 0x96cac09b _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1765097359
4   libSystem.B.dylib 0x96d24ec2 raise + 26
5   libSystem.B.dylib 0x96d3447f abort + 73
6   libSystem.B.dylib 0x96d26063 __assert_rtn + 101
7   llc               0x004f9018 llvm::cast_retty<llvm::SubprogramDesc, llvm::DebugInfoDesc*>::ret_type llvm::cast<llvm::Sub
...




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61001 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-13 23:53:00 +00:00
Duncan Sands
0f546d4565 LegalizeDAG is not supposed to introduce illegal
types into the DAG if they were not already there.
Check this with an assertion.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60997 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-13 22:33:38 +00:00
Cedric Venet
c1edbfc2ba Add explicit this-> for some member function in templated base class.
These call are probably dependent but VS with /Za don't seems to think so. We need to help him.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60978 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-13 10:55:13 +00:00
Torok Edwin
b07fbd9bdd Fix getFieldAs() to use the parameter instead of 6.
Add missing DIType constructor, needed by DIVariable::getType().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60976 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-13 08:25:29 +00:00
Torok Edwin
9053a739e5 fix grammar, thanks Duncan!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60875 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 11:44:49 +00:00
Mikhail Glushenkov
de1e521648 Merge Base.td and Tools.td.
This stuff is not used outside Base.td, and with the conversion of the
compilation graph to string-based format became much less (if at all)
useful.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60873 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 10:38:06 +00:00
Torok Edwin
87f1e7796d introduce BasicBlock::getUniquePredecessor()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60872 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 10:36:07 +00:00
Evan Cheng
5788d1a169 Fix MachineCodeEmitter to use uintptr_t instead of intptr_t. This avoids some overflow issues. Patch by Thomas Jablin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60828 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 02:32:19 +00:00
Dan Gohman
f55a2101e3 Update CalcLatency to work in terms of edge latencies, rather than
node latencies. Use CalcLatency instead of manual code in
CalculatePriorities to keep it consistent. Previously it
computed slightly different results.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60817 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 00:24:36 +00:00
Evan Cheng
94ea5be39f Fix a couple of Dwarf bugs.
- Emit DW_AT_byte_size for struct and union of size zero.
- Emit DW_AT_declaration for forward type declaration.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60812 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 00:15:44 +00:00
Dan Gohman
54e4c36a73 Rewrite the SDep class, and simplify some of the related code.
The Cost field is removed. It was only being used in a very limited way,
to indicate when the scheduler should attempt to protect a live register,
and it isn't really needed to do that. If we ever want the scheduler to
start inserting copies in non-prohibitive situations, we'll have to
rethink some things anyway.

A Latency field is added. Instead of giving each node a single
fixed latency, each edge can have its own latency. This will eventually
be used to model various micro-architecture properties more accurately.

The PointerIntPair class and an internal union are now used, which
reduce the overall size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60806 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 22:54:47 +00:00
Bill Wendling
74c3765291 Add sub/mul overflow intrinsics. This currently doesn't have a
target-independent way of determining overflow on multiplication. It's very
tricky. Patch by Zoltan Varga!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60800 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 22:08:41 +00:00
Chris Lattner
bc99be10b8 Teach GVN to invalidate some memdep information when it does an RAUW
of a pointer.  This allows is to catch more equivalencies.  For example,
the type_lists_compatible_p function used to require two iterations of
the gvn pass (!) to delete its 18 redundant loads because the first pass
would CSE all the addressing computation cruft, which would unblock the
second memdep/gvn passes from recognizing them.  This change allows
memdep/gvn to catch all 18 when run just once on the function (as is 
typical :) instead of just 3.

On all of 403.gcc, this bumps up the # reundandancies found from:

     63 gvn    - Number of instructions PRE'd
 153991 gvn    - Number of instructions deleted
  50069 gvn    - Number of loads deleted
to:
     63 gvn    - Number of instructions PRE'd
 154137 gvn    - Number of instructions deleted
  50185 gvn    - Number of loads deleted

+120 loads deleted isn't bad.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60799 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 22:06:23 +00:00
Duncan Sands
47d9dcc584 Fix PR3117: not all nodes being legalized. The
essential problem was that the DAG can contain
random unused nodes which were never analyzed.
When remapping a value of a node being processed,
such a node may become used and need to be analyzed;
however due to operands being transformed during
analysis the node may morph into a different one.
Users of the morphing node need to be updated, and
this wasn't happening.  While there I added a bunch
of documentation and sanity checks, so I (or some
other poor soul) won't have to scratch their head
over this stuff so long trying to remember how it
was all supposed to work next time some obscure
problem pops up!  The extra sanity checking exposed
a few places where invariants weren't being preserved,
so those are fixed too.  Since some of the sanity
checking is expensive, I added a flag to turn it
on.  It is also turned on when building with
ENABLE_EXPENSIVE_CHECKS=1.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60797 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 21:33:20 +00:00
Chris Lattner
20d6f0982a Teach BasicAA::getModRefInfo(CallSite, CallSite) some
tricks based on readnone/readonly functions.

Teach memdep to look past readonly calls when analyzing
deps for a readonly call.  This allows elimination of a
few more calls from 403.gcc:

before:
     63 gvn    - Number of instructions PRE'd
 153986 gvn    - Number of instructions deleted
  50069 gvn    - Number of loads deleted

after:
     63 gvn    - Number of instructions PRE'd
 153991 gvn    - Number of instructions deleted
  50069 gvn    - Number of loads deleted

5 calls isn't much, but this adds plumbing for the next change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60794 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 21:19:42 +00:00
Chris Lattner
1559b3625b rename getNonLocalDependency -> getNonLocalCallDependency, and remove
pointer stuff from it, simplifying the code a bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60783 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 19:38:05 +00:00
Mikhail Glushenkov
74bcb057c0 Support -emit-llvm properly (with -S and -c).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60764 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 14:40:18 +00:00
Chris Lattner
9863c3f507 rename getNonLocalPointerDepInternal -> getNonLocalPointerDepFromBB
and split its inner loop out into a new GetNonLocalInfoForBlock
function.  No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60751 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 07:47:11 +00:00
Evan Cheng
77f86ad087 DisableGVCompilation should not abort on internal GlobalValue's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60750 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 07:31:49 +00:00
Chris Lattner
0401245ab3 newline at end of phile
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60744 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 06:32:32 +00:00
Chris Lattner
4012fdda13 use hte new pred cache to speed up the new non-local memdep
queries.  This speeds up GVN using the new queries (not yet
checked in) by just over 10%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60743 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 06:28:49 +00:00
Chris Lattner
312b9a17e6 pred_iterator got a lot slower since use-diet landed. This is a
really simple cache class for these queries.  Hopefully this can
be removed if pred_iterator speeds back up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60742 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 06:27:07 +00:00
Dan Gohman
5fb580efd6 Fix the name of ISD::TokenFactor in a comment. Thanks Gabor!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60736 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 02:18:52 +00:00
Chris Lattner
fe1d9e9588 remove two unneeded forward declarations, pointed out by Gabor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60735 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 02:10:10 +00:00
Dan Gohman
b79a01111d Move the conversion to intptr_t to a separate statement. This
avoids GCC's warning even on 64-bit hosts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60706 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 17:41:24 +00:00
Ted Kremenek
4cd3145223 Use 'delete []' instead of 'delete' in OwningArray::reset().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60703 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 17:28:11 +00:00
Duncan Sands
174f938bd0 Fix comment typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60698 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 14:10:36 +00:00
Dan Gohman
c8a1a3c426 Factor out the code for sign-extending/truncating gep indices
and use it in x86 address mode folding. Also, make
getRegForValue return 0 for illegal types even if it has a
ValueMap for them, because Argument values are put in the
ValueMap. This fixes PR3181.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60696 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 07:57:47 +00:00
Chris Lattner
11dcd8d38d add another level of caching for non-local pointer queries, keeping
track of whether the CachedNonLocalPointerInfo for a block is specific
to a block.  If so, just return it without any pred scanning.  This is
good for a 6% speedup on GVN (when it uses this lookup method, which
it doesn't right now).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 07:31:50 +00:00
Chris Lattner
bedb8c1d35 introduce a new RoundUpAlignment helper function, use it to
remove some more 64-bit divs and rems from the StructLayout 
ctor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60692 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 07:11:56 +00:00
Dan Gohman
149cfc3519 Make ConstantAggregateZero::get return a ConstantAggregateZero*,
as suggested in PR3182.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60691 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 07:10:54 +00:00
Chris Lattner
0a3ba71a05 Speed up getABITypeSize by turning a i64 mul and div into an
AND.  This is speedup on any reasonable target, but particularly
on 32-bit targets where this often turns into a libcall like udivdi3.

We know that alignments are a power of two but the compiler doesn't.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60688 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 06:50:51 +00:00
Dan Gohman
fb4b58c9aa Clarify a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60685 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 04:54:58 +00:00
Dan Gohman
2e3e5bf427 Move createVirtualRegister out-of-line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60684 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 04:54:11 +00:00
Dan Gohman
c765a5acad Use bool instead of int, now that it no longer evokes a warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60678 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 21:33:27 +00:00
Dan Gohman
994fd5354b Use intptr_t instead of unsigned here, which is more appropriate
in a really obscure way, but more importantly has the side effect
of avoiding a GCC warning in the case that IntType is bool.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60677 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 21:28:00 +00:00
Chris Lattner
e91a4881e1 fix a typo duncan noticed!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60671 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 18:21:37 +00:00
Mikhail Glushenkov
b4ced5a3c4 Make 'extern' an option property.
Makes (forward) work better.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60667 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 16:47:12 +00:00
Mikhail Glushenkov
940cdfe697 Plugin updates: support more options.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60666 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 16:46:23 +00:00
Mikhail Glushenkov
f915253dfc Use (actions) instead of option properties, support external options.
Also includes a major refactoring. See documentation for more
information.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60656 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 16:41:11 +00:00
Chris Lattner
6290f5cac2 add support for caching pointer dependence queries. Nothing uses this yet
so it "can't" break anything.  That said, it does appear to work.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60654 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 08:50:20 +00:00
Chris Lattner
9a193fd8ae Some internal refactoring to make it easier to cache results.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60650 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 02:56:57 +00:00
Chris Lattner
7ebcf03246 Introduce a new MemDep::getNonLocalPointerDependency
method.  This will eventually take over load/store dep
queries from getNonLocalDependency.  For now it works
fine, but is incredibly slow because it does no caching.
Lets not switch GVN to use it until that is fixed :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60649 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 02:15:47 +00:00
Chris Lattner
e79be944c8 push the "pointer case" up the analysis stack a bit. This causes
duplication of logic (in 2 places) to determine what pointer a 
load/store touches.  This will be addressed in a future commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60648 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 01:50:16 +00:00
Chris Lattner
8ef57c5faf Rename getCallSiteDependency -> getCallSiteDependencyFrom to
emphasize the scanning and make it more similar to 
getDependencyFrom
 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60642 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 00:35:51 +00:00
Chris Lattner
aea5a2a22a make getDependencyFrom private.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60637 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 00:16:50 +00:00
Chris Lattner
b51deb929c Make a few major changes to memdep and its clients:
1. Merge the 'None' result into 'Normal', making loads
   and stores return their dependencies on allocations as Normal.
2. Split the 'Normal' result into 'Clobber' and 'Def' to
   distinguish between the cases when memdep knows the value is
   produced from when we just know if may be changed.
3. Move some of the logic for determining whether readonly calls
   are CSEs into memdep instead of it being in GVN.  This still
   leaves verification that the arguments are hte same to GVN to
   let it know about value equivalences in different contexts.
4. Change memdep's call/call dependency analysis to use 
   getModRefInfo(CallSite,CallSite) instead of doing something 
   very weak.  This only really matters for things like DSA, but
   someday maybe we'll have some other decent context sensitive
   analyses :)
5. This reimplements the guts of memdep to handle the new results.
6. This simplifies GVN significantly:
   a) readonly call CSE is slightly simpler
   b) I eliminated the "getDependencyFrom" chaining for load 
      elimination and load CSE doesn't have to worry about 
      volatile (they are always clobbers) anymore.
   c) GVN no longer does any 'lastLoad' caching, leaving it to 
      memdep.
7. The logic in DSE is simplified a bit and sped up.  A potentially
   unsafe case was eliminated.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60607 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 21:04:20 +00:00
Chris Lattner
6951381995 Make it illegal to call getDependency* on non-memory instructions
like binary operators.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60600 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 18:46:19 +00:00
Chris Lattner
7f50863e52 add a new pop_back_val method which returns the value popped. This is
heretical from a STL standpoint, but is oh-so-useful for things that 
can't throw exceptions when copied, like, well, everything in LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60587 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 07:11:05 +00:00
Dan Gohman
2ce7f2068f Drop the reg argument to isRegReDefinedByTwoAddr, which was redundant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60586 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 05:45:42 +00:00
Dan Gohman
4c0d951780 Update comments. There is no getArgumentAccesses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60585 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 05:35:21 +00:00
Ted Kremenek
d75ba1c357 Have raw_fd_ostream keep track of the position in the file to make tell() go faster by not requiring a flush().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60560 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 22:51:11 +00:00
Dan Gohman
d71703deec Have PseudoSourceValue override Value::dump, so that it works
on PseudoSourceValue values. This also fixes a FIXME in
lib/VMCode/AsmWriter.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60507 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 21:37:21 +00:00
Chris Lattner
29874e0dc6 Factor some code into a new FoldSingleEntryPHINodes method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60501 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 19:44:02 +00:00
Chris Lattner
7c99f49368 fix a really incorrect comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60492 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 19:18:54 +00:00
Dan Gohman
c54baa2d43 Split foldMemoryOperand into public non-virtual and protected virtual
parts, and add target-independent code to add/preserve
MachineMemOperands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60488 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 18:43:12 +00:00
Dan Gohman
15511cf166 Rename isSimpleLoad to canFoldAsLoad, to better reflect its meaning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60487 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 18:15:48 +00:00
Dan Gohman
8cf7713753 Extend X86's addFrameReference to add a MachineMemOperand for
the frame reference. This will help post-RA scheduling determine
that spills to distinct stack slots are independent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60486 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 18:11:40 +00:00
Rafael Espindola
952b839ce9 Fix bug 3140.
Print a single parameter .file directive if we have an ELF target.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60480 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 11:01:37 +00:00
Chris Lattner
71af9b07a5 Rename DeleteBlockIfDead to DeleteDeadBlock and make it
unconditionally delete the block.  All likely clients will
do the checking anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60464 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 06:40:52 +00:00
Chris Lattner
2b1ba24fb7 Factor some code out of SimplifyCFG, forming a new
DeleteBlockIfDead method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60463 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 06:37:44 +00:00
Dan Gohman
62c939d7d5 Mark x86's V_SET0 and V_SETALLONES with isSimpleLoad, and teach X86's
foldMemoryOperand how to "fold" them, by converting them into constant-pool
loads. When they aren't folded, they use xorps/cmpeqd, but for example when
register pressure is high, they may now be folded as memory operands, which
reduces register pressure.

Also, mark V_SET0 isAsCheapAsAMove so that two-address-elimination will
remat it instead of copying zeros around (V_SETALLONES was already marked).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60461 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 05:21:24 +00:00
Dan Gohman
03e7d834d5 Add an explicit keyword.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60457 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 01:55:47 +00:00
Dan Gohman
92faff2e4c Replace a #include with a forward-declaration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60456 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 01:53:18 +00:00
Chris Lattner
1d93b2e1b6 Fix isIntN to work with APInts > 64 bits. This method is only
used by clang apparently.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60446 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 23:33:29 +00:00
Chris Lattner
01c8e0233d Comment typeo fix, thanks Duncan!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60429 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 18:33:11 +00:00
Nick Lewycky
48dd644109 Add a new SCEV representing signed division.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60407 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 08:05:48 +00:00
Chris Lattner
c7f7c1dc50 add a little helper function that does PHI translation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60405 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 07:16:45 +00:00
Chris Lattner
b6bbe6320b add densemap range insertion method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60400 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 06:08:04 +00:00
Bill Wendling
13d6d446f6 Expand getVTList, getNodeValueTypes, and SelectNodeTo to handle more value types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60381 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 23:28:22 +00:00
Chris Lattner
c65fc3bd27 reenable array_pod_sort, this time hopefully happy on 64-bit
and big endian systems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60371 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 21:11:25 +00:00
Chris Lattner
7b6113c6e2 don't #include <algorithm> into the llvm namespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60365 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 19:45:45 +00:00
Chris Lattner
de5debfb58 switch to std::sort until I have time to sort this out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60354 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 17:00:08 +00:00
Chris Lattner
0f41ad3bc9 cleanups suggested by duncan, thanks!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60353 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 16:55:19 +00:00
Chris Lattner
545fc87454 define array_pod_sort in terms of operator< instead of my brain
damaged approximation.  This should fix it on big endian platforms
and on 64-bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60352 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 16:50:01 +00:00
Duncan Sands
aaffa05d0a There are no longer any places that require a
MERGE_VALUES node with only one operand, so get
rid of special code that only existed to handle
that possibility.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60349 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 11:41:29 +00:00
Duncan Sands
1607f05cb7 Change the interface to the type legalization method
ReplaceNodeResults: rather than returning a node which
must have the same number of results as the original
node (which means mucking around with MERGE_VALUES,
and which is also easy to get wrong since SelectionDAG
folding may mean you don't get the node you expect),
return the results in a vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60348 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 11:39:25 +00:00
Chris Lattner
4329c42840 don't assume iterators implicitly convert to pointers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60336 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 06:50:46 +00:00
Chris Lattner
99d0015735 Introduce a new array_pod_sort function and switch LSR to use it
instead of std::sort.  This shrinks the release-asserts LSR.o file
by 1100 bytes of code on my system.

We should start using array_pod_sort where possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60335 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 06:49:59 +00:00
Chris Lattner
bf145d6e2b Reimplement the non-local dependency data structure in terms of a sorted
vector instead of a densemap.  This shrinks the memory usage of this thing
substantially (the high water mark) as well as making operations like
scanning it faster.  This speeds up memdep slightly, gvn goes from
3.9376 to 3.9118s on 403.gcc

This also splits out the statistics for the cached non-local case to
differentiate between the dirty and clean cached case.  Here's the stats
for 403.gcc:

  6153 memdep - Number of dirty cached non-local responses
169336 memdep - Number of fully cached non-local responses
162428 memdep - Number of uncached non-local responses

yay for caching :)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60313 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 01:15:42 +00:00
Eli Friedman
3864cd4cab Fix bogus assertion using getSExtValue for legitimate values, like -1 in
an 128-bit-wide integer.  No testcase; the issue I ran into depends on 
local changes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60311 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 00:43:48 +00:00
Chris Lattner
fd3dcbea06 Eliminate the DepResultTy abstraction. It is now completely
redundant with MemDepResult, and MemDepResult has a nicer interface.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60308 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 23:17:19 +00:00
Chris Lattner
d777d405cd Cache TargetData/AliasAnalysis in the pass instead of calling
getAnalysis<>.  getAnalysis<> is apparently extremely expensive.
Doing this speeds up GVN on 403.gcc by 16%!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60304 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 19:24:31 +00:00
Chris Lattner
012618f0fc add the rest of the comparison routines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60303 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 19:10:41 +00:00
Chris Lattner
4a69bade23 Two changes: Make getDependency remove QueryInst for a dirty record's
ReverseLocalDeps when we update it.  This fixes a regression test
failure from my last commit.

Second, for each non-local cached information structure, keep a bit that
indicates whether it is dirty or not.  This saves us a scan over the whole
thing in the common case when it isn't dirty.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60274 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 02:52:26 +00:00
Chris Lattner
25f4b2b7a3 introduce a typedef, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60272 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 02:30:50 +00:00
Chris Lattner
f68f310386 Change NonLocalDeps to be a densemap of pointers to densemap
instead of containing them by value.  This increases the density
(!) of NonLocalDeps as well as making the reallocation case 
faster.  This speeds up gvn on 403.gcc by 2% and makes room for
future improvements.

I'm not super thrilled with having to explicitly manage the new/delete
of the map, but it is necesary for the next change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60271 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 02:28:25 +00:00
Chris Lattner
73ec3cdd71 implement a fixme by introducing a new getDependencyFromInternal
method that returns its result as a DepResultTy instead of as a
MemDepResult.  This reduces conversion back and forth.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60266 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 01:26:32 +00:00
Chris Lattner
0e0a5b690c REmove an old fixme, resolve another fixme by adding liberal
comments about what this class does.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60264 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 01:17:08 +00:00
Chris Lattner
b911824620 fix indentation. std::pair is "isPod" if the first/second are both isPod.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60262 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 00:50:20 +00:00
Chris Lattner
4f8c18c7c7 Eliminate the dropInstruction method, which is not needed any more.
Fix a subtle iterator invalidation bug I introduced in the last commit.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60258 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 23:30:39 +00:00
Nick Lewycky
4fd40e884c Add protected visibility to libLTO.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60257 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 22:49:59 +00:00
Chris Lattner
0ec48ddef2 implement some fixme's: when deleting an instruction with
an entry in the nonlocal deps map, don't reset entries
referencing that instruction to [dirty, null], instead, set
them to [dirty,next] where next is the instruction after the
deleted one.  Use this information in the non-local deps
code to avoid rescanning entire blocks.

This speeds up GVN slightly by avoiding pointless work.  On
403.gcc this makes GVN 1.5% faster. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60256 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 22:02:15 +00:00
Chris Lattner
396a4a55e5 Change MemDep::getNonLocalDependency to return its results as
a smallvector instead of a DenseMap.  This speeds up GVN by 5%
on 403.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60255 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 21:33:22 +00:00
Chris Lattner
86b29ef64a reimplement getNonLocalDependency with a simpler worklist
formulation that is faster and doesn't require nonLazyHelper.
Much less code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60253 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 21:22:42 +00:00
Chris Lattner
233336ebc5 tidy up some variable names.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60243 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 09:22:14 +00:00
Chris Lattner
8c4652790e rename some maps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60242 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 09:20:15 +00:00
Torok Edwin
10ca770020 protect against negative values that would exceed allowed bit width
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60239 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 08:52:45 +00:00
Chris Lattner
b9cf75a15f apparently GCC doesn't believe that I understand C
precedence rules.  Pacify it.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60237 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 08:36:39 +00:00
Duncan Sands
3f7dba7b17 Typo fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60236 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 08:03:35 +00:00
Chris Lattner
5391a1d804 Split getDependency into getDependency and getDependencyFrom, the
former does caching, the later doesn't.  This dramatically simplifies
the logic in getDependency and getDependencyFrom.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60234 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 03:47:00 +00:00
Chris Lattner
7f52422a3c Now that DepType is private, we can start cleaning up some of its uses:
Document the Dirty value more precisely, use it for the uninitialized
DepResultTy value.  Change reverse mappings to be from an instruction*
instead of DepResultTy, and stop tracking other forms.  This makes it more
clear that we only care about the instruction cases.

Eliminate a DepResultTy,bool pair by using Dirty in the local case as well,
shrinking the map and simplifying the code.

This speeds up GVN by ~3% on 403.gcc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60232 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 03:22:12 +00:00
Chris Lattner
4c72400625 Introduce and use a new MemDepResult class to hold the results of a memdep
query.  This makes it crystal clear what cases can escape from MemDep that
the clients have to handle.  This also gives the clients a nice simplified
interface to it that is easy to poke at.

This patch also makes DepResultTy and MemoryDependenceAnalysis::DepType
private, yay.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60231 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 02:29:27 +00:00
Chris Lattner
39f372e23e Reimplement the internal abstraction used by MemDep in terms
of a pointer/int pair instead of a manually bitmangled pointer.
This forces clients to think a little more about checking the 
appropriate pieces and will be useful for internal 
implementation improvements later.

I'm not particularly happy with this.  After going through this
I don't think that the clients of memdep should be exposed to
the internal type at all.  I'll fix this in a subsequent commit.

This has no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60230 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 01:43:36 +00:00
Chris Lattner
d63e618212 Fix sentinels to use correctly 'aligned' pointers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60229 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 01:36:16 +00:00
Chris Lattner
9ac30537aa Fix spello, add DenseMapInfo specialization for PointerIntPair.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60228 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 01:18:05 +00:00
Chris Lattner
d55da4de04 fix comment typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60227 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 23:57:26 +00:00
Chris Lattner
762ac83271 fix a bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60225 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 23:36:15 +00:00
Chris Lattner
34b763694e add a generic "bitmangled pointer" class, which allows a parameterized
pointer and integer type to be used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60224 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 23:31:44 +00:00
Chris Lattner
956033a4f5 comment cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60220 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 22:41:36 +00:00
Chris Lattner
b390b1728e forward declare CallSite instead of #includ'ing it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60217 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 21:47:19 +00:00
Chris Lattner
8b589fa135 rename "ping" to "verifyRemoved". I don't know why 'ping' what chosen,
but it doesn't make any sense at all.

Also make the method const, private, and fit in 80 cols while we're at it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60215 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 21:42:09 +00:00
Chris Lattner
e85866313a comment and indentation improvements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60214 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 21:36:43 +00:00
Mikhail Glushenkov
739c720e66 Add 'hidden' and 'really_hidden' option properties.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60198 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 00:13:25 +00:00
Chris Lattner
4f02c74a8e Enhance RecursivelyDeleteTriviallyDeadInstructions to optionally
return a list of deleted instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60193 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 23:14:34 +00:00
Chris Lattner
3481f24c06 remove doConstantPropagation and dceInstruction, they are just
wrappers around the interesting code and use an obscure iterator
abstraction that dates back many many years.

Move EraseDeadInstructions to Transforms/Utils and name it
RecursivelyDeleteTriviallyDeadInstructions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60191 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 22:57:53 +00:00
Chris Lattner
e3a0884ddf improve const correctness.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60168 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 08:39:18 +00:00
Chris Lattner
52c95856b4 move FindAvailableLoadedValue from JumpThreading to Transforms/Utils.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60166 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 08:10:05 +00:00
Chris Lattner
b29714a10a move MergeBasicBlockIntoOnlyPred to Transforms/Utils.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60162 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 07:43:12 +00:00
Evan Cheng
884c70c912 On x86 favors folding short immediate into some arithmetic operations (e.g. add, and, xor, etc.) because materializing an immediate in a register is expensive in turns of code size.
e.g.
movl 4(%esp), %eax
addl $4, %eax

is 2 bytes shorter than

movl $4, %eax
addl 4(%esp), %eax


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60139 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 00:49:46 +00:00
Ted Kremenek
9f1f00ab1b Add typedef to StringMapEntry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60134 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 00:17:25 +00:00
Mikhail Glushenkov
7e6d70a425 Disallow multiple edges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60127 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 22:59:45 +00:00
Devang Patel
da278753c4 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60111 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 18:13:11 +00:00
Mikhail Glushenkov
1f1fab8c91 Fix the -I option (llvmc -I dir1 -I dir2 didn't work).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60101 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 10:57:31 +00:00
Mikhail Glushenkov
8b4c5f5d26 Refactor Tools.td to remove repetition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60100 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 10:56:56 +00:00
Dan Gohman
2ad8245566 LiveRanges are represented as half-open ranges. Fix the findLiveInMBBs code
and the LiveInterval.h top-level comment and accordingly. This fixes blocks
having spurious live-in registers in boundary cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60092 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 05:50:31 +00:00
Ted Kremenek
5984680c1f Add 'tell' method to raw_fd_ostream that clients can use to query the current location in the file the stream is writing to.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60085 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 03:33:13 +00:00
Chris Lattner
c5dd22a333 add a long-overdue AllocaInst::isStaticAlloca method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60080 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 02:54:17 +00:00
Nuno Lopes
08d67c7763 change AnnotationManager to use 'const char*' instead of std::string. this fixes the leakage of those strings and avoids the creation of such strings in static cosntructors (should result in a little improvement of startup time)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60064 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 00:00:44 +00:00