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

12003 Commits

Author SHA1 Message Date
Daniel Dunbar
1457d51ff8 Add llvm::sys::RunInterruptHandlers(), which runs the registered SIGINT cleanup
stuff.

llvm-svn: 103333
2010-05-08 02:10:34 +00:00
Devang Patel
14f07a8625 Remove DIGlobal.
llvm-svn: 103325
2010-05-07 23:19:07 +00:00
Devang Patel
62b4a23a3b Add DINameSpace::Verify().
llvm-svn: 103318
2010-05-07 23:04:32 +00:00
Douglas Gregor
2b05a8ffe8 Clang is dying on this with an ambiguous conversion sequence. We're working on it
llvm-svn: 103312
2010-05-07 22:28:25 +00:00
Devang Patel
3c2f4664fc Verify variable directly.
llvm-svn: 103305
2010-05-07 22:04:20 +00:00
Chris Lattner
e72e3e9c12 add COFF support for COMDAT sections, patch by Nathan Jeffords!
llvm-svn: 103304
2010-05-07 21:49:09 +00:00
Kevin Enderby
3807a4746a Fix i386 relocations to Weak Definitions. The relocation entries should be
external and the item to be relocated should not have the address of the
symbol added in.

llvm-svn: 103302
2010-05-07 21:44:23 +00:00
Dale Johannesen
1ee37ac5d4 Fix PR 7087, and probably other things, by extending
getConstantFP to accept the two supported long double
target types.  This was not the original intent, but
there are other places that assume this works and it's
easy enough to do.

llvm-svn: 103299
2010-05-07 21:35:53 +00:00
Devang Patel
0638b539bb Wrap const MDNode * inside DIDescriptor.
llvm-svn: 103295
2010-05-07 20:54:48 +00:00
Devang Patel
af119914f7 remove DIDescriptor::getNode()
llvm-svn: 103278
2010-05-07 18:36:34 +00:00
Devang Patel
02bb578ffd Avoid DIDescriptor::getNode(). Use overloaded operators instead.
llvm-svn: 103272
2010-05-07 18:11:54 +00:00
Chris Lattner
c1d0e3a79e switch MCSectionCOFF from a syntactic to semantic representation,
patch by Peter Housel!

llvm-svn: 103267
2010-05-07 17:17:41 +00:00
Dan Gohman
38fe30a595 Add a simple module-level debug info printer. It just sets up a
DebugInfoFinder and iterates over all the contents calling print.

llvm-svn: 103262
2010-05-07 16:22:32 +00:00
Dan Gohman
1512bd9998 Add an LLVM IR version of code sinking. This uses the same simple algorithm
as MachineSink, but it isn't constrained by MachineInstr-level details.

llvm-svn: 103257
2010-05-07 15:40:13 +00:00
Dan Gohman
6201059ec3 Const-ify some stuff.
llvm-svn: 103256
2010-05-07 15:36:10 +00:00
Dan Gohman
612fbfa641 Convert the DebugInfo classes dump() methods into print(raw_ostream &)
methods, and add dump functions implemented in terms of the print.

llvm-svn: 103254
2010-05-07 15:30:29 +00:00
Dan Gohman
497e752655 Add a DebugLoc argument to TargetInstrInfo::copyRegToReg, so that it
doesn't have to guess.

llvm-svn: 103194
2010-05-06 20:33:48 +00:00
Evan Cheng
80f3051bb7 Add argument TargetRegisterInfo to loadRegFromStackSlot and storeRegToStackSlot.
llvm-svn: 103193
2010-05-06 19:06:44 +00:00
Bob Wilson
8d0b53dc62 Fix handling of unreachable blocks in the SSAUpdater. The previous code only
handled cases where a block had zero predecessors, but failed to detect other
cases like loops with no entries.  The SSAUpdater is already doing a forward
traversal through the blocks, so it is not hard to identify the blocks that
were never reached on that traversal.  This fixes the crash for ppc on the
stepanov_vector test.

llvm-svn: 103184
2010-05-06 16:24:11 +00:00
Dan Gohman
180422793f Add an "IsBottomUp" member function to FastISel, which will be used to
support a new bottom-up mode.

llvm-svn: 103138
2010-05-05 23:58:35 +00:00
Daniel Dunbar
258ede3795 MC: Make setVariableValue check the redefinition condition a bit more strongly.
llvm-svn: 103110
2010-05-05 19:00:56 +00:00
Evan Cheng
d7bc27a079 Move REG_SEQUENCE removal to 2addr pass.
llvm-svn: 103109
2010-05-05 18:45:40 +00:00
Chris Lattner
b9f858943a Implement rdar://7415680 - Twine integer support lacks greatness
Microoptimize Twine's with unsigned and int to not pin their value to
the stack.  This saves stack space in common cases and allows mem2reg
in the caller.  A simple example is:

void foo(const Twine &);
void bar(int x) {
  foo("xyz: " + Twine(x));
}

Before:

__Z3bari:
	subq	$40, %rsp
	movl	%edi, 36(%rsp)
	leaq	L_.str3(%rip), %rax
	leaq	36(%rsp), %rcx
	leaq	8(%rsp), %rdi
	movq	%rax, 8(%rsp)
	movq	%rcx, 16(%rsp)
	movb	$3, 24(%rsp)
	movb	$7, 25(%rsp)
	callq	__Z3fooRKN4llvm5TwineE
	addq	$40, %rsp
	ret

After:

__Z3bari:
	subq	$24, %rsp
	leaq	L_.str3(%rip), %rax
	movq	%rax, (%rsp)
	movslq	%edi, %rax
	movq	%rax, 8(%rsp)
	movb	$3, 16(%rsp)
	movb	$7, 17(%rsp)
	leaq	(%rsp), %rdi
	callq	__Z3fooRKN4llvm5TwineE
	addq	$24, %rsp
	ret

It saves 16 bytes of stack and one instruction in this case.

llvm-svn: 103107
2010-05-05 18:40:33 +00:00
Evan Cheng
25c07ac593 Teach liveintervalanalysis about virtual registers which are defined by reg_sequence instructions that are formed by registers defined by distinct instructions. e.g.
80      %reg1041:6<def> = VSHRNv4i16 %reg1034<kill>, 12, pred:14, pred:%reg0
. . .
120     %reg1041:5<def> = VSHRNv4i16 %reg1039<kill>, 12, pred:14, pred:%reg0

llvm-svn: 103102
2010-05-05 18:27:40 +00:00
Daniel Dunbar
d2ac9dc48b MC: Rename MCSymbol::{g,s}etValue -> MCSymbol::{g,s}etVariableValue.
llvm-svn: 103095
2010-05-05 17:41:00 +00:00
Daniel Dunbar
f5dc70a7d1 MC/Mach-O/x86_64: Relocations in debug sections should use local relocations
when possible.
 - <rdar://problem/7934873>

llvm-svn: 103092
2010-05-05 17:22:39 +00:00
Bob Wilson
e81252b747 Combine the implementations of the core part of the SSAUpdater and
MachineSSAUpdater to avoid duplicating all the code.

llvm-svn: 103060
2010-05-04 23:18:19 +00:00
Daniel Dunbar
711d2427dd MC/Matcher: Add support for over-riding the default MatchInstruction function
name (for example, to allow targets to interpose the actual MatchInstruction
function).

llvm-svn: 102987
2010-05-04 00:33:13 +00:00
Dan Gohman
8bfd5f99b5 Factor out FastISel's code for materializing constants and other values
in registers into a separate function to de-couple it from the
top-down-specific logic in getRegForValue.

llvm-svn: 102975
2010-05-03 23:36:34 +00:00
Duncan Sands
153ad3b903 Remove the -enable-sjlj-eh option, which doesn't do anything.
Remove the -enable-eh option which is only used by the JIT,
and replace it with -jit-enable-eh.

llvm-svn: 102865
2010-05-02 15:36:26 +00:00
David Chisnall
52a91e993b Added a variant of InlineCostAnalyzer::getInlineCost() that takes the called function as an explicit argument, for use when inlining function pointers.
llvm-svn: 102841
2010-05-01 15:47:41 +00:00
Chris Lattner
66d1a6ad69 rename InlineInfo.DevirtualizedCalls -> InlinedCalls to
reflect that it includes all inlined calls now, not just
devirtualized ones.

llvm-svn: 102824
2010-05-01 01:26:13 +00:00
Evan Cheng
8bd004b033 Add a pseudo instruction REG_SEQUENCE that takes a list of registers and
sub-register indices and outputs a single super register which is formed from
a consecutive sequence of registers.

This is used as register allocation / coalescing aid and it is useful to
represent instructions that output register pairs / quads. For example,
v1024, v1025 = vload <address>
where v1024 and v1025 forms a register pair.

This really should be modelled as
v1024<3>, v1025<4> = vload <address>
but it would violate SSA property before register allocation is done.

Currently we use insert_subreg to form the super register:
v1026 = implicit_def
v1027 - insert_subreg v1026, v1024, 3
v1028 = insert_subreg v1027, v1025, 4
...
      = use v1024
      = use v1028

But this adds pseudo live interval overlap between v1024 and v1025.

We can now modeled it as
v1024, v1025 = vload <address>
v1026 = REG_SEQUENCE v1024, 3, v1025, 4
...
      = use v1024
      = use v1026

After coalescing, it will be
v1026<3>, v1025<4> = vload <address>
...
      = use v1026<3>
      = use v1026

llvm-svn: 102815
2010-05-01 00:28:44 +00:00
Dan Gohman
68f04d06c8 Get rid of the EdgeMapping map. Instead, just check for BasicBlock
changes before doing phi lowering for switches.

llvm-svn: 102809
2010-05-01 00:01:06 +00:00
Dan Gohman
73722062f7 Update BitVectorTest.cpp to stay in sync with SmallBitVectorTest.cpp,
and fix a bug in BitVector's reference proxy class which this exposed.

llvm-svn: 102768
2010-04-30 20:50:28 +00:00
Devang Patel
52c2d4d378 Attach AT_APPLE_optimized attribute to optimized function's debug info.
llvm-svn: 102743
2010-04-30 19:38:23 +00:00
Dan Gohman
cfd0d9393a Add some comments.
llvm-svn: 102731
2010-04-30 18:33:41 +00:00
Dan Gohman
a5ef1ab165 Properly escape edge source and destination labels.
llvm-svn: 102728
2010-04-30 18:27:57 +00:00
Benjamin Kramer
f3e9546fc1 SmallBitVector: Rework find_first/find_next and tweak test to test them (at least on 64 bit platforms).
llvm-svn: 102712
2010-04-30 13:40:27 +00:00
Benjamin Kramer
e4ebf09068 Implement a read/write operator[] for SmallBitVector with a proxy class.
llvm-svn: 102709
2010-04-30 12:29:39 +00:00
Benjamin Kramer
e59c44ea79 Make sure SmallBitVector actually uses the small case and fix latent bugs.
- We can't use PointerIntPair here since we require the discrimination bit to be in the LSB.

llvm-svn: 102707
2010-04-30 11:34:01 +00:00
Chris Lattner
105e312fb4 add some more (void)'s to prototypes for PR6961
llvm-svn: 102667
2010-04-29 23:27:32 +00:00
Devang Patel
432efd232d Missed earlier. This is part of previous check-in. (r102661 - refactor.)
llvm-svn: 102662
2010-04-29 20:48:12 +00:00
Evan Cheng
f0f25bd8e6 Add DenseMapInfo for int.
llvm-svn: 102652
2010-04-29 18:50:35 +00:00
Dan Gohman
78c9ada867 Elaborate on a comment.
llvm-svn: 102637
2010-04-29 16:57:54 +00:00
Duncan Sands
c83ef78bd3 Fix comment typo.
llvm-svn: 102612
2010-04-29 12:32:45 +00:00
Torok Edwin
9ddbae859f Fix PR6910.
Limit alignment in SmallVector 8, otherwise GCC assumes 16 byte alignment.
opetaror new, and malloc only return 8-byte aligned memory on 32-bit Linux,
which cause a crash if code is compiled with -O3 (or -ftree-vectorize) and some
SmallVector code is vectorized.

llvm-svn: 102604
2010-04-29 06:43:12 +00:00
Nick Lewycky
2b713db8ed Fix typo.
llvm-svn: 102599
2010-04-29 05:54:29 +00:00
Mon P Wang
bfebbd889a Add support for assemblers that don't support periods in a name
llvm-svn: 102594
2010-04-29 04:00:56 +00:00
Evan Cheng
6764226f8c Frame index can be negative.
llvm-svn: 102577
2010-04-29 01:13:30 +00:00
Evan Cheng
a02c9072fc Replace r102368 with code that's less fragile. This creates DBG_VALUE instructions for function arguments early and insert them after instruction selection is done.
llvm-svn: 102554
2010-04-28 23:08:54 +00:00
Chris Lattner
e9c0d1574a declare targets with (void) instead of () since this is a C header.
Patch by Lars R in PR6961.

llvm-svn: 102523
2010-04-28 20:24:45 +00:00
Chris Lattner
9867c1a075 Rework global alignment computation again. Now we do round up
alignment of globals to the preferred alignment, but only when
there is no section specified on the global (by far the common
case).

llvm-svn: 102515
2010-04-28 19:58:07 +00:00
Devang Patel
570e9d53a7 Emit debug info for byval parameters.
llvm-svn: 102486
2010-04-28 01:39:28 +00:00
Chris Lattner
19715b76b7 further simplify EmitAlignment by eliminating the
ForcedAlignBits argument, tweaking the single client of it.

llvm-svn: 102484
2010-04-28 01:08:40 +00:00
Chris Lattner
d14f04d0f7 remove a dead argument to EmitAlignment.
llvm-svn: 102483
2010-04-28 01:06:02 +00:00
Chris Lattner
2ceb31a172 Fix a problem that lower invoke has with allocas (PR6694), and
add a version of createLowerInvokePass that allows the client
to specify whether it wants "expensive" or "cheap" lowering.

Patch by Alex Mac!

llvm-svn: 102402
2010-04-26 23:49:32 +00:00
Chris Lattner
9292bad5f5 on darwin empty functions need to codegen into something of non-zero length,
otherwise labels get incorrectly merged.  We handled this by emitting a 
".byte 0", but this isn't correct on thumb/arm targets where the text segment
needs to be a multiple of 2/4 bytes.  Handle this by emitting a noop.  This
is more gross than it should be because arm/ppc are not fully mc'ized yet.

This fixes rdar://7908505

llvm-svn: 102400
2010-04-26 23:37:21 +00:00
Dale Johannesen
4327f03110 Add DBG_VALUE handling for byval parameters; this
produces a comment on targets that support it, but
the Dwarf writer is not hooked up yet.

llvm-svn: 102372
2010-04-26 20:06:49 +00:00
Dale Johannesen
c4d2156a7c Add PPC AsmPrinter handling for target-specific form of
DBG_VALUE, and a cautionary comment.

llvm-svn: 102371
2010-04-26 20:05:01 +00:00
Bob Wilson
01b2bccb00 Update MachineSSAUpdater with the same changes I made for the IR-level
SSAUpdater.  I'm going to try to refactor this to share most of the code
between them.

llvm-svn: 102353
2010-04-26 17:40:49 +00:00
Evan Cheng
dc0ce1eae8 - Move TargetLowering::EmitTargetCodeForFrameDebugValue to TargetInstrInfo and rename it to emitFrameIndexDebugValue.
- Teach spiller to modify DBG_VALUE instructions to reference spill slots.

llvm-svn: 102323
2010-04-26 07:38:55 +00:00
Dale Johannesen
d27eedab6d Stop abusing EmitInstrWithCustomInserter for target-dependent
form of DEBUG_VALUE, as it doesn't have reasonable default
behavior for unsupported targets.  Add a new hook instead.
No functional change.

llvm-svn: 102320
2010-04-25 21:33:54 +00:00
Dan Gohman
0fbfae5efe Add a new utility function SimplifyICmpOperands. Much of this code is
refactored out of ScalarEvolution::isImpliedCond, which will be updated
to use this new utility routine soon.

llvm-svn: 102229
2010-04-24 01:28:42 +00:00
Chris Lattner
a61306d68f switch InlineInfo.DevirtualizedCalls's list to be of WeakVH.
This fixes a bug where calls inlined into an invoke would get
changed into an invoke but the array would keep pointing to
the (now dead) call.  The improved inliner behavior is still
disabled for now.

llvm-svn: 102196
2010-04-23 18:37:01 +00:00
Dan Gohman
6680b97d89 Move FastISel's HandlePHINodesInSuccessorBlocks call down into FastISel
itself too.

llvm-svn: 102176
2010-04-23 15:29:50 +00:00
Chris Lattner
5d87e1be44 The inliner was choosing to not consider call sites
that appear in the SCC as a result of inlining as candidates
for inlining.  Change this so that it *does* consider call 
sites that change from being indirect to being direct as a
result of inlining.  This allows it to completely 
"devirtualize" the testcase.

llvm-svn: 102146
2010-04-22 23:37:35 +00:00
Chris Lattner
5edbd34cff refactor the interface to InlineFunction so that most of the in/out
arguments are handled with a new InlineFunctionInfo class.  This 
makes it easier to extend InlineFunction to return more info in the
future.

llvm-svn: 102137
2010-04-22 23:07:58 +00:00
Dan Gohman
d819e7fc95 Move HandlePHINodesInSuccessorBlocks functions out of SelectionDAGISel
and into SelectionDAGBuilder and FastISel.

llvm-svn: 102123
2010-04-22 20:46:50 +00:00
Chris Lattner
6adbb41d8c fix file header.
llvm-svn: 102049
2010-04-22 05:33:15 +00:00
Jakob Stoklund Olesen
8cf10fe9e4 Add fast register allocator, enabled with -regalloc=fast.
So far this is just a clone of -regalloc=local that has been lobotomized to run
25% faster. It drops the least-recently-used calculations, and is just plain
stupid when it runs out of registers.

The plan is to make this go even faster for -O0 by taking advantage of the short
live intervals in unoptimized code. It should not be necessary to calculate
liveness when most virtual registers are killed 2-3 instructions after they are
born.

llvm-svn: 102006
2010-04-21 18:02:42 +00:00
Evan Cheng
dbfb7dc438 Implement -disable-non-leaf-fp-elim which disable frame pointer elimination
optimization for non-leaf functions. This will be hooked up to gcc's
-momit-leaf-frame-pointer option. rdar://7886181

llvm-svn: 101984
2010-04-21 03:18:23 +00:00
Dan Gohman
4ff2d817a3 Add more const qualifiers on TargetMachine and friends.
llvm-svn: 101977
2010-04-21 01:34:56 +00:00
Dan Gohman
1d3532d925 Move several SelectionDAG-independent utility functions out of the
SelectionDAG directory and into a new Analysis.cpp file.

llvm-svn: 101975
2010-04-21 01:22:34 +00:00
Evan Cheng
a0c4b2952f - Clean up some crappy code which deals with coalescing of copies which look at
extract_subreg / insert_subreg, etc.
- Add support for more aggressive insert_subreg coalescing.

llvm-svn: 101971
2010-04-21 00:44:22 +00:00
Dale Johannesen
510282d54b Because of the EMMS problem, right now we have to support
user-defined operations that use MMX register types, but
the compiler shouldn't generate them on its own.  This adds
a Synthesizable abstraction to represent this, and changes
the vector widening computation so it won't produce MMX types.
(The motivation is to remove noise from the ABI compatibility
part of the gcc test suite, which has some breakage right now.)

llvm-svn: 101951
2010-04-20 22:34:09 +00:00
Devang Patel
788913a131 There is no need to install ValueMapper.h header.
llvm-svn: 101949
2010-04-20 22:18:31 +00:00
Dan Gohman
f0490a0b8e Document that TargetRegisterInfo::contains does not cover virtual registers.
llvm-svn: 101903
2010-04-20 14:51:20 +00:00
Chris Lattner
b6b95141ec move some select simplifications out out instcombine into
inst simplify.  No functionality change.

llvm-svn: 101873
2010-04-20 05:32:14 +00:00
Eric Christopher
53e7e0fcfb Remove the palignr intrinsics now that we lower them to vector shuffles,
shifts and null vectors. Autoupgrade these to what we'd lower them to.

Add a testcase to exercise this.

llvm-svn: 101851
2010-04-20 00:59:54 +00:00
Dan Gohman
e8387b1250 Sink DebugLoc handling out of SelectionDAGISel into FastISel and
SelectionDAGBuilder, where it doesn't have to be as complicated.

llvm-svn: 101848
2010-04-20 00:48:35 +00:00
Chris Lattner
2f4001f3a8 make CallGraphNode dtor abort if a node is deleted when there are still
references to it.

llvm-svn: 101847
2010-04-20 00:47:34 +00:00
Dan Gohman
c64745ba43 Remove MachineFunction's DefaultDebugLoc member, and make DwarfDebug.cpp
responsible for figuring out what that's supposed to be on its own.

llvm-svn: 101844
2010-04-20 00:37:27 +00:00
Dan Gohman
1d05054dc1 Reapply the removal of SelectionDAGISel's BB, with a fix for the case
where multiple blocks are emitted; functions which do this need to return
the new BB so that their callers can stay current.

llvm-svn: 101843
2010-04-20 00:29:35 +00:00
Dan Gohman
744e2b34b0 Revert 101825, which is causing trouble.
llvm-svn: 101832
2010-04-19 23:34:15 +00:00
Dan Gohman
94383f9d34 Eliminate SelectionDAGISel's "current block" member. Just pass it as
an argument to things that need it.

llvm-svn: 101825
2010-04-19 22:51:14 +00:00
Dan Gohman
e52396cb52 Remove the Expr member from IVUsers. Instead of remembering the expression,
just ask ScalarEvolution for it on demand. This helps IVUsers be more robust
in the case of expressions changing underneath it. This fixes PR6862.

llvm-svn: 101819
2010-04-19 21:48:58 +00:00
Dan Gohman
6bcd9dabb7 Give SelectionDAG a TargetMachine too, rather than having it
fetch one from the MachineFunction.

llvm-svn: 101807
2010-04-19 19:22:07 +00:00
Devang Patel
06123c1012 Add DW_AT_APPLE_omit_frame_ptr to encode -fomit-frame-pointer flag.
llvm-svn: 101805
2010-04-19 19:14:02 +00:00
Dan Gohman
f1f21fb3c6 Code that needs a TargetMachine should have access to one directly, rather
than just getting one through a TargetLowering.

llvm-svn: 101802
2010-04-19 19:05:59 +00:00
Benjamin Kramer
96b4f6c003 Don't write into MemoryBuffers.
llvm-svn: 101783
2010-04-19 16:15:31 +00:00
Dan Gohman
5719bd77e2 Add a few more ELF bits.
llvm-svn: 101778
2010-04-19 15:40:15 +00:00
Dan Gohman
26719acdb7 Add a const.
llvm-svn: 101777
2010-04-19 15:39:27 +00:00
Dan Gohman
f4e99e3f84 These functions don't need to access this.
llvm-svn: 101776
2010-04-19 15:38:38 +00:00
Anton Korobeynikov
e325c693a5 Make processor FUs unique for given itinerary. This extends the limit of 32
FU per CPU arch to 32 per intinerary allowing precise modelling of quite
complex pipelines in the future.

llvm-svn: 101754
2010-04-18 20:31:01 +00:00
Bill Wendling
9218175b5f Add a "PadTo" field to the emitULEB128Bytes method. This will pad out to the
indicated number of bytes.

llvm-svn: 101684
2010-04-18 00:51:49 +00:00
Dale Johannesen
f044ed7cf9 Add comment (lost when reverting and reapplying 101503).
llvm-svn: 101664
2010-04-17 19:56:46 +00:00
Chris Lattner
65d1e40895 teach the x86 asm parser how to handle segment prefixes
in memory operands.  rdar://7874844

llvm-svn: 101661
2010-04-17 18:56:34 +00:00
Chris Lattner
a5798151a3 refactor .if handling code a bit.
llvm-svn: 101659
2010-04-17 18:14:27 +00:00
Dan Gohman
3dde4fe35f Add const qualifiers to TargetLoweringObjectFile usage.
llvm-svn: 101640
2010-04-17 16:44:48 +00:00
Dan Gohman
a0f855157e Use const qualifiers with TargetLowering. This eliminates several
const_casts, and it reinforces the design of the Target classes being
immutable.

SelectionDAGISel::IsLegalToFold is now a static member function, because
PIC16 uses it in an unconventional way. There is more room for API
cleanup here.

And PIC16's AsmPrinter no longer uses TargetLowering.

llvm-svn: 101635
2010-04-17 15:26:15 +00:00
Chris Lattner
bef627e798 reenable r101565, removing a problematic assertion.
CGSCC can delete nodes in regions of the callgraph that
have already been visited.  If new CG nodes are allocated
to the same pointer, we shouldn't abort, just handle it
correctly by assigning a new number.  This should restore
stability by removing invalidated pointers that *will* be
reused from the densemap in the iterator.

llvm-svn: 101628
2010-04-17 07:17:19 +00:00
Evan Cheng
6442d111dd More work to allow dag combiner to promote 16-bit ops to 32-bit.
llvm-svn: 101621
2010-04-17 06:13:15 +00:00
Bob Wilson
ad00f21093 Re-commit my previous SSAUpdater changes. The previous version naively tried
to determine where to place PHIs by iteratively comparing reaching definitions
at each block.  That was just plain wrong.  This version now computes the
dominator tree within the subset of the CFG where PHIs may need to be placed,
and then places the PHIs in the iterated dominance frontier of each definition.
The rest of the patch is mostly the same, with a few more performance
improvements added in.

llvm-svn: 101612
2010-04-17 03:08:24 +00:00
Dale Johannesen
9968eef300 Reapply 101503+101520. These are "obviously correct" [Chris]
and don't cause any problems on Darwin.

llvm-svn: 101584
2010-04-17 00:08:21 +00:00
Eric Christopher
e78496e5f1 Revert 101465, it broke internal OpenGL testing.
Probably the best way to know that all getOperand() calls have been handled
is to replace that API instead of updating.

llvm-svn: 101579
2010-04-16 23:37:20 +00:00
Devang Patel
1929d78e71 Add support to emit dwarf ranges.
llvm-svn: 101575
2010-04-16 23:33:45 +00:00
Dan Gohman
b03b56ff82 Add a getSelectionDAGInfo member to TargetMachine.
llvm-svn: 101567
2010-04-16 23:09:10 +00:00
Chris Lattner
d28dcb3ffe building on the new CallGraphSCC abstraction, teach CallGraphSCCPassManager
to keep the node entries in scc_iterator up to date instead of dangling as
the SCC mutates.

This is a really terrible problem which was causing -g to affect codegen 
because it would permute the memory image of the compiler process.

Thanks to Dale for expertly hunting it down.

llvm-svn: 101565
2010-04-16 23:04:30 +00:00
Chris Lattner
a9a7c28cd2 move ReplaceNode out of line, rename scc_iterator::fini -> isAtEnd().
No functionality change.

llvm-svn: 101562
2010-04-16 22:59:24 +00:00
Chris Lattner
6a038be777 introduce a new CallGraphSCC class, and pass it around
to CallGraphSCCPass's instead of passing around a
std::vector<CallGraphNode*>.  No functionality change,
but now we have a much tidier interface.

llvm-svn: 101558
2010-04-16 22:42:17 +00:00
Chris Lattner
7e6e8651b7 tidy up
llvm-svn: 101548
2010-04-16 21:57:10 +00:00
Dan Gohman
b3afc2a215 Create a new TargetSelectionDAGInfo class. This will eventually acquire
SelectionDAG-specific parts of TargetLowering.

llvm-svn: 101537
2010-04-16 21:12:11 +00:00
Dan Gohman
1119e6060b Eliminate an unnecessary SelectionDAG dependency in getOptimalMemOpType.
llvm-svn: 101531
2010-04-16 20:11:05 +00:00
Dan Gohman
56bc819d8e Fix this code to avoid implicit assumptions about the length of the array.
llvm-svn: 101530
2010-04-16 20:08:45 +00:00
Dan Gohman
2520b6e199 Revert 101520, which depended on 101503, which was reverted.
llvm-svn: 101528
2010-04-16 19:36:41 +00:00
Duncan Sands
7fa5f38be8 Revert commit 101503 (johannes), in the hope of fixing the dragonegg build,
see http://google1.osuosl.org:8011/builders/dragonegg-x86_64-linux/builds/693
Original commit text:
Use a ValueMap not a std::map for the reason indicated
in the comment.  This was causing nondeterministic changes
in inlining decisions.

llvm-svn: 101525
2010-04-16 19:28:59 +00:00
Dan Gohman
5d99e7df1c Trim a #include.
llvm-svn: 101520
2010-04-16 18:45:11 +00:00
Dale Johannesen
759091323b Use a ValueMap not a std::map for the reason indicated
in the comment.  This was causing nondeterministic changes
in inlining decisions.

llvm-svn: 101503
2010-04-16 18:16:08 +00:00
Gabor Greif
e7d6812008 reapply r101434
with a fix for self-hosting

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary

llvm-svn: 101465
2010-04-16 15:33:14 +00:00
Dan Gohman
f754ff8ee9 Make callIsSmall accessible as a utility function.
llvm-svn: 101463
2010-04-16 15:14:50 +00:00
Bill Wendling
7ede9396f4 The JIT calls TidyLandingPads to tidy up the landing pads. However, because the
JIT doesn't use the MC back-end asm printer to emit labels that it uses, the
section for the MCSymbol is never set. And thus the MCSymbol for the EH label
isn't marked as "defined". Because of that, TidyLandingPads removes the needed
landing pads from the JIT output. This breaks EH for every JIT program.

This is a work-around for this limitation. We pass in the label locations
map. If the label has a non-zero value, then it was "emitted" by the JIT and
TidyLandingPads shouldn't remove that label.

A nicer solution would be to mark the MCSymbol as "used" by the JIT and not rely
upon the section being set to determine if it's defined or not.

llvm-svn: 101453
2010-04-16 08:46:10 +00:00
Evan Cheng
d143bfe0a4 Adding support for dag combiner to promote operations for profit. This requires target specific queries. For example, x86 should promote i16 to i32 when it does not impact load folding.
x86 support is off by default. It can be enabled with -promote-16bit.

Work in progress.

llvm-svn: 101448
2010-04-16 06:14:10 +00:00
Eric Christopher
033524af28 Add a check for posix_spawn.
Regenerate configure and other autoconf files.

llvm-svn: 101444
2010-04-16 05:14:21 +00:00
Gabor Greif
cd116e8c6a back out r101423 and r101397, they break llvm-gcc self-host on darwin10
llvm-svn: 101434
2010-04-16 01:16:20 +00:00
Gabor Greif
2e18d34d80 reapply r101364, which has been backed out in r101368
with a fix

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary

llvm-svn: 101397
2010-04-15 20:51:13 +00:00
Dan Gohman
034c0f7354 Make getPredecessorWithUniqueSuccessorForBB return the unique successor
in addition to the predecessor.

llvm-svn: 101374
2010-04-15 16:19:08 +00:00
Gabor Greif
6022150477 back out r101364, as it trips the linux nightlybot on some clang C++ tests
llvm-svn: 101368
2010-04-15 12:46:56 +00:00
Gabor Greif
428ca23bbd rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary

llvm-svn: 101364
2010-04-15 10:49:53 +00:00
Dan Gohman
64a84ceb3f Add more const qualifiers for LLVM IR pointers in CodeGen.
llvm-svn: 101342
2010-04-15 04:33:49 +00:00
Dan Gohman
0e0b8cf9fd Add const qualifiers to CodeGen's use of LLVM IR constructs.
llvm-svn: 101334
2010-04-15 01:51:59 +00:00
Dan Gohman
d9d73a414c Fix TrackingVH to handle const Value subclasses.
llvm-svn: 101300
2010-04-14 22:24:25 +00:00
Dan Gohman
a5a1f2f8d0 Remove a const here. This makes this function consistent with all the
other getOperand wrappers, and it makes it easier to use with DebugInfo
code, which isn't currently prepared to see const MDNode *.

llvm-svn: 101299
2010-04-14 22:23:05 +00:00
Dan Gohman
5c72d507d7 Constify GetConstantStringInfo.
llvm-svn: 101298
2010-04-14 22:20:45 +00:00
Dan Gohman
2c2f455dfa Move a bunch of methods from CallSite to CallSiteBase, so that they can
be used in ImmutableCallSite too.

llvm-svn: 101292
2010-04-14 21:47:32 +00:00
Dan Gohman
16ea461eb9 Use FunTy instead of hard-coding Function.
llvm-svn: 101283
2010-04-14 20:49:44 +00:00
Dan Gohman
94f168ddbe Oops, make these public.
llvm-svn: 101280
2010-04-14 20:31:28 +00:00
Dan Gohman
eeaee6bbe3 Move getType() and getCaller() into CallSiteBase so that
ImmutableCallSite can use them too.

llvm-svn: 101279
2010-04-14 20:28:44 +00:00
Dan Gohman
1b67547226 Delete unneeeded arguments.
llvm-svn: 101276
2010-04-14 20:17:22 +00:00
Dan Gohman
d5d199da5f Delete unused arguments.
llvm-svn: 101275
2010-04-14 20:05:00 +00:00
Dan Gohman
c64d1d02a3 Factor out EH landing pad code into a separate function, and constify
a bunch of stuff to support it.

llvm-svn: 101273
2010-04-14 19:53:31 +00:00
Dan Gohman
9ed196804f Fix a missing #include.
llvm-svn: 101270
2010-04-14 18:57:18 +00:00
Dan Gohman
2d61a3f384 Refine #includes.
llvm-svn: 101269
2010-04-14 18:49:17 +00:00
Dan Gohman
d7fc9e258b Split ISD::NodeType and a few related items out of SelectionDAGNodes.h
into a separate header to allow clients to use them without pulling in
SelectionDAG-specific declarations.

llvm-svn: 101268
2010-04-14 18:44:34 +00:00
Dan Gohman
4fd4153d52 Delete an unused function.
llvm-svn: 101263
2010-04-14 17:22:02 +00:00
Dan Gohman
a1656764cc Trim #includes.
llvm-svn: 101255
2010-04-14 16:54:39 +00:00
Dan Gohman
2c09c272ff Move the code for emitting livein copies out of SelectionDAGISel.
llvm-svn: 101254
2010-04-14 16:51:49 +00:00
Dan Gohman
d044ebe427 Fix whitespace, comments.
llvm-svn: 101247
2010-04-14 15:59:02 +00:00
Dan Gohman
b1dc3b2278 Add explicit keywords.
llvm-svn: 101246
2010-04-14 15:50:02 +00:00
Dan Gohman
17f6c8fd41 Use C++, not C++-standard-library-internals-ese.
llvm-svn: 101245
2010-04-14 15:41:50 +00:00
Dan Gohman
ff3522de68 Make SuccIterator's private parts private too.
llvm-svn: 101244
2010-04-14 15:38:15 +00:00
Dan Gohman
c9fee63fce Make helper utility members private.
llvm-svn: 101243
2010-04-14 15:33:04 +00:00
Chris Lattner
124dc743bc implement mc asmparser support for '.', which gets the
current PC.  rdar://7834775

We now produce an identical .o file compared to the cctools
assembler for something like this:

_f0:
L0:
        jmp L1
        .long . - L0
L1:
        jmp A
        .long . - L1

        .zerofill __DATA,_bss,A,0

llvm-svn: 101227
2010-04-14 04:40:28 +00:00
Daniel Dunbar
d3c1f99fa1 Fix -Asserts warnings.
llvm-svn: 101191
2010-04-13 23:34:11 +00:00
Sean Callanan
b76f351c0b Quick fix for build errors caused by undefined
NULL.

llvm-svn: 101180
2010-04-13 21:36:35 +00:00
Sean Callanan
29a7152676 Fixed a nasty layering violation in the edis source
code.  It used to #include the enhanced disassembly
information for the targets it supported straight
out of lib/Target/{X86,ARM,...} but now it uses a
new interface provided by MCDisassembler, and (so
far) implemented by X86 and ARM.

Also removed hacky #define-controlled initialization
of targets in edis.  If clients only want edis to
initialize a limited set of targets, they can set
--enable-targets on the configure command line.

llvm-svn: 101179
2010-04-13 21:21:57 +00:00
Dan Gohman
2bca857d78 Eliminate MachineBasicBlock::const_livein_iterator and make
MachineBasicBlock::livein_iterator a const_iterator, because
clients shouldn't ever be using the iterator interface to
mutate the livein set.

llvm-svn: 101147
2010-04-13 16:57:55 +00:00
Dan Gohman
22f72726f3 Move MachineRegisterInfo's isLiveIn and isLiveOut out of line.
llvm-svn: 101145
2010-04-13 16:55:37 +00:00
Dan Gohman
9652ec03e5 Delete an unused member variable.
llvm-svn: 101143
2010-04-13 16:51:39 +00:00
Owen Anderson
73c74b3153 SCCVN, we hardly knew ye!
llvm-svn: 101117
2010-04-13 05:24:08 +00:00
Daniel Dunbar
6f0c74d0b4 VMCore: Add Type::getIntN[Ptr]Ty, which are the obvious generic forms of
Type::getInt{1,8,...}[Ptr]Ty, so code can consistently use the methods on Type
without occasionally needed to call IntegerType::get.

llvm-svn: 101111
2010-04-13 01:39:07 +00:00
Daniel Dunbar
dbce77ee48 IRBuilder: Add Create{Shl,LShr,And,Or,Xor} methods from uin64_t and APInt constants.
llvm-svn: 101110
2010-04-13 01:38:57 +00:00
Chris Lattner
dabcd9738c add llvm codegen support for -ffunction-sections and -fdata-sections,
patch by Sylvere Teissier!

llvm-svn: 101106
2010-04-13 00:36:43 +00:00
Sean Callanan
7cd2b6d33b Bug fix: included System/Types.h instead of
inttypes.h to allow building on Windows.

llvm-svn: 101062
2010-04-12 20:21:56 +00:00
Dan Gohman
ff456e3f4d Enhance ScalarEvolution::isKnownPredicate with support for
loop conditions which are invariants.

llvm-svn: 100995
2010-04-11 22:16:48 +00:00
Dan Gohman
a76ed3e23b Fix a comment.
llvm-svn: 100992
2010-04-11 22:07:56 +00:00
Dan Gohman
25305cd2d1 Fix a #include.
llvm-svn: 100980
2010-04-11 19:27:52 +00:00
Dan Gohman
9ca5efece4 Rename isLoopGuardedByCond to isLoopEntryGuardedByCond, to emphasise
that it's only testing for the entry condition, not full loop-invariant
conditions.

llvm-svn: 100979
2010-04-11 19:27:13 +00:00
Benjamin Kramer
adc8df5270 utostr isn't going away too soon, try to make it slightly smaller.
llvm-svn: 100977
2010-04-11 19:00:03 +00:00
Chris Lattner
caf521c6b4 add attributes and module level asm to the ocaml bindings,
patch by Patrick Walton!

llvm-svn: 100932
2010-04-10 17:52:58 +00:00
Wesley Peck
6a6f1a5afa Adding IPSCCP and Internalize passes to the C-bindings
llvm-svn: 100893
2010-04-09 20:43:20 +00:00
Ted Kremenek
90babe9f35 Move 'Optional' class from Clang to LLVM/ADT.
llvm-svn: 100889
2010-04-09 20:25:54 +00:00
Bob Wilson
ae630d5518 Fix up header comments to match the comment fixups I made in r100849.
llvm-svn: 100869
2010-04-09 16:24:49 +00:00
Dan Gohman
6798e98b41 Don't use reserved identifiers.
llvm-svn: 100838
2010-04-09 01:19:28 +00:00
Dan Gohman
127f5c53e1 Add variants of ult, ule, etc. which take a uint64_t RHS, for convenience.
llvm-svn: 100824
2010-04-08 23:03:40 +00:00
Chris Lattner
e154403f78 delete a forwarding function.
llvm-svn: 100815
2010-04-08 21:34:17 +00:00
Chris Lattner
1cf4bded13 move elf section uniquing to MCContext. Along the way
merge XCore's section into MCSectionELF

llvm-svn: 100812
2010-04-08 21:26:26 +00:00
Chris Lattner
0225dbbfee remove the TargetLoweringObjectFileMachO::getMachoSection
api and update clients to use MCContext instead.

llvm-svn: 100808
2010-04-08 20:40:11 +00:00
Chris Lattner
60ff59e5c1 move macho section uniquing from MCParser and TLOF to MCContext where
the compiler and asmparser now unique to the same sections.  This fixes
rdar://7835021.

llvm-svn: 100807
2010-04-08 20:30:37 +00:00
Evan Cheng
619f1b8a94 Coalescer should not delete copy instructions whose defs are partially dead. e.g.
%RDI<def,dead> = MOV64rr %RAX<kill>, %EDI<imp-def>

llvm-svn: 100804
2010-04-08 20:02:37 +00:00
Dan Gohman
6ad805d335 Add a -lint pass which checks for common sources of undefined or likely
unintended behavior.

llvm-svn: 100798
2010-04-08 18:47:09 +00:00
Dan Gohman
95038973ce Fix a comment.
llvm-svn: 100783
2010-04-08 17:41:04 +00:00
Benjamin Kramer
63b5d569d1 Provide operator delete for BumpPtrAllocator and RecyclingAllocator. They will
never be called but msvc complains that they're missing.

llvm-svn: 100766
2010-04-08 15:22:35 +00:00
Evan Cheng
3fa0b6fb03 Avoid using f64 to lower memcpy from constant string. It's cheaper to use i32 store of immediates.
llvm-svn: 100751
2010-04-08 07:37:57 +00:00
Sean Callanan
dcd7a375dd Added support for ARM disassembly to edis.
I also added a rule to the ARM target's Makefile to
build the ARM-specific instruction information table
for the enhanced disassembler.

I will add the test harness for all this stuff in
a separate commit.

llvm-svn: 100735
2010-04-08 00:48:21 +00:00
Evan Cheng
176d2886e8 Fix typo.
llvm-svn: 100726
2010-04-07 23:51:38 +00:00
Chris Lattner
393ea6fc22 introduce a new recoverable error handling API to LLVMContext
and use it in one place in inline asm handling stuff.  Before
we'd generate this for an invalid modifier letter:

$ clang asm.c -c -o t.o
fatal error: error in backend: Invalid operand found in inline asm: 'abc incl    ${0:Z}'
INLINEASM <es:abc incl    ${0:Z}>, 10, %EAX<def>, 2147483657, %EAX, 14, %EFLAGS<earlyclobber,def,dead>, <!-1>


Now we generate this:

$ clang asm.c -c -o t.o
error: invalid operand in inline asm: 'incl    ${0:Z}'
asm.c:3:12: note: generated from here
  __asm__ ("incl    %Z0" : "+r" (X));
           ^
1 error generated.

This is much better but still admittedly not great ("why" is the operand 
invalid??), codegen should try harder with its diagnostics :)

llvm-svn: 100723
2010-04-07 23:40:44 +00:00
Chris Lattner
ea8b374616 rename llvm_install_error_handler -> install_fatal_error_handler
and friends.

llvm-svn: 100717
2010-04-07 23:12:29 +00:00
Eric Christopher
70a6c8fd6d Add support for stpncpy_chk.
llvm-svn: 100710
2010-04-07 23:00:07 +00:00
Chris Lattner
80b41881bc rename llvm::llvm_report_error -> llvm::report_fatal_error
llvm-svn: 100709
2010-04-07 22:58:41 +00:00
Chris Lattner
0768c834fe remove some unneeded errorhandling stuff.
llvm-svn: 100703
2010-04-07 22:44:07 +00:00
Chris Lattner
f927d33d8c minor tidying up
llvm-svn: 100702
2010-04-07 22:41:29 +00:00
Dan Gohman
b5210c934f Generalize IVUsers to track arbitrary expressions rather than expressions
explicitly split into stride-and-offset pairs. Also, add the
ability to track multiple post-increment loops on the same expression.

This refines the concept of "normalizing" SCEV expressions used for
to post-increment uses, and introduces a dedicated utility routine for
normalizing and denormalizing expressions.

This fixes the expansion of expressions which are post-increment users
of more than one loop at a time. More broadly, this takes LSR another
step closer to being able to reason about more than one loop at a time.

llvm-svn: 100699
2010-04-07 22:27:08 +00:00
Anton Korobeynikov
e5c1563130 Remove late ARM codegen optimization pass committed by accident.
It is not ready for public yet.

llvm-svn: 100673
2010-04-07 18:23:27 +00:00
Anton Korobeynikov
0401f43ddc Since tblgen bug was fixed (thanks Jakob!) we don't need InstrStage2 hack anymore.
llvm-svn: 100667
2010-04-07 18:21:41 +00:00
Anton Korobeynikov
b68aa8b5ab Make use of new reserved/required scheduling stuff: introduce VFP and NEON locks to model domain cross stalls precisly.
llvm-svn: 100646
2010-04-07 18:19:40 +00:00
Anton Korobeynikov
f93145e685 Initial support for different kinds of FU reservation.
llvm-svn: 100645
2010-04-07 18:19:32 +00:00
Anton Korobeynikov
d873a16430 Add hook to insert late LLVM=>LLVM passes just before isel
llvm-svn: 100640
2010-04-07 18:18:42 +00:00
Chris Lattner
dde7376e9d Three changes:
1. Introduce some enums and accessors in the InlineAsm class
   that eliminate a ton of magic numbers when handling inline
   asm SDNode.
2. Add a new MDNodeSDNode selection dag node type that holds
   a MDNode (shocking!)
3. Add a new argument to ISD::INLINEASM nodes that hold !srcloc
   metadata, propagating it to the instruction emitter, which
   drops it.

No functionality change.

llvm-svn: 100605
2010-04-07 05:20:54 +00:00
Evan Cheng
ac90d47ea3 Post regalloc LICM. Work in progress.
llvm-svn: 100592
2010-04-07 00:41:17 +00:00