llvm-mirror/include/llvm
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
..
ADT Add llvm::triple constructor from arch, vendor, os strings, and recognize 2009-05-22 02:24:11 +00:00
Analysis Fix broken logic in DominatorTreeBase::Split. Part of PR4238. 2009-05-21 21:47:54 +00:00
Assembly add a #include to improve portability to windows, as requested by 2009-03-09 05:10:08 +00:00
Bitcode give bitstreamreader an API to ignore names for blocks/records, 2009-04-27 20:04:08 +00:00
CodeGen Add a new codegen pass that normalizes dwarf exception handling 2009-05-22 20:36:31 +00:00
CompilerDriver -write-graph now can be used with -o. 2009-03-27 12:57:14 +00:00
Config Forgot this file in my last commit. 2009-05-19 22:25:55 +00:00
Debugger
ExecutionEngine Allow the JIT ExecutionEngine to report details about the generated machine code. 2009-05-18 21:06:40 +00:00
Support Add an accessor method to return the insertion point. 2009-05-20 21:45:41 +00:00
System Use DataTypes.h instead of stdint.h. 2009-05-21 00:48:13 +00:00
Target Run code placement optimization for targets that want it (arm and x86 for now). 2009-05-13 21:42:09 +00:00
Transforms Re-apply 70645, converting ScalarEvolution to use 2009-05-04 22:30:44 +00:00
AbstractTypeUser.h Another attempt at fixing PR2975. 2009-04-07 17:23:02 +00:00
Argument.h
Attributes.h
AutoUpgrade.h
BasicBlock.h Revert r67844. This fixes the llvm-gcc-4.2 build on Darwin. 2009-03-27 18:37:13 +00:00
CallGraphSCCPass.h
CallingConv.h
CMakeLists.txt CMake: Have generated Xcode projects also contain the LLVM header files. 2009-04-01 15:40:21 +00:00
Constant.h Clearify local/global relocations wording 2009-03-30 17:38:00 +00:00
Constants.h Add a getAlignOf helper for getting the ABI alignment of a 2009-05-21 15:52:21 +00:00
DerivedTypes.h 80-column violation. 2009-02-14 08:41:25 +00:00
Function.h Revert r67844. This fixes the llvm-gcc-4.2 build on Darwin. 2009-03-27 18:37:13 +00:00
GlobalAlias.h
GlobalValue.h Add a new "available_externally" linkage type. This is intended 2009-04-13 05:44:34 +00:00
GlobalVariable.h Factorize out a concept - no functionality change. 2009-03-21 21:27:31 +00:00
InlineAsm.h Model inline asm constraint which ties an input to an output register as machine operand TIED_TO constraint. This eliminated the need to pre-allocate registers for these. This also allows register allocator can eliminate the unneeded copies. 2009-03-23 08:01:15 +00:00
InstrTypes.h 80-column violations. 2009-02-09 17:11:05 +00:00
Instruction.def
Instruction.h Allow readonly functions to unwind exceptions. Teach 2009-05-06 06:49:50 +00:00
Instructions.h Remove getType() overrides for ExtractValueInst and InsertValueInst. 2009-05-18 18:46:57 +00:00
IntrinsicInst.h change the MemIntrinsic get/setAlignment method to take an unsigned 2009-03-08 03:59:00 +00:00
Intrinsics.h Added support to have TableGen provide information if an intrinsic (core 2009-02-24 23:17:49 +00:00
Intrinsics.td Update the names of the exception handling sjlj instrinsics to 2009-05-14 00:46:35 +00:00
IntrinsicsAlpha.td
IntrinsicsARM.td
IntrinsicsCellSPU.td
IntrinsicsPowerPC.td
IntrinsicsX86.td ADDS{D|S}rr_Int and MULS{D|S}rr_Int are not commutable. The users of these intrinsics expect the high bits will not be modified. 2009-02-26 03:12:02 +00:00
IntrinsicsXCore.td
LinkAllPasses.h Add a liveness analysis pass for LLVM IR values. This computes 2009-03-19 17:29:04 +00:00
LinkAllVMCore.h
Linker.h
MDNode.h Needed #includes. Thanks Fritz van Bommel! 2009-05-10 23:27:41 +00:00
Module.h "ghostify" the ilist<Function> sentinel 2009-03-27 22:28:33 +00:00
ModuleProvider.h
OperandTraits.h Give Op<N>() AppleScript-like semantics, i.e. for negative N it indexes relative to op_end. 2009-03-10 23:02:13 +00:00
Pass.h Remove dead code. 2009-04-01 21:27:08 +00:00
PassAnalysisSupport.h Clean up pass manager cache after each run. 2009-04-01 22:34:41 +00:00
PassManager.h
PassManagers.h Clean up pass manager cache after each run. 2009-04-01 22:34:41 +00:00
PassSupport.h remove a deprecated interface that was pretty useless 2009-03-02 12:42:07 +00:00
SymbolTableListTraits.h simplify the way how traits get hold of the symbol table 2009-03-07 12:33:24 +00:00
Type.h Add a new Type::getPointerTo method, which is shorthand for 2009-04-10 06:42:02 +00:00
TypeSymbolTable.h Fixed spelling. 2009-04-01 16:13:29 +00:00
Use.h Add a comment to refer to the section of the programmer's manual that explains what the pointer tagging in Use is for. 2009-04-30 23:28:50 +00:00
User.h Fix the Win32 VS2008 build: 2009-03-19 23:26:52 +00:00
Value.h Add support for embedded metadata to LLVM. This introduces two new types of 2009-04-04 07:22:01 +00:00
ValueSymbolTable.h