function terminators

Hi All,
Does llvm provide a way to determine instructions that cause control to
leave functions? For example, return statements and exit statements cause
control exit out of function. I am looking for something similar to basic block
terminators. Thanks.

George

Hi George,

   Does llvm provide a way to determine instructions that cause control to
leave functions? For example, return statements and exit statements cause
control exit out of function.

there is no "exit" statement.

  I am looking for something similar to basic block

terminators. Thanks.

Control can leave a function either (1) due to a return instruction
(ReturnInst); or (2) due to a function call (CallInst or InvokeInst).
A function call can return normally, unwind an exception or never
return (eg: infinite loop or causing the program to exit).

Ciao, Duncan.

Hi George,

    Does llvm provide a way to determine instructions that cause control to
leave functions? For example, return statements and exit statements cause
control exit out of function.

there is no "exit" statement.

   I am looking for something similar to basic block

terminators. Thanks.

Control can leave a function either (1) due to a return instruction
(ReturnInst); or (2) due to a function call (CallInst or InvokeInst).
A function call can return normally, unwind an exception or never
return (eg: infinite loop or causing the program to exit).

To add to what Duncan said, there is also the unwind instruction (which is similar to the ReturnInst). The exception handling intrinsics may also cause control to leave a function, but I haven't looked at them and, therefore, do not know for certain.

The Language Reference Manual (http://llvm.org/docs/LangRef.html) may be of help.

-- John T.

Hi John,

     Does llvm provide a way to determine instructions that cause control to
leave functions? For example, return statements and exit statements cause
control exit out of function.

there is no "exit" statement.

    I am looking for something similar to basic block

terminators. Thanks.

Control can leave a function either (1) due to a return instruction
(ReturnInst); or (2) due to a function call (CallInst or InvokeInst).
A function call can return normally, unwind an exception or never
return (eg: infinite loop or causing the program to exit).

To add to what Duncan said, there is also the unwind instruction (which
is similar to the ReturnInst).

yes, I forgot about the unwind instruction.

   The exception handling intrinsics may

also cause control to leave a function,

they don't.

Ciao, Duncan.

  but I haven't looked at them