Commit Graph

9724 Commits

Author SHA1 Message Date
Dan Gohman fd81254190 Move PHINodesToUpdate out of SelectionDAGBuilder and into
FunctionLoweringInfo, as it isn't SelectionDAG-specific. This isn't
completely natural, as PHI node state is not per-function but rather
per-basic-block, however there's currently no other convenient
per-basic-block state to group it with.

llvm-svn: 102109
2010-04-22 19:55:20 +00:00
Devang Patel 0fde4aeedd Rename InsnAfterLabelMap and InsnBeforeLabelMap.
llvm-svn: 102106
2010-04-22 18:43:35 +00:00
Devang Patel 53f530d44c Keep track of MCSymbol used to mark beginning of a function.
llvm-svn: 102104
2010-04-22 18:39:21 +00:00
Devang Patel bae14a1cab At this point Start and End are not null.
llvm-svn: 102102
2010-04-22 18:28:58 +00:00
Jakob Stoklund Olesen 14b1d758c6 Run LiveVariables instead of computing liveness locally in -regalloc=fast.
This actually makes everything slower, but the plan is to have isel add <kill>
flags the way it is already adding <dead> flags. Then LiveVariables can be
removed again.

When ignoring the time spent in LiveVariables, -regalloc=fast is now twice as
fast as -regalloc=local.

llvm-svn: 102034
2010-04-21 23:18:07 +00:00
Evan Cheng 02e816b317 Do not try to optimize a copy that has already been marked for deletion.
llvm-svn: 102027
2010-04-21 20:57:54 +00:00
Devang Patel 1a6e399874 Add command line option to disable debug info printing in .s file. This option does not impact debug info generation and preservation through earlier compile starges.
llvm-svn: 102012
2010-04-21 19:08:53 +00:00
Jakob Stoklund Olesen 8a070a540d 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
Devang Patel 0940a8085e Identify when a lexical scope is split in to multiple instruction ranges. Emit such ranges using DW_AT_ranges.
llvm-svn: 102004
2010-04-21 16:32:19 +00:00
Evan Cheng 4158a0ff6b 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 57c732b032 Add more const qualifiers on TargetMachine and friends.
llvm-svn: 101977
2010-04-21 01:34:56 +00:00
Dan Gohman cc5e6528a5 Update CMakeLists.txt.
llvm-svn: 101976
2010-04-21 01:32:29 +00:00
Dan Gohman 450aa64fc1 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 2034d9f2da - 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
Evan Cheng 4b2ef56ad2 Rewrite machine cse to avoid recursion.
llvm-svn: 101964
2010-04-21 00:21:07 +00:00
Dan Gohman ad33d33719 Add another variant of this test which found a place where
CodeGen's ComputeMaskedBits was being over-conservative when computing
bits for an ADD.

llvm-svn: 101963
2010-04-21 00:19:28 +00:00
Dale Johannesen 0522b90cdb 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
Jakob Stoklund Olesen 011207a0ae When MachineLICM is hoisting a physical register after regalloc, make sure the
register is not killed in the loop.

This fixes 188.ammp on ARM where the post-ra scheduler would grab a register
that looked available but wasn't.

A testcase would be huge and fragile, sorry.

llvm-svn: 101930
2010-04-20 18:45:47 +00:00
Evan Cheng 4019d571d9 Typo.
llvm-svn: 101914
2010-04-20 17:27:38 +00:00
Dan Gohman 950fe784be Sink the CopyToExportRegsIfNeeded calls out of SelectionDAGISel
into SelectionDAGBuilder. This avoids a separate pass over the
instructions, and has the side effect of providing debug location
information to the copy.

llvm-svn: 101906
2010-04-20 15:03:56 +00:00
Dan Gohman f41ad478ca Don't send PHI nodes down to SelectionDAGBuilder of FastISel, since
they end up doing nothing.

llvm-svn: 101904
2010-04-20 15:00:41 +00:00
Dan Gohman 7c845e4ea4 Sink this use_empty() check into isUsedOutsideOfDefiningBlock.
llvm-svn: 101902
2010-04-20 14:50:13 +00:00
Dan Gohman 7b7f0883fe If a PHI node somehow has debug info, propogate it to the MachineInstr PHI.
llvm-svn: 101901
2010-04-20 14:48:02 +00:00
Dan Gohman 0f055d3f56 Don't iterate through the whole block just to find the PHI nodes.
llvm-svn: 101900
2010-04-20 14:46:25 +00:00
Gabor Greif 27b3d55194 use abstract accessors to CallInst
llvm-svn: 101899
2010-04-20 13:13:04 +00:00
Chris Lattner 5100367ff3 Bill's change in r95336 broke empty aggregates embedded
in other types.  fix this by only bumping zero-byte globals
up to a single byte if the *entire global* is zero size,
fixing PR6340.

This also fixes empty arrays etc to be handled correctly,
and only does this on subsection-via-symbols targets (aka
darwin) which is the only place where this matters.

llvm-svn: 101879
2010-04-20 06:20:21 +00:00
Dan Gohman 0c862a86fa Delete a redundant return statement.
llvm-svn: 101860
2010-04-20 01:58:20 +00:00
Bill Wendling 467e6c2deb The visitXOR method can return the same SDNode. If so, we don't want to delete
it as it's not dead.

llvm-svn: 101855
2010-04-20 01:25:01 +00:00
Dan Gohman eadc04badc Remove this debug output; it isn't that useful, and it's incomplete
in the case where a basic block is split.

llvm-svn: 101850
2010-04-20 00:56:44 +00:00
Dan Gohman e450d7444d 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
Dan Gohman 3df671a81c 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 ca35aa1122 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 be2e727a38 Revert 101825, which is causing trouble.
llvm-svn: 101832
2010-04-19 23:34:15 +00:00
Dan Gohman 35bc4d46cb Make BreakAntiDependencies' SUnits argument const, and make the Begin
and End arguments by-value rather than by-reference.

llvm-svn: 101830
2010-04-19 23:11:58 +00:00
Dan Gohman 8cccc542f6 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 7c0303a059 Eliminate the CurMBB member from SelectionDAGBuilder. For places that
need it, just pass around the parent block of the current instruction
explicitly.

llvm-svn: 101822
2010-04-19 22:41:47 +00:00
Evan Cheng e19aa5cc52 More progress on promoting i16 operations to i32 for x86. Work in progress.
llvm-svn: 101808
2010-04-19 19:29:22 +00:00
Dan Gohman 1e95790fd4 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
Evan Cheng e7c21a4242 More 80 col violation.
llvm-svn: 101806
2010-04-19 19:17:44 +00:00
Devang Patel 6188093cca 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 c334960f16 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
Dan Gohman a91754da67 Move isInTailCallPosition out of SelectionDAGBuilder, as it isn't
SelectionDAG-specific.

llvm-svn: 101801
2010-04-19 18:41:46 +00:00
Dan Gohman 1f0f2142cc Fix -Wcast-qual warnings.
llvm-svn: 101655
2010-04-17 17:42:52 +00:00
Dan Gohman 53d4a08d2b Add const qualifiers to TargetLoweringObjectFile usage.
llvm-svn: 101640
2010-04-17 16:44:48 +00:00
Dan Gohman 88f7f6aeda Use const_cast instead of a C-style cast to cast away const.
llvm-svn: 101639
2010-04-17 16:43:55 +00:00
Dan Gohman 4fee6f3bdd Start function numbering at 0.
llvm-svn: 101638
2010-04-17 16:29:15 +00:00
Dan Gohman 8422e57baa Delete now-unnecessary const_casts.
llvm-svn: 101637
2010-04-17 15:32:28 +00:00
Dan Gohman 21cea8ac2e 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
Evan Cheng 5fdb57cc10 Postra machine licm must add registers defined by loop invariants to *all* of
the live-in sets of BBs in the loop. Otherwise later pass may end up using the
registers and override the invariant. rdar://7852937
No reasonablly sized test case possible.

llvm-svn: 101626
2010-04-17 07:07:11 +00:00
Evan Cheng 4f3aba431e Fix codegen passes. -disable-ssc shouldn't disable postra machine licm.
llvm-svn: 101622
2010-04-17 06:47:47 +00:00
Evan Cheng f1bd5fcdb4 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
Evan Cheng 829c300ce0 Another 80 col violation.
llvm-svn: 101620
2010-04-17 06:12:32 +00:00
Bob Wilson 4e5eb5ae1b As a temporary workaround for post-RA not handling DebugValue instructions,
just remove them all.  Radar 7873207 (working around the root problem of
Radar 7759363).

llvm-svn: 101604
2010-04-17 00:49:11 +00:00
Jakob Stoklund Olesen 71336f213b Revert "Use a simpler data structure to calculate the least recently used register in RegAllocLocal."
This reverts commit 101392. It broke a buildbot.

llvm-svn: 101595
2010-04-17 00:38:36 +00:00
Eric Christopher 7258dcd77f 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 12563b3495 Add support to emit dwarf ranges.
llvm-svn: 101575
2010-04-16 23:33:45 +00:00
Jakob Stoklund Olesen ae372e2ce0 Use a simpler data structure to calculate the least recently used register in RegAllocLocal.
This makes the local register allocator about 20% faster.

llvm-svn: 101574
2010-04-16 23:32:37 +00:00
Evan Cheng f037f87bde (i32 sext_in_reg (i32 aext (i16 x)), i16) -> (i32 sext x). No known test case until -promote-16bit is enabled.
llvm-svn: 101551
2010-04-16 22:26:19 +00:00
Dan Gohman c4759a5b97 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 4d273f4519 Commit this, which should have accompanied 101531.
llvm-svn: 101532
2010-04-16 20:22:43 +00:00
Evan Cheng 954bd598dd 80 col.
llvm-svn: 101501
2010-04-16 17:58:41 +00:00
Evan Cheng d6b0a7c075 80 col.
llvm-svn: 101500
2010-04-16 17:57:59 +00:00
Dan Gohman 3a7ee8eead Avoid creating virtual registers for unused values.
llvm-svn: 101480
2010-04-16 17:15:02 +00:00
Dan Gohman 5664b9f1a9 Fix an assertion string.
llvm-svn: 101478
2010-04-16 16:55:18 +00:00
Dan Gohman 4572a9f479 Fix a comment.
llvm-svn: 101477
2010-04-16 16:52:37 +00:00
Gabor Greif f375520f7b 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
Bill Wendling 929f3c0927 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 af56facacd 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
Dan Gohman 5563473062 Refine further the scope where the global DebugLoc value is active.
llvm-svn: 101443
2010-04-16 05:06:56 +00:00
Gabor Greif 403e9694f9 back out r101423 and r101397, they break llvm-gcc self-host on darwin10
llvm-svn: 101434
2010-04-16 01:16:20 +00:00
Jakob Stoklund Olesen cdc3df4888 Avoid sinking machine instructions into a loop.
MachineLoopInfo is already available when MachineSinking runs, so the check is
free.

There is no test case because it would require a critical edge into a loop, and
CodeGenPrepare splits those. This check is just to be extra careful.

llvm-svn: 101420
2010-04-15 23:41:02 +00:00
Gabor Greif 33ae80bff7 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
Jakob Stoklund Olesen b642a27525 Fix PR6847. RegScavenger should ignore DebugValues.
llvm-svn: 101392
2010-04-15 20:28:39 +00:00
Nicolas Geoffray 19cd1d84ad Make sure the initialization of a GC root is after its definition.
llvm-svn: 101388
2010-04-15 19:53:35 +00:00
Gabor Greif b36d07cb93 prune includes
llvm-svn: 101385
2010-04-15 19:44:21 +00:00
Dan Gohman b29cda9b3c Fix a bunch of namespace polution.
llvm-svn: 101376
2010-04-15 17:08:50 +00:00
Gabor Greif ff3c8b7eaf typos
llvm-svn: 101371
2010-04-15 15:14:46 +00:00
Gabor Greif 9fd00c7d25 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 aafd209632 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
Chris Lattner 3245afdf05 enhance the load/store narrowing optimization to handle a
tokenfactor in between the load/store.  This allows us to 
optimize test7 into:

_test7:                                 ## @test7
## BB#0:                                ## %entry
	movl	(%rdx), %eax
                                        ## kill: SIL<def> ESI<kill>
	movb	%sil, 5(%rdi)
	ret

instead of:

_test7:                                 ## @test7
## BB#0:                                ## %entry
	movl	4(%esp), %ecx
	movl	$-65281, %eax           ## imm = 0xFFFFFFFFFFFF00FF
	andl	4(%ecx), %eax
	movzbl	8(%esp), %edx
	shll	$8, %edx
	addl	%eax, %edx
	movl	12(%esp), %eax
	movl	(%eax), %eax
	movl	%edx, 4(%ecx)
	ret

llvm-svn: 101355
2010-04-15 06:10:49 +00:00
Chris Lattner 6ebd8674eb teach codegen to turn trunc(zextload) into load when possible.
This doesn't occur much at all, it only seems to formed in the case
when the trunc optimization kicks in due to phase ordering.  In that
case it is saves a few bytes on x86-32.

llvm-svn: 101350
2010-04-15 05:40:59 +00:00
Chris Lattner f9b2e3c68a add a simple dag combine to replace trivial shl+lshr with
and.  This happens with the store->load narrowing stuff.

llvm-svn: 101348
2010-04-15 05:28:43 +00:00
Chris Lattner 4041ab6e00 Implement rdar://7860110 (also in target/readme.txt) narrowing
a load/or/and/store sequence into a narrower store when it is
safe.  Daniel tells me that clang will start producing this sort
of thing with bitfields, and this does  trigger a few dozen times
on 176.gcc produced by llvm-gcc even now.

This compiles code like CodeGen/X86/2009-05-28-DAGCombineCrash.ll 
into:

        movl    %eax, 36(%rdi)

instead of:

        movl    $4294967295, %eax       ## imm = 0xFFFFFFFF
        andq    32(%rdi), %rax
        shlq    $32, %rcx
        addq    %rax, %rcx
        movq    %rcx, 32(%rdi)

and each of the testcases into a single store.  Each of them used
to compile into craziness like this:

_test4:
	movl	$65535, %eax            ## imm = 0xFFFF
	andl	(%rdi), %eax
	shll	$16, %esi
	addl	%eax, %esi
	movl	%esi, (%rdi)
	ret

llvm-svn: 101343
2010-04-15 04:48:01 +00:00
Dan Gohman 913c998703 Add more const qualifiers for LLVM IR pointers in CodeGen.
llvm-svn: 101342
2010-04-15 04:33:49 +00:00
Dan Gohman bcaf681cde Add const qualifiers to CodeGen's use of LLVM IR constructs.
llvm-svn: 101334
2010-04-15 01:51:59 +00:00
Evan Cheng 87b4f7c1aa More 80 violations.
llvm-svn: 101330
2010-04-15 01:25:27 +00:00
Evan Cheng 8442ef6f89 80 col violations.
llvm-svn: 101325
2010-04-15 01:01:55 +00:00
Devang Patel 3d6c40c616 Add comment.
llvm-svn: 101317
2010-04-15 00:02:49 +00:00
Devang Patel 97bdf94da3 There is no need to track compile unit offsets if there is only one compile unit.
llvm-svn: 101315
2010-04-14 23:56:24 +00:00
Devang Patel b08ccb62d5 Remove dead code.
llvm-svn: 101314
2010-04-14 23:54:13 +00:00
Dan Gohman c87b74d913 Delete unneeeded arguments.
llvm-svn: 101276
2010-04-14 20:17:22 +00:00
Dan Gohman a3918ecdf5 Delete unused arguments.
llvm-svn: 101275
2010-04-14 20:05:00 +00:00
Dan Gohman 7deb447781 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 c2c08d19b8 Reset the debug location even if the instruction was a terminator.
llvm-svn: 101272
2010-04-14 19:30:02 +00:00
Dan Gohman cacd4f2401 Refine #includes.
llvm-svn: 101269
2010-04-14 18:49:17 +00:00
Dan Gohman 8ebcbe949a Pull utility routines with no SelectionDAG dependence out of
SelectionDAGBuilder. FunctionLoweringInfo isn't an ideal place for
them to live, but it's better than SelectionDAGBuilder for now.

llvm-svn: 101267
2010-04-14 18:31:02 +00:00
Dan Gohman f5cca35750 Fix typos in comments.
llvm-svn: 101266
2010-04-14 18:24:06 +00:00
Dan Gohman fea9ba18ff Delete an obsolete comment.
llvm-svn: 101264
2010-04-14 17:40:25 +00:00
Dan Gohman 3215eae4a3 Delete an unused function.
llvm-svn: 101263
2010-04-14 17:22:02 +00:00
Dan Gohman 094fc7b09e Clear the FunctionLoweringInfo object before doing other things that
don't need it.

llvm-svn: 101262
2010-04-14 17:13:16 +00:00
Dan Gohman ad0b3ea3cc Move this assert out of SelectionDAGISel into FunctionLoweringInfo, and
drop the redundant #ifndef NDEBUG.

llvm-svn: 101261
2010-04-14 17:11:23 +00:00
Dan Gohman 0f405c8d73 Add a comment.
llvm-svn: 101260
2010-04-14 17:09:37 +00:00
Dan Gohman 2ca8fb229c Move the code for initialing the entry block livein set out of
SelectionDAGISel.

llvm-svn: 101258
2010-04-14 17:05:00 +00:00
Dan Gohman 4bfb437ec9 Reorgnaize this code to be more tidy and readable.
llvm-svn: 101256
2010-04-14 17:02:07 +00:00
Dan Gohman 1939b5f130 Trim #includes.
llvm-svn: 101255
2010-04-14 16:54:39 +00:00
Dan Gohman 2b79ee8bc8 Move the code for emitting livein copies out of SelectionDAGISel.
llvm-svn: 101254
2010-04-14 16:51:49 +00:00
Dan Gohman 69e8e322d9 Sink landing-pad marking code out of
SelectionDAGISel::runOnMachineFunction into FunctionLowering.

llvm-svn: 101252
2010-04-14 16:32:56 +00:00
Dan Gohman f57117d166 It's not necessary to recompute EB here.
llvm-svn: 101251
2010-04-14 16:30:40 +00:00
Dan Gohman 5f40d34958 Generalize this code to handle Instructions in addition to ConstantExprs.
llvm-svn: 101210
2010-04-14 02:33:23 +00:00
Dan Gohman 9162fb07be Reorder the methods of this class to be a little more organized.
llvm-svn: 101206
2010-04-14 02:09:45 +00:00
Devang Patel b7eadda495 Clear MachineInstr->MCSymbol maps at the end of a function.
llvm-svn: 101202
2010-04-14 01:18:28 +00:00
Evan Cheng 87585d72a5 Fast path implicit_def check.
llvm-svn: 101183
2010-04-13 22:13:34 +00:00
Devang Patel 12d150ea43 Do not include types without any definition in pubtypes list.
llvm-svn: 101171
2010-04-13 20:35:04 +00:00
Evan Cheng cce672c172 Avoid variable shadowing.
llvm-svn: 101170
2010-04-13 20:25:29 +00:00
Evan Cheng 89e74792b6 Expand postra machine licm's capability a little more. If an instruction's register operands are all loop invariants, then it's safe to hoist it.
llvm-svn: 101167
2010-04-13 20:21:05 +00:00
Jakob Stoklund Olesen 20b71e28cc Teach MachineSinking to handle easy critical edges.
Sometimes it is desirable to sink instructions along a critical edge:

x = ...
if (a && b) ...
else use(x);

The 'a && b' condition creates a critical edge to the else block, but we still
want to sink the computation of x into the block. The else block is dominated by
the parent block, so we are not pushing instructions into new code paths.

llvm-svn: 101165
2010-04-13 19:06:14 +00:00
Evan Cheng 0a2aff2d12 Teach postra machine licm to hoist more obvious invariants, e.g. instructions with no source operands.
llvm-svn: 101154
2010-04-13 18:16:00 +00:00
Dan Gohman 8a2dae57e2 Add a few comments.
llvm-svn: 101148
2010-04-13 17:07:06 +00:00
Dan Gohman 9d2d053e11 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 dcacef3188 Rename MachineFrameInfo variables to MFI, for consistency with
the rest of CodeGen.

llvm-svn: 101146
2010-04-13 16:56:45 +00:00
Dan Gohman 6b1b1e4358 Move MachineRegisterInfo's isLiveIn and isLiveOut out of line.
llvm-svn: 101145
2010-04-13 16:55:37 +00:00
Dan Gohman 39305067ad Delete an unused member variable.
llvm-svn: 101143
2010-04-13 16:51:39 +00:00
Chris Lattner 5b212a31a2 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
Dan Gohman e4148978b8 Remove a #include.
llvm-svn: 101043
2010-04-12 16:26:03 +00:00
Benjamin Kramer d0b5c6cbed Plug trivial leak.
llvm-svn: 101034
2010-04-12 11:38:35 +00:00
Evan Cheng 250283916d Enable post regalloc machine licm by default.
llvm-svn: 101023
2010-04-12 06:25:28 +00:00
Dan Gohman ecd40a34e2 Remove unnecessary parens.
llvm-svn: 101010
2010-04-12 02:24:01 +00:00
Bob Wilson 67dd3a4464 Tidy whitespace.
llvm-svn: 100904
2010-04-09 21:38:26 +00:00
Devang Patel 541019ddec Clear InsnsBeginScopeSet and InsnsEndScopeSet at the end of function.
llvm-svn: 100867
2010-04-09 16:04:20 +00:00
Dan Gohman 87f8207c97 Delete this obsolete comment.
llvm-svn: 100858
2010-04-09 14:12:01 +00:00
Chandler Carruth 825989ab63 Add a missing dependency to this library when building with CMake.
llvm-svn: 100852
2010-04-09 05:55:25 +00:00
Bob Wilson d8eeb12120 Use getNumImplicitDefs() and getNumImplicitUses().
llvm-svn: 100850
2010-04-09 04:46:43 +00:00
Bob Wilson 406f270148 Fix up some comments.
llvm-svn: 100849
2010-04-09 04:34:03 +00:00
Dan Gohman 4ce1fb1448 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 80c345927e delete a forwarding function.
llvm-svn: 100815
2010-04-08 21:34:17 +00:00
Chris Lattner 5418dd5fda 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 433d40695b 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 2073112fc0 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 b083c47c21 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
Ted Kremenek d87bd77586 Fix -Wsign-compare warning (issued by clang++).
llvm-svn: 100799
2010-04-08 18:49:30 +00:00
Devang Patel 359b013129 Rename a function.
llvm-svn: 100797
2010-04-08 18:43:56 +00:00
Chris Lattner 294a90d87a implicit defs get added to the end of machine instrs sometimes. Scan the whole instruction for the metadata operand instead of assuming it will be at the end of the instruction.
llvm-svn: 100792
2010-04-08 18:20:52 +00:00
Devang Patel 3ebd8931fb One instruction may start (or end) multiple lexical scopes.
There is no need to remember labels identifying regions marked by such instructions in each scope.

llvm-svn: 100781
2010-04-08 16:50:29 +00:00
Devang Patel 2abed283e5 Remove dead code.
llvm-svn: 100771
2010-04-08 15:48:02 +00:00
Devang Patel adfd4df12c Delete out of date comment.
llvm-svn: 100769
2010-04-08 15:41:13 +00:00
Devang Patel f1d5a1e994 Refactor.
llvm-svn: 100768
2010-04-08 15:37:09 +00:00
Benjamin Kramer a6769269f3 Use twines to simplify calls to report_fatal_error. For code size and readability.
llvm-svn: 100756
2010-04-08 10:44:28 +00:00
Evan Cheng ebe47c872f 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
Evan Cheng 058b9f04e8 Make post regalloc machine licm functional. It now passes all of MultiSource.
llvm-svn: 100742
2010-04-08 01:03:47 +00:00
Chris Lattner 3c65a8324d convert a report_fatal_error that I was able to trigger into a nice error
so the user at least knows what inline asm is a problem.  For example:

error: inline asm not supported yet: don't know how to handle tied indirect register inputs
pr8788-1.c:14:10: note: generated from here
    asm ("\n" : "+r" (stack->regs)
         ^

Instead of:
fatal error: error in backend: Don't know how to handle tied indirect register inputs yet!

llvm-svn: 100731
2010-04-08 00:09:16 +00:00
Chris Lattner 94ef52824b minor tidying.
llvm-svn: 100725
2010-04-07 23:50:38 +00:00
Chris Lattner cd92718a0f use assertions instead of unreachable for logic errors.
llvm-svn: 100724
2010-04-07 23:47:51 +00:00
Chris Lattner 1e45789ee0 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 2104b8d36e rename llvm::llvm_report_error -> llvm::report_fatal_error
llvm-svn: 100709
2010-04-07 22:58:41 +00:00
Chris Lattner cc7bb24fe2 remove some unneeded errorhandling stuff.
llvm-svn: 100703
2010-04-07 22:44:07 +00:00
Chris Lattner b50e795369 tidy up
llvm-svn: 100700
2010-04-07 22:29:10 +00:00
Anton Korobeynikov 6e01726eae 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 0bdc6345e8 Initial support for different kinds of FU reservation.
llvm-svn: 100645
2010-04-07 18:19:32 +00:00
Anton Korobeynikov 9a348a9572 Factor out scoreboard into separate class. This way we might have several different score boards.
llvm-svn: 100644
2010-04-07 18:19:24 +00:00
Anton Korobeynikov fed8ee7dfc Add hook to insert late LLVM=>LLVM passes just before isel
llvm-svn: 100640
2010-04-07 18:18:42 +00:00
Chris Lattner 6855d62768 fix 80 col violation, patch by Alastair Lynn
llvm-svn: 100639
2010-04-07 18:13:33 +00:00
Chris Lattner 29233c0458 add a comment line that got dropped
llvm-svn: 100638
2010-04-07 18:10:38 +00:00
Chris Lattner f839ee0c13 fix a latent bug my inline asm stuff exposed:
MachineOperand::isIdenticalTo wasn't handling metadata operands.

llvm-svn: 100636
2010-04-07 18:03:19 +00:00
Benjamin Kramer f2351a7a6e Remove unused method.
llvm-svn: 100620
2010-04-07 11:23:46 +00:00
Torok Edwin f8dba24a9b Workaround the breakage in r100616 by guarding all timers with
TimePassesIsEnabled. This should allow make check to pass.

llvm-svn: 100618
2010-04-07 10:44:46 +00:00
Bill Wendling fcc14141c7 Use the "NamedGroupTimer" class to categorize DWARF emission better.
llvm-svn: 100616
2010-04-07 09:28:04 +00:00
Benjamin Kramer 43c275fa56 Use raw_ostream.
llvm-svn: 100615
2010-04-07 09:26:51 +00:00
Evan Cheng 5ed679282b Add comments for missed opportunities.
llvm-svn: 100610
2010-04-07 06:00:33 +00:00
Evan Cheng fcbcc0bd51 Fix typo.
llvm-svn: 100609
2010-04-07 05:59:12 +00:00
Chris Lattner 51065568cd Have the inst emitter add the !srcloc mdnode to the machine instr.
Have the asmprinter use the mdnode to scavenge a source location if
present.  Document this nonsense in langref.

llvm-svn: 100607
2010-04-07 05:38:05 +00:00
Chris Lattner d62adaa54d remove another magic number.
llvm-svn: 100606
2010-04-07 05:27:36 +00:00
Chris Lattner 3b9f02a2aa 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
Dale Johannesen 5d7f0a0fdd Move printing of target-indepedent DEBUG_VALUE comments
into AsmPrinter.  Target-dependent form is still generated
by FastISel and still handled in X86 code.

llvm-svn: 100596
2010-04-07 01:15:14 +00:00
Evan Cheng 6ea5949a93 Post regalloc LICM. Work in progress.
llvm-svn: 100592
2010-04-07 00:41:17 +00:00
Devang Patel 019922d1b0 Do not emit specification DIE with DW_AT_specification attribute for member functions of a funcation local class. This trips gdb's partial scan of DIEs at load time. Fixes Radar 7833483.
llvm-svn: 100586
2010-04-06 23:53:48 +00:00
John McCall 796583eec0 Fix a number of clang -Wsign-compare warnings that didn't have an obvious
solution.  The only reason these don't fire with gcc-4.2 is that gcc turns off
part of -Wsign-compare in C++ on accident.

llvm-svn: 100581
2010-04-06 23:35:53 +00:00
Dale Johannesen b36c70913b Revert 100573, it's causing some testsuite problems.
llvm-svn: 100578
2010-04-06 22:45:26 +00:00
Dale Johannesen 85b35b6214 Move printing of DEBUG_VALUE comments to target-independent place.
There is probably a more elegant way to do this.

llvm-svn: 100573
2010-04-06 22:21:07 +00:00
Dale Johannesen d1976e35c4 Allow for the possibility that a debug-value points
to a SDNode that didn't have code generated for it.

llvm-svn: 100566
2010-04-06 21:59:56 +00:00
Stuart Hastings 4bd3dd956f Reverting 100530 & 100531 due to regressions in the GDB test suite.
llvm-svn: 100563
2010-04-06 21:38:29 +00:00
Evan Cheng a910f17a20 Code clean up. Move includes from VirtRegRewriter.h to VirtRegRewriter.cpp.
llvm-svn: 100532
2010-04-06 17:19:55 +00:00
Stuart Hastings c067196984 Revise debug info machinery to digest nested functions and classes.
A certain GDB testsuite case (local.cc) has a function nested inside a
class nested inside another function.  GCC presents the innermost
function to llvm-convert first.  Heretofore, the debug info mistakenly
placed the inner function at module scope.  This patch walks the GCC
context links and instantiates the outer class and function so the
debug info is properly nested.  Radar 7426545.

llvm-svn: 100530
2010-04-06 17:19:32 +00:00
Mon P Wang bf86224d5e Remove assert to treat memmove and memset like memcpy
llvm-svn: 100521
2010-04-06 08:27:51 +00:00
Chris Lattner 92aba5a817 propagate cookie management out one layer of function calls.
llvm-svn: 100510
2010-04-06 00:58:50 +00:00
Chris Lattner 59126b2500 report errors through LLVMContext's inline asm handler if available.
llvm-svn: 100509
2010-04-06 00:55:39 +00:00
Chris Lattner f226748324 Give MachineModuleInfo an actual Module*.
llvm-svn: 100508
2010-04-06 00:51:52 +00:00
Devang Patel fc4a1db23b Remove unnecessary include.
llvm-svn: 100505
2010-04-06 00:38:32 +00:00
Evan Cheng 272a2f8432 Fix an obvious copy-n-paste bug. It's not known to cause any miscompilation.
llvm-svn: 100494
2010-04-05 23:33:29 +00:00
Chris Lattner 3b21e4d404 Give AsmParser an option to control whether it finalizes
the stream.  New demo:

$ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o
$ otool -tv t.o
t.o:
(__TEXT,__text) section
_foo:
0000000000000000	subq	$0x08,%rsp
0000000000000004	movl	%edi,(%rsp)
0000000000000007	movl	%edi,%eax
0000000000000009	incl	%eax
000000000000000b	movl	%eax,(%rsp)
000000000000000e	movl	%eax,0x04(%rsp)
0000000000000012	addq	$0x08,%rsp
0000000000000016	ret

llvm-svn: 100492
2010-04-05 23:15:42 +00:00
Chris Lattner 8900ef1931 add .o file writing for inline asm in llc. Here's a silly
demo:

$ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o
<inline asm>:1:2: error: unrecognized instruction
	abc incl    %eax
	^
LLVM ERROR: Error parsing inline asm

Only problem seems to be that the parser finalizes OutStreamer 
at the end of the first inline asm, which isn't what we want.
For example:

$ cat asm.c
int foo(int X) {
 __asm__ ("incl    %0" : "+r" (X));
 return X;
}
$ clang asm.c -S -o - -emit-llvm | llc
...
	subq	$8, %rsp
	movl	%edi, (%rsp)
	movl	%edi, %eax
	## InlineAsm Start
	incl    %eax
	## InlineAsm End
	movl	%eax, (%rsp)
	movl	%eax, 4(%rsp)
	addq	$8, %rsp
	ret
$ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o
$ otool -tv t.o
t.o:
(__TEXT,__text) section
_foo:
0000000000000000	subq	$0x08,%rsp
0000000000000004	movl	%edi,(%rsp)
0000000000000007	movl	%edi,%eax
0000000000000009	incl	%eax
$ 

don't stop at inc!

llvm-svn: 100491
2010-04-05 23:11:24 +00:00
Bill Wendling 30346347b3 Output floating point representations in DWARF format. This is done by outputing
the FP encoding directly as a hex representation.

llvm-svn: 100487
2010-04-05 22:59:21 +00:00
Chris Lattner 0e45d24a4e stringref-ize the MemoryBuffer::get apis. This requires
a co-committed clang patch.

llvm-svn: 100485
2010-04-05 22:42:30 +00:00
Dan Gohman f38547c83f Add a comment.
llvm-svn: 100459
2010-04-05 20:24:08 +00:00
Chris Lattner bc217873e3 lowering a volatile llvm.memcpy to a libc memcpy is ok.
PR6779

llvm-svn: 100457
2010-04-05 20:11:45 +00:00
Dan Gohman 918a90a3ca Don't do code sinking on unreachable blocks. It's unprofitable and hazardous.
llvm-svn: 100455
2010-04-05 19:17:22 +00:00
Chris Lattner fb964e57e5 remove the now-redundant MMI pointer in SelectionDAG.
llvm-svn: 100419
2010-04-05 06:19:28 +00:00
Chris Lattner 28f2fdafcd hopefully sate the clang self host build, which is apparently
instantiating some folding set stuff that GCC isn't, requiring 
some types to not be incomplete.

I don't know if clang is right or wrong, but unbreaking the
bot is goodness.  Here's the broken build:
http://google1.osuosl.org:8011/builders/clang-x86_64-darwin10-selfhost/builds/1813/steps/compile.llvm.stage2/logs/stdio

llvm-svn: 100418
2010-04-05 06:12:01 +00:00
Chris Lattner 6361414c88 remove some redundant MMI arguments.
llvm-svn: 100417
2010-04-05 06:10:13 +00:00
Chris Lattner 305f2efb63 unthread MMI from FastISel
llvm-svn: 100416
2010-04-05 06:05:26 +00:00
Chris Lattner 82ff9af068 remove the MMI pointer from MachineFrameInfo.
llvm-svn: 100415
2010-04-05 05:57:52 +00:00