This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] Removal of gotos from cfg based ir


> > In LLVM, all control flow (for both normal and exceptional control) is
> > represented explicitly in the program.  For example, "fall-through" edges
> > are explicit gotos, which are eliminated during code generation.  This

> Interesting.  How do you deal with the exception handling edges?
> Does call having EH edge become somthing like call+goto combo?

Exactly right.  As an example:

void test() {
  A x;  // has ctor/dtor
  mightthrow();
  ...

}

Would be represented as:

void %test() {
  %x = alloca %A
  call void %A::A(%A* %x)   // construct A
  invoke void %mightthrow() to %normal except %exceptionthrown

normal:
  ...

exceptionthrown:
  call void %A::~A(%A* %x)  // destruct A
  unwind
}

The LLVM EH constructs are described in more detail in this paper:
http://llvm.cs.uiuc.edu/pubs/2003-09-30-LifelongOptimizationTR.html

Note that this makes spliting exception edges and other CFG work both
completely trivial, and uniform with the rest of the representation.

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]