1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
Commit Graph

8586 Commits

Author SHA1 Message Date
Dan Gohman
d1f2f34c1a Change ConstantFoldConstantExpression to accept a null
TargetData pointer. The only thing it's used for are
calls to ConstantFoldCompareInstOperands and
ConstantFoldInstOperands, which both already accept a
null TargetData pointer. This makes
ConstantFoldConstantExpression easier to use in clients
where TargetData is optional.

llvm-svn: 72741
2009-06-02 21:48:15 +00:00
Dan Gohman
304cdeff4b Delete an unnecessary forward declaration.
llvm-svn: 72740
2009-06-02 21:37:43 +00:00
Torok Edwin
a2f0fd169e fix build on VC++2k8.
llvm-svn: 72736
2009-06-02 20:32:59 +00:00
Devang Patel
a485e31081 Simplify assertion message to avoid confusion.
llvm-svn: 72731
2009-06-02 17:26:29 +00:00
Lang Hames
1a81422fab Update to in-place spilling framework. Includes live interval scaling and trivial rewriter.
llvm-svn: 72729
2009-06-02 16:53:25 +00:00
Dale Johannesen
8b6ee9e312 Revert 72707 and 72709, for the moment.
llvm-svn: 72712
2009-06-02 03:12:52 +00:00
Dale Johannesen
c08669561e Make the implicit inputs and outputs of target-independent
ADDC/ADDE use MVT::i1 (later, whatever it gets legalized to)
instead of MVT::Flag.  Remove CARRY_FALSE in favor of 0; adjust
all target-independent code to use this format.

Most targets will still produce a Flag-setting target-dependent
version when selection is done.  X86 is converted to use i32
instead, which means TableGen needs to produce different code
in xxxGenDAGISel.inc.  This keys off the new supportsHasI1 bit
in xxxInstrInfo, currently set only for X86; in principle this
is temporary and should go away when all other targets have
been converted.  All relevant X86 instruction patterns are
modified to represent setting and using EFLAGS explicitly.  The
same can be done on other targets.

The immediate behavior change is that an ADC/ADD pair are no
longer tightly coupled in the X86 scheduler; they can be
separated by instructions that don't clobber the flags (MOV).
I will soon add some peephole optimizations based on using
other instructions that set the flags to feed into ADC.

llvm-svn: 72707
2009-06-01 23:27:20 +00:00
Mike Stump
f39ed4d4f9 Dcoument that the opauque value used to construct QNaNs is truncated
as necessary.

llvm-svn: 72702
2009-06-01 21:02:35 +00:00
Dan Gohman
76f405a65f Fix the name of the function in this comment.
llvm-svn: 72666
2009-05-31 16:18:03 +00:00
Bruno Cardoso Lopes
aba334e40e Use uint8_t and int32_t in {JIT,Machine}CodeEmiters
llvm-svn: 72650
2009-05-30 23:50:33 +00:00
Bruno Cardoso Lopes
d9c92b3825 Add AMD64 elf machine type
llvm-svn: 72635
2009-05-30 21:05:47 +00:00
Bruno Cardoso Lopes
4da7e7af43 First patch in the direction of splitting MachineCodeEmitter in two subclasses:
JITCodeEmitter and ObjectCodeEmitter. No functional changes yet. Patch by Aaron Gray

llvm-svn: 72631
2009-05-30 20:51:52 +00:00
Mike Stump
72e70811c8 Add some documentation.
llvm-svn: 72622
2009-05-30 15:19:29 +00:00
Nick Lewycky
a9de2f1c81 Give embedded metadata its own type instead of relying on EmptyStructTy.
llvm-svn: 72610
2009-05-30 05:06:04 +00:00
Mike Stump
5447116cbb Add support for letting the client choose different flavors of NaNs. Testcase to be
added in clang.

llvm-svn: 72606
2009-05-30 03:49:43 +00:00
Bill Wendling
d50f27458f Untabify.
llvm-svn: 72603
2009-05-30 00:58:37 +00:00
Evan Cheng
f911a0825b Default isNarrowingProfitable to false.
llvm-svn: 72561
2009-05-29 05:31:40 +00:00
Evan Cheng
40810c4d1b Added optimization that narrow load / op / store and the 'op' is a bit twiddling instruction and its second operand is an immediate. If bits that are touched by 'op' can be done with a narrower instruction, reduce the width of the load and store as well. This happens a lot with bitfield manipulation code.
e.g.
orl     $65536, 8(%rax)
=>
orb     $1, 10(%rax)

Since narrowing is not always a win, e.g. i32 -> i16 is a loss on x86, dag combiner consults with the target before performing the optimization.

llvm-svn: 72507
2009-05-28 00:35:15 +00:00
Jeffrey Yasskin
14f27c22aa 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.

llvm-svn: 72426
2009-05-26 18:27:15 +00:00
Dan Gohman
c1ef7f9059 Give SCEVNaryExpr a doxygen comment.
llvm-svn: 72423
2009-05-26 17:42:32 +00:00
Evan Cheng
28673c9554 Eliminate VarInfo::UsedBlocks.
llvm-svn: 72411
2009-05-26 06:25:46 +00:00
Dan Gohman
621071c6c4 Various comment fixes.
llvm-svn: 72376
2009-05-24 23:45:28 +00:00
Dan Gohman
19be1fa810 Change ScalarEvolution::getSCEVAtScope to always return the original value
in the case where a loop exit value cannot be computed, instead of only in
some cases while using SCEVCouldNotCompute in others. This simplifies
getSCEVAtScope's callers.

llvm-svn: 72375
2009-05-24 23:25:42 +00:00
Dan Gohman
fdba9c8fce Generalize SCEVExpander::visitAddRecExpr's GEP persuit, and avoid
sending SCEVUnknowns to expandAddToGEP. This avoids the need for
expandAddToGEP to bend the rules and peek into SCEVUnknown
expressions.

Factor out the code for testing whether a SCEV can be factored by
a constant for use in a GEP index. This allows it to handle
SCEVAddRecExprs, by recursing.

As a result, SCEVExpander can now put more things in GEP indices,
so it emits fewer explicit mul instructions.

llvm-svn: 72366
2009-05-24 18:06:31 +00:00
Torok Edwin
8936fc2e28 The rewriter may hold references to instructions that are deleted because they are trivially dead.
Fix by clearing the rewriter cache before deleting the trivially dead
instructions.
Also make InsertedExpressions use an AssertingVH to catch these
bugs easier.

llvm-svn: 72364
2009-05-24 14:23:16 +00:00
Anton Korobeynikov
34fc85e2ee Propagate CPU string out of SubtargetFeatures
llvm-svn: 72335
2009-05-23 19:50:50 +00:00
Torok Edwin
beb86bd0b4 available_externall linkage is not local, this was confusing the codegenerator,
and it wasn't generating calls through @PLT for these functions.
hasLocalLinkage() is now false for available_externally,
I attempted to fix the inliner and dce to handle available_externally properly.
It passed make check.

llvm-svn: 72328
2009-05-23 14:06:57 +00:00
Eli Friedman
bd00025eed 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.

llvm-svn: 72325
2009-05-23 12:35:30 +00:00
Duncan Sands
bbd03677ee 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.

llvm-svn: 72276
2009-05-22 20:36:31 +00:00
Daniel Dunbar
aa01cbb890 Add llvm::triple constructor from arch, vendor, os strings, and recognize
DragonFly OS type.

llvm-svn: 72242
2009-05-22 02:24:11 +00:00
Eli Friedman
b32b64b5b4 Fix broken logic in DominatorTreeBase::Split. Part of PR4238.
llvm-svn: 72231
2009-05-21 21:47:54 +00:00
Eli Friedman
36eff96b0f Fix indentation.
llvm-svn: 72227
2009-05-21 21:08:47 +00:00
Jay Foad
c934b656f9 Tighten up the asserts in SmallVector::operator[]().
If this causes any new assertion failures that I didn't catch in
testing, the fix is usually to change "&v[0]" to "v.data()" for some
SmallVector v.

llvm-svn: 72221
2009-05-21 19:48:58 +00:00
Duncan Sands
316352b541 Add a getAlignOf helper for getting the ABI alignment of a
type as a target independent constant expression.  I confess
that I didn't check that this method works as intended (though
I did test the equivalent hand-written IR a little).  But what
could possibly go wrong!

llvm-svn: 72213
2009-05-21 15:52:21 +00:00
Jay Foad
16d48d2595 Use v.data() instead of &v[0] when SmallVector v might be empty.
llvm-svn: 72210
2009-05-21 09:52:38 +00:00
Jay Foad
2ca356aa76 Implement new SmallVector::data() methods.
llvm-svn: 72209
2009-05-21 09:00:37 +00:00
Owen Anderson
81e8ddcfda Use DataTypes.h instead of stdint.h.
llvm-svn: 72201
2009-05-21 00:48:13 +00:00
Bill Wendling
9bca78046b Temporarily revert r72191. It was causing an assert during llvm-gcc
bootstrapping.

llvm-svn: 72200
2009-05-21 00:04:55 +00:00
Argyrios Kyrtzidis
c651293fa0 Introduce DebugScope which gets embedded into the machine instructions' DebugLoc.
DebugScope refers to a debug region, function or block.

llvm-svn: 72191
2009-05-20 22:57:17 +00:00
Dan Gohman
17d7639520 Add an accessor method to return the insertion point.
llvm-svn: 72184
2009-05-20 21:45:41 +00:00
Owen Anderson
4f6709ebd6 Have llvm_start_multithreaded return a bool indicating whether multithreaded
initialization succeeded or not, rather than just asserting.

llvm-svn: 72182
2009-05-20 21:03:06 +00:00
Owen Anderson
2753821fab Move atomic operations' definitions out of line. While this seems kind of silly,
all kinds of problems caused by including windows.h and/or config.h in an LLVM header.

llvm-svn: 72174
2009-05-20 18:26:15 +00:00
Duncan Sands
e42a12bf0c When comparing DominanceFrontier's, advance iterators
before erasing nodes, not after.  Otherwise dom frontier
checking reads from freed memory.

llvm-svn: 72168
2009-05-20 15:12:01 +00:00
Owen Anderson
438c3c3660 Compile fix for MSVC.
llvm-svn: 72167
2009-05-20 09:34:13 +00:00
Owen Anderson
47460293cf Add llvm_start_multithreaded(), which starts up the LLVM internals in thread-safe mode. Provide double-check locking
initialization of ManagedStatic's when running in thread-safe mode.

llvm-svn: 72151
2009-05-20 00:39:20 +00:00
Owen Anderson
d64df37f4c We need to include config.h here so that the #defines are set properly.
llvm-svn: 72148
2009-05-20 00:31:29 +00:00
Owen Anderson
315dc6b65f Forgot this file in my last commit.
llvm-svn: 72141
2009-05-19 22:25:55 +00:00
Owen Anderson
e1474eebee Split the ENABLE_THREADS #define in two. Now ENABLE_THREADS indicates the ability to run multiple threads at once in the JIT, and requires only
mutex support.  LLVM_MULTITHREADED indicates (or will indicate) the ability to run LLVM itself across multiple threads, and requires atomics support.

llvm-svn: 72140
2009-05-19 22:18:56 +00:00
Dan Gohman
be817680b8 Make SCEVCallbackVH a private nested class inside ScalarEvolution, as
it's an implementation detail.

llvm-svn: 72122
2009-05-19 19:22:47 +00:00
Dan Gohman
922033d119 Teach SCEVExpander to expand arithmetic involving pointers into GEP
instructions. It attempts to create high-level multi-operand GEPs,
though in cases where this isn't possible it falls back to casting
the pointer to i8* and emitting a GEP with that. Using GEP instructions
instead of ptrtoint+arithmetic+inttoptr helps pointer analyses that
don't use ScalarEvolution, such as BasicAliasAnalysis.

Also, make the AddrModeMatcher more aggressive in handling GEPs.
Previously it assumed that operand 0 of a GEP would require a register
in almost all cases. It now does extra checking and can do more
matching if operand 0 of the GEP is foldable. This fixes a problem
that was exposed by SCEVExpander using GEPs.

llvm-svn: 72093
2009-05-19 02:15:55 +00:00