RegionFlow.xcc

Benoit Dupont de Dinechin (Benoit.Dupont-de-Dinechin@st.com).

Copyright 2002 - 2007 STMicroelectronics. Copyright 1995 - 1998 Commissariat a l'Energie Atomique.

This program is free software; you can redistribute it and/or modify it under the terms of either (at your option): the GNU General Public License (GPL) version 2; the GNU Lesser General Public License (LGPL) version 2.1; any later version of these licences as published by the Free Software Foundation.

RegionFlow— Control-flow representation and optimization for a CodeRegion.
struct RegionFlow_ {
  //@args       Memory memory, CodeRegion codeRegion
  CodeRegion CODEREGION;
  //@access CONFIGURE   CodeRegion_configure(RegionFlow_CODEREGION(this))
  Procedure PROCEDURE;
  CFGraph_ CFGRAPH_;                    // The flow-graph of this RegionFlow.
  //@access CFGRAPH     RegionFlow__CFGRAPH_(this)
  //@access MEMORY      CFGraph_memory(RegionFlow_CFGRAPH(this))
  //@access NODECOUNT   CFGraph_NODECOUNT(RegionFlow_CFGRAPH(this))
  //@access ROOTNODE    CFGraph_ROOTNODE(RegionFlow_CFGRAPH(this))
  //@access SINKNODE    CFGraph_SINKNODE(RegionFlow_CFGRAPH(this))
  Hierarchy HIERARCHY;                  // NSCC Hierarchy
};
RegionFlow_memory— This RegionFlow Memory.
static inline Memory
RegionFlow_memory(RegionFlow this)
{
  return RegionFlow_MEMORY(this);
}
RegionFlow_codeRegion— This RegionFlow CodeRegion.
static inline CodeRegion
RegionFlow_codeRegion(RegionFlow this)
{
  return RegionFlow_CODEREGION(this);
}
RegionFlow_configure— This RegionFlow Configure.
static inline Configure
RegionFlow_configure(RegionFlow this)
{
  return RegionFlow_CONFIGURE(this);
}
RegionFlow_procedure— This RegionFlow Procedure.
static inline Procedure
RegionFlow_procedure(RegionFlow this)
{
  return RegionFlow_PROCEDURE(this);
}
RegionFlow_FOREACH_BasicBlock— Iterate this RegionFlow BasicBlocks.
#define RegionFlow_FOREACH_BasicBlock(this, basicBlock) \
  CodeRegion_FOREACH_BasicBlock(RegionFlow_codeRegion(this), basicBlock)
#define RegionFlow_ENDEACH_BasicBlock \
  CodeRegion_ENDEACH_BasicBlock;
RegionFlow_cfgraph— This RegionFlow CFGraph.
static inline CFGraph
RegionFlow_cfgraph(RegionFlow this)
{
  return RegionFlow_CFGRAPH(this);
}
RegionFlow_hierarchy— The NSCC Hierarchy of this RegionFlow.
static inline Hierarchy
RegionFlow_hierarchy(RegionFlow this)
{
  return RegionFlow_HIERARCHY(this);
}
RegionFlow_makeHierarchy— Make the NSCC Hierarchy of this RegionFlow.

As main side-effects, create the missing LoopScope(s) and sets the CFGNode flags. Also sets the LOOPSCOPE fields of BasicBlock(s).

Hierarchy
RegionFlow_makeHierarchy(RegionFlow this);
RegionFlow_killHierarchy— Kill the Hierarchy of this RegionFlow.

The Hierarchy object is deleted but the CFGNode(s) flags remain.

static inline void
RegionFlow_killHierarchy(RegionFlow this)
{
  *RegionFlow__HIERARCHY(this) = Hierarchy_delete(RegionFlow_HIERARCHY(this));
}
RegionFlow_reorderBasicBlocks— Reorder the BasicBlocks of this RegionFlow and reroute their branches accordingly.

Reordering of this RegionFlow BasicBlocks relies on the BasicBlock_traceId fields. When two fields have the same value the two BasicBlocks are assumed to have been in the same BlockTrace and no control-flow fixups are made. Otherwise the control-flow is checked for fall-through arcs and GOTOs are inverted or added if necessary.

void
RegionFlow_reorderBasicBlocks(RegionFlow this);
RegionFlow_finalize— Finalize this RegionFlow before destruction.

Transfer back to the BasicBlockEdge(s) the CFGArc information.

void
RegionFlow_finalize(RegionFlow this);
RegionFlow_pretty— Pretty-print this RegionFlow.
bool
RegionFlow_pretty(RegionFlow this, FILE *file);
RegionFlow_prettyVCG— Pretty-print this RegionFlow in VCG format.
bool
RegionFlow_prettyVCG(RegionFlow this, FILE *file);