Commit Graph

7093 Commits

Author SHA1 Message Date
Eli Friedman
8c377c7296 Start of refactoring LegalizeDAG so that we don't need specialized
handling for every single opcode.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72447 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-27 01:25:56 +00:00
Jeffrey Yasskin
493a3d015c LiveVariables::VarInfo contains an AliveBlocks BitVector, which has as many
entries as there are basic blocks in the function.  LiveVariables::getVarInfo
creates a VarInfo struct for every register in the function, leading to
quadratic space use.  This patch changes the BitVector to a SparseBitVector,
which doesn't help the worst-case memory use but does reduce the actual use in
very long functions with short-lived variables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72426 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-26 18:27:15 +00:00
Eli Friedman
74807f2520 Delete a bunch of dead code from LegalizeDAG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72414 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-26 08:55:52 +00:00
Evan Cheng
aed4a430f4 Eliminate VarInfo::UsedBlocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72411 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-26 06:25:46 +00:00
Eli Friedman
c046c00d0a Add a comment which should hopefully make the purpose of this method a
bit clearer.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72374 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-24 20:32:10 +00:00
Eli Friedman
57f1a4bc40 Minor improvement to FCOPYSIGN to use BIT_CONVERT in cases where the
corresponding integer type is legal.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72373 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-24 20:29:11 +00:00
Eli Friedman
ed2f8c557a Rewrite ISD::FCOPYSIGN lowering to never use i64. Not really ideal, but
it's late, and I don't have any better ideas at the moment.  Fixes PR4257.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72363 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-24 10:21:20 +00:00
Eli Friedman
7d869fb062 Update for CMakeLists; untested, so tell me if there are issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72360 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-24 09:13:13 +00:00
Eli Friedman
957bffaeca Remove checks of getTypeAction from LegalizeOp; we already assert that
all results and all operands are legal, so this change shouldn't affect 
behavior at all.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72359 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-24 08:42:01 +00:00
Eli Friedman
1fde9c5f77 Disable type legalization in LegalizeDAG.
This leaves around 4000 lines of dead code; I'll clean that up 
in subsequent commits.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72358 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-24 02:46:31 +00:00
Eli Friedman
2a35b1c54b Fix a bug in the expansion of EXTRACT_SUBVECTOR in
ExpandExtractFromVectorThroughStack.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72351 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-23 23:03:28 +00:00
Eli Friedman
3d43b3f6d7 Add a proper implementation of EXTRACT_SUBVECTOR legalization that
doesn't split legal vector operands.  This is necessary because the 
type legalization (and therefore, vector splitting) code will be going 
away soon.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72349 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-23 22:37:25 +00:00
Torok Edwin
6bb4958543 Fix PR4254.
The DAGCombiner created a negative shiftamount, stored in an
unsigned variable. Later the optimizer eliminated the shift entirely as being
undefined.
Example: (srl (shl X, 56) 48). ShiftAmt is 4294967288.
Fix it by checking that the shiftamount is positive, and storing in a signed
variable.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72331 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-23 17:29:48 +00:00
Eli Friedman
5c22c80744 Add a new step to legalization to legalize vector math operations. This
will allow simplifying LegalizeDAG to eliminate type legalization.  (I 
have a patch to do that, but it's not quite finished; I'll commit it 
once it's finished and I've fixed any review comments for this patch.)  
See the comment at the beginning of 
lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp for more details on the
motivation for this patch.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72325 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-23 12:35:30 +00:00
Duncan Sands
b0f1e1780c Add a new codegen pass that normalizes dwarf exception handling
code in preparation for code generation.  The main thing it does
is handle the case when eh.exception calls (and, in a future
patch, eh.selector calls) are far away from landing pads.  Right
now in practice you only find eh.exception calls close to landing
pads: either in a landing pad (the common case) or in a landing
pad successor, due to loop passes shifting them about.  However
future exception handling improvements will result in calls far
from landing pads:
(1) Inlining of rewinds.  Consider the following case:
In function @f:
...
  invoke @g to label %normal unwind label %unwinds
...
unwinds:
  %ex = call i8* @llvm.eh.exception()
...

In function @g:
...
  invoke @something to label %continue unwind label %handler
...
handler:
  %ex = call i8* @llvm.eh.exception()
... perform cleanups ...
  "rethrow exception"

Now inline @g into @f.  Currently this is turned into:
In function @f:
...
  invoke @something to label %continue unwind label %handler
...
handler:
  %ex = call i8* @llvm.eh.exception()
... perform cleanups ...
  invoke "rethrow exception" to label %normal unwind label %unwinds
unwinds:
  %ex = call i8* @llvm.eh.exception()
...

However we would like to simplify invoke of "rethrow exception" into
a branch to the %unwinds label.  Then %unwinds is no longer a landing
pad, and the eh.exception call there is then far away from any landing
pads.

(2) Using the unwind instruction for cleanups.
It would be nice to have codegen handle the following case:
  invoke @something to label %continue unwind label %run_cleanups
...
handler:
... perform cleanups ...
  unwind

This requires turning "unwind" into a library call, which
necessarily takes a pointer to the exception as an argument
(this patch also does this unwind lowering).  But that means
you are using eh.exception again far from a landing pad.

(3) Bugpoint simplifications.  When bugpoint is simplifying
exception handling code it often generates eh.exception calls
far from a landing pad, which then causes codegen to assert.
Bugpoint then latches on to this assertion and loses sight
of the original problem.

Note that it is currently rare for this pass to actually do
anything.  And in fact it normally shouldn't do anything at
all given the code coming out of llvm-gcc!  But it does fire
a few times in the testsuite.  As far as I can see this is
almost always due to the LoopStrengthReduce codegen pass
introducing pointless loop preheader blocks which are landing
pads and only contain a branch to another block.  This other
block contains an eh.exception call.  So probably by tweaking
LoopStrengthReduce a bit this can be avoided.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72276 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-22 20:36:31 +00:00
Jay Foad
e3e51c0038 Use v.data() instead of &v[0] when SmallVector v might be empty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72210 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 09:52:38 +00:00
Bill Wendling
df7d5d3170 Temporarily revert r72191. It was causing an assert during llvm-gcc
bootstrapping.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72200 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 00:04:55 +00:00
Bill Wendling
39dd696282 Minor code cleanup. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72198 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 23:31:45 +00:00
Bill Wendling
1795616930 Merge 'ConstructFunctionDbgScope' and 'ConstructAbstractDbgScope'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72197 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 23:28:48 +00:00
Bill Wendling
995f80ad5f Rename 'New*' methods to 'Create*' to be consistent. 'NewString' isn't used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72196 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 23:24:48 +00:00
Bill Wendling
829e67b5ec Add comment for emit section.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72195 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 23:22:40 +00:00
Bill Wendling
94d04b8f80 Move 'Emit' methods down to their own place.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72194 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 23:21:38 +00:00
Bill Wendling
f0fb987903 Revert r72192. It was causing a build failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72193 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 23:19:06 +00:00
Bill Wendling
63ad10c004 Do some mechanical changes. Combine the 'construct abastract dbg thingy' in with
the 'constract function dbg thingy'. Rename some methods to make them consistent
with the rest of the methods. Move the 'Emit' methods to the end of the file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72192 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 23:04:56 +00:00
Argyrios Kyrtzidis
a3437647dc Introduce DebugScope which gets embedded into the machine instructions' DebugLoc.
DebugScope refers to a debug region, function or block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72191 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 22:57:17 +00:00
Eli Friedman
2ac8b324eb Fix for PR4235: to build a floating-point value from integer parts,
build an integer and cast that to a float.  This fixes a crash 
caused by trying to split an f32 into two f16's.

This changes the behavior in test/CodeGen/XCore/fneg.ll because that 
testcase now triggers a DAGCombine which converts the fneg into an integer
operation.  If someone is interested, it's probably possible to tweak 
the test to generate an actual fneg.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72162 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 06:02:09 +00:00
Bill Wendling
cd35ed5153 Forward decls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72114 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 17:52:31 +00:00
Bill Wendling
0bde89e455 Remove 'class' specifier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72113 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 17:51:26 +00:00
Bill Wendling
7683806ea3 Fix to compile on VS2008.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72112 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 17:50:18 +00:00
Dan Gohman
dea4085da0 Remove the #ifndef NDEBUG from the FastISel debugging options. This
fixes dejagnu tests that use these options.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72094 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 02:19:57 +00:00
Mike Stump
1d4c738603 Fix cmake builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72078 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 00:18:14 +00:00
Bill Wendling
1180c7899c Don't set the "location" information for inlined functions' variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72064 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 23:08:55 +00:00
Bill Wendling
cde5d63d90 Small code cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72057 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 22:33:01 +00:00
Bill Wendling
6679ee4e80 RecordVariable is called each time a DECLARE node is encountered. For an inlined
function, this could be many, many times. We don't want to re-add variables to
that DIE for each time. We just want to add them once. Check to make sure that
we haven't added them already.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72047 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 22:02:36 +00:00
Bob Wilson
8ad05c4bdf Fix CodePlacementOpt::OptimizeIntraLoopEdges so that its return value
correctly indicates whether it changed the code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72038 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 21:02:18 +00:00
Lang Hames
e2b201bac3 New Spiller interface and trivial implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72030 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 19:03:16 +00:00
Bill Wendling
805da894cf Revert last commit. It was wrong.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72026 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 18:21:03 +00:00
Bill Wendling
15ffc08267 Don't call RegionInlinedFnEnd if our optimization level isn't -O0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72024 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 18:17:22 +00:00
Daniel Dunbar
8c562e2d25 Silence Release-Asserts warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72011 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 16:43:04 +00:00
Lang Hames
b0e519f2bf Prevented reg0 from being added to MBB live-in set, which was causing issues
for PostRAScheduler. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71991 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-17 23:50:36 +00:00
Jakob Stoklund Olesen
de67a51b66 Rename MachineVerifier pass to avoid command line collision.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71987 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-17 19:37:14 +00:00
Jakob Stoklund Olesen
44b27e5c75 Verify that explicit definitions in the TargetInstrDesc are matched by
explicit register define operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71933 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-16 07:25:20 +00:00
Jakob Stoklund Olesen
d6fb97761e Allow redefinition of reserved registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71932 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-16 07:24:54 +00:00
Duncan Sands
0394c4fb3d Put back a bit of expensive checking logic that
was overenthusiastically deleted in r70234.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71926 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-16 04:14:29 +00:00
Duncan Sands
e556720ea8 Pacify gcc-4.3, which suggests explicit braces here
to avoid an ambiguous else.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71924 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-16 03:28:54 +00:00
Jakob Stoklund Olesen
48872e0d84 Pass to verify generated machine code.
The following is checked:

* Operand counts: All explicit operands must be present.

* Register classes: All physical and virtual register operands must be
  compatible with the register class required by the instruction descriptor.

* Register live intervals: Registers must be defined only once, and must be
  defined before use.

The machine code verifier is enabled with the command-line option
'-verify-machineinstrs', or by defining the environment variable
LLVM_VERIFY_MACHINEINSTRS to the name of a file that will receive all the
verifier errors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71918 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-16 00:33:53 +00:00
Bill Wendling
0310d768a1 Split out the DwarfDebug module from the DwarfWriter module.
Again, no intendtional functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71854 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-15 09:23:25 +00:00
Bill Wendling
e428e21033 Mark class as hidden.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71850 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-15 06:55:26 +00:00
Evan Cheng
427a6b666b Fix PR4210. Rewritter should track and update kills of sub-registers as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71848 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-15 06:48:19 +00:00
Bill Wendling
bc0d23afae Move c'tor/d'tor to top of file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71828 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-15 01:18:50 +00:00