Commit Graph

98 Commits

Author SHA1 Message Date
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
Gabor Greif b36d07cb93 prune includes
llvm-svn: 101385
2010-04-15 19:44:21 +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
Chris Lattner f226748324 Give MachineModuleInfo an actual Module*.
llvm-svn: 100508
2010-04-06 00:51:52 +00:00
Chris Lattner b1c4f62cac Fix PR6673: updating the callback should not clear the map.
llvm-svn: 99227
2010-03-22 23:15:57 +00:00
Chris Lattner db035a0af2 Fix the third (and last known) case of code update problems due
to LLVM IR changes with addr label weirdness.  In the testcase, we
generate references to the two bb's when codegen'ing the first
function:

_test1:                                 ## @test1
	leaq	Ltmp0(%rip), %rax
..
	leaq	Ltmp1(%rip), %rax

Then continue to codegen the second function where the blocks
get merged.  We're now smart enough to emit both labels, producing
this code:

_test_fun:                              ## @test_fun
## BB#0:                                ## %entry
Ltmp1:                                  ## Block address taken
Ltmp0:
## BB#1:                                ## %ret
	movl	$-1, %eax
	ret

Rejoice.

llvm-svn: 98595
2010-03-16 00:29:39 +00:00
Chris Lattner 561334a81f Implement support for the case when a reference to a addr-of-bb
label is generated, but then the block is deleted.  Since the
value is undefined, we just emit the label right after the entry 
label of the function.  It might matter that the label is in the
same section as the function was afterall.

llvm-svn: 98579
2010-03-15 20:39:00 +00:00
Chris Lattner 347a0eb85c Fix the case when a reference to an address taken BB is emitted in one
function, then the BB is RAUW'd before the definition is emitted.  There
are still two cases not being handled, but this should improve us back to
the situation before I touched anything.

llvm-svn: 98566
2010-03-15 19:09:43 +00:00
Chris Lattner 9efbbcbe45 fix AsmPrinter::GetBlockAddressSymbol to always return a unique
label instead of trying to form one based on the BB name (which
causes collisions if the name is empty).  This fixes PR6608

llvm-svn: 98495
2010-03-14 17:53:23 +00:00
Chris Lattner 6e52e9db31 get MMI out of the label uniquing business, just go to MCContext
to get unique assembler temporary labels.

llvm-svn: 98489
2010-03-14 08:36:50 +00:00
Chris Lattner ee2fbbc978 change the LabelSDNode to be EHLabelSDNode and make it hold
an MCSymbol.  Make the EH_LABEL MachineInstr hold its label
with an MCSymbol instead of ID.  Fix a bug in MMI.cpp which
would return labels named "Label4" instead of "label4".

llvm-svn: 98463
2010-03-14 02:33:54 +00:00
Chris Lattner 07293da97e eliminate InvalidateLabel and LabelIDList from MMI and replace
them with a counter.

llvm-svn: 98462
2010-03-14 02:24:55 +00:00
Chris Lattner 34adc8d225 change EH related stuff (other than EH_LABEL) to use MCSymbol
instead of label ID's.  This cleans up and regularizes a bunch 
of code and makes way for future progress.

Unfortunately, this pointed out to me that JITDwarfEmitter.cpp
is largely copy and paste from DwarfException/MachineModuleInfo
and other places.  This is very sad and disturbing. :(

One major change here is that TidyLandingPads moved from being
called in DwarfException::BeginFunction to being called in
DwarfException::EndFunction.  There should not be any 
functionality change from doing this, but I'm not an EH expert.

llvm-svn: 98459
2010-03-14 01:41:15 +00:00
Chris Lattner e468f88b26 rearrange MCContext ownership. Before LLVMTargetMachine created it
and passing off ownership to AsmPrinter.  Now MachineModuleInfo
creates it and owns it by value.  This allows us to use MCSymbols
more consistently throughout the rest of the code generator, and
simplifies a bit of code.  This also allows MachineFunction to 
keep an MCContext reference handy, and cleans up the TargetRegistry
interfaces for AsmPrinters.

llvm-svn: 98450
2010-03-13 20:55:24 +00:00
Chris Lattner c3b70f636f strength reduce MMI::MappedLabel to MMI::isLabelDeleted,
and add a FIXME about how we are eventually going to zap this
lookup table once mc world domination is complete.

llvm-svn: 98031
2010-03-09 01:51:43 +00:00
Bob Wilson 182c53ee88 Fix an uninitialized value. Radar 7609421.
llvm-svn: 95488
2010-02-06 05:55:20 +00:00
Jim Grosbach 54c0530834 Update of 94055 to track the IR level call site information via an intrinsic.
This allows code gen and the exception table writer to cooperate to make sure
landing pads are associated with the correct invoke locations.

llvm-svn: 94726
2010-01-28 01:45:32 +00:00
Jim Grosbach 143f7eb4c8 back this out for now. Growing Function is not good.
llvm-svn: 94097
2010-01-21 20:10:22 +00:00
Jim Grosbach e029a6a5ed Make sure that landing pad entries in the EH call site table are in the proper
order for SjLj style exception handling.

llvm-svn: 94055
2010-01-21 00:43:30 +00:00
Devang Patel 21c2e100ba Remove DebugLabelFolder pass. It is not used by dwarf writer anymore.
llvm-svn: 89790
2009-11-24 19:37:07 +00:00
Devang Patel 2904aa9f6e "Attach debug info with llvm instructions" mode was enabled a month ago. Now make it permanent and remove old way of inserting intrinsics to encode debug info for line number and scopes.
llvm-svn: 87014
2009-11-12 19:02:56 +00:00
Devang Patel e1969dcd11 Clear variable debug info map at the end of the function.
llvm-svn: 83571
2009-10-08 20:41:17 +00:00
Devang Patel c2105298cc Simplify.
llvm-svn: 83123
2009-09-30 00:14:40 +00:00
Chris Lattner 07fc26d63c the pointer MMI keeps will start out with object-file format specific stuff
llvm-svn: 82012
2009-09-16 05:26:00 +00:00
Chris Lattner f2471ec967 add hooks to hang target-specific goop off MachineModuleInfo,
move MachineFunctionInfo virtual method out of line to give it
a home.

llvm-svn: 81940
2009-09-15 22:44:26 +00:00
Eric Christopher 9233565a0a Rework getPersonalityIndex slightly - 0 is now a valid and not-NULL
personality function.

llvm-svn: 80153
2009-08-26 21:44:57 +00:00
Eric Christopher a258c62ea1 If we're emitting additional CIEs due to personality functions
don't emit the default one. Explicitly check for the NULL
CIE later.

llvm-svn: 80146
2009-08-26 21:30:49 +00:00
Eric Christopher c2645717ca Nuke trailing whitespace.
llvm-svn: 80145
2009-08-26 21:27:09 +00:00
Chris Lattner 471ba48cb9 remove some uses of llvm/Support/Streams.h
llvm-svn: 79842
2009-08-23 08:43:55 +00:00
Dan Gohman 0402315d41 Use setPreservesAll and setPreservesCFG in CodeGen passes.
llvm-svn: 77754
2009-07-31 23:37:33 +00:00
Chris Lattner 58f9bb2ccd implement a new magic global "llvm.compiler.used" which is like llvm.used, but
doesn't cause ".no_dead_strip" to be emitted on darwin.

llvm-svn: 76399
2009-07-20 06:14:25 +00:00
Chris Lattner 029380fad7 use stripPointerCasts to simplify some code.
llvm-svn: 76397
2009-07-20 06:05:50 +00:00
Torok Edwin fbcc663cbf llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").

llvm-svn: 75640
2009-07-14 16:55:14 +00:00
Torok Edwin 56d0659726 assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.

llvm-svn: 75379
2009-07-11 20:10:48 +00:00
Devang Patel 61b35cd15e DebugLabelFolder ruthlessly deletes redundant labels. However, sometimes the redundant labels is referenced by debug info somewhere else. This patch provies a way so that dwarf writer can mark labels as used.
llvm-svn: 68813
2009-04-10 18:58:59 +00:00
Devang Patel 9c7c0db37a Remove dead code.
llvm-svn: 63653
2009-02-03 19:46:28 +00:00
Duncan Sands 5a913d61e3 Rename getAnalysisToUpdate to getAnalysisIfAvailable.
llvm-svn: 63198
2009-01-28 13:14:17 +00:00
Devang Patel 3c82aa0209 Removoe MachineModuleInfo methods (and related DebugInfoDesc class hierarchy) that were used to handle debug info.
llvm-svn: 62199
2009-01-13 23:54:55 +00:00
Devang Patel 7b13aeedea Keep "has debug info" big in MachineModuleInfo to avoid circular dependency between AsmPrinter and CodeGen.
llvm-svn: 62191
2009-01-13 23:02:17 +00:00
Evan Cheng 288fbd2133 Fix a couple of Dwarf bugs.
- Emit DW_AT_byte_size for struct and union of size zero.
- Emit DW_AT_declaration for forward type declaration.

llvm-svn: 60812
2008-12-10 00:15:44 +00:00
Chris Lattner bc09b36016 Fix an over aggressive assumption that struct decls will have a pointer to
an array that is empty.  Instead of requiring this array, allow a null pointer.
This shrinks all forward references of structs.

llvm-svn: 58959
2008-11-10 03:48:55 +00:00
Dan Gohman 6613991eae Move the include of MachineLocation.h into MachineModuleInfo.h
because it declares a std::vector<MachineMove>, and strict
concept checking requires the definition of MachineMove to be
available.

llvm-svn: 57617
2008-10-16 00:20:14 +00:00
Evan Cheng 962c2cf17a Instead of setPreservesAll, just mark them preseving machine loop info and machine dominators.
llvm-svn: 56475
2008-09-22 22:21:38 +00:00
Evan Cheng 168f8f3916 Mark several codegen passes as preserving all analysis.
llvm-svn: 56469
2008-09-22 20:58:04 +00:00
Dan Gohman a79db30d28 Tidy up several unbeseeming casts from pointer to intptr_t.
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Bill Wendling 88d2506ae2 Make the DICountVisitor not a visitor. This keeps us from calling virtual
functions and junk.

llvm-svn: 53279
2008-07-09 06:02:33 +00:00
Bill Wendling b46e5165bf Use the canonical way to get an empty structure.
llvm-svn: 53206
2008-07-07 21:41:57 +00:00
Bill Wendling 1214860a78 Use StringMap for greater justice!
llvm-svn: 53202
2008-07-07 20:59:31 +00:00
Bill Wendling 4bb9089db7 Don't return std::vector by value, but pass it in by reference to be filled.
llvm-svn: 53123
2008-07-03 23:13:02 +00:00
Bill Wendling 2e50689435 Revert my previous check-in that split up MachineModuleInfo. It turns out to
slow the compiler down at -O0 some 30% or more. Ooops.

llvm-svn: 53120
2008-07-03 22:53:42 +00:00