Permalink
Fetching contributors…
Cannot retrieve contributors at this time
418 lines (279 sloc) 13.5 KB

Gimple statements

:py:class:`gcc.Gimple` has various subclasses, each corresponding to the one of the kinds of statement within GCC's internal representation.

The following subclasses have been wrapped for use from Python scripts:

Subclass Meaning
:py:class:`gcc.GimpleAsm` One or more inline assembly statements
:py:class:`gcc.GimpleAssign`

An assignment of an expression to an l-value:

LHS = RHS1 EXPRCODE RHS2;
:py:class:`gcc.GimpleCall`

A function call:

[ LHS = ] FN(ARG1, ..., ARGN);
:py:class:`gcc.GimpleCond`

A conditional jump, of the form:

if (LHS EXPRCODE RHS) goto TRUE_LABEL else goto FALSE_LABEL;
:py:class:`gcc.GimpleLabel`

A label statement (jump target):

LABEL:
:py:class:`gcc.GimpleNop` The "do nothing" statement
:py:class:`gcc.GimplePhi`

Used in the SSA passes:

LHS = PHI <ARG1, ..., ARGN>;
:py:class:`gcc.GimpleReturn`

A "return" statement:

RETURN [RETVAL];
:py:class:`gcc.GimpleSwitch`

A switch statement:

switch (INDEXVAR)
{
  case LAB1: ...; break;
  ...
  case LABN: ...; break;
  default: ...
}

There are some additional subclasses that have not yet been fully wrapped by the Python plugin (email the gcc-python-plugin's mailing list if you're interested in working with these):

Subclass Meaning
:py:class:`gcc.GimpleBind` A lexical scope
:py:class:`gcc.GimpleCatch` An exception handler
:py:class:`gcc.GimpleDebug` A debug statement
:py:class:`gcc.GimpleEhDispatch` Used in exception-handling
:py:class:`gcc.GimpleEhFilter` Used in exception-handling
:py:class:`gcc.GimpleEhMustNotThrow` Used in exception-handling
:py:class:`gcc.GimpleErrorMark` A dummy statement used for handling internal errors
:py:class:`gcc.GimpleGoto` An unconditional jump
:py:class:`gcc.GimpleOmpAtomicLoad` Used for implementing OpenMP
:py:class:`gcc.GimpleOmpAtomicStore` (ditto)
:py:class:`gcc.GimpleOmpContinue` (ditto)
:py:class:`gcc.GimpleOmpCritical` (ditto)
:py:class:`gcc.GimpleOmpFor` (ditto)
:py:class:`gcc.GimpleOmpMaster` (ditto)
:py:class:`gcc.GimpleOmpOrdered` (ditto)
:py:class:`gcc.GimpleOmpParallel` (ditto)
:py:class:`gcc.GimpleOmpReturn` (ditto)
:py:class:`gcc.GimpleOmpSection` (ditto)
:py:class:`gcc.GimpleOmpSections` (ditto)
:py:class:`gcc.GimpleOmpSectionsSwitch` (ditto)
:py:class:`gcc.GimpleOmpSingle` (ditto)
:py:class:`gcc.GimpleOmpTask` (ditto)
:py:class:`gcc.GimplePredict` A hint for branch prediction
:py:class:`gcc.GimpleResx` Resumes execution after an exception
:py:class:`gcc.GimpleTry` A try/catch or try/finally statement
:py:class:`gcc.GimpleWithCleanupExpr` Internally used when generating GIMPLE