libFirm

Data Structures

union  loop_element
 Loop elements: loop nodes and ir nodes. More...
 

Typedefs

typedef struct ir_loop ir_loop
 Loop. More...
 

Functions

int is_backedge (const ir_node *n, int pos)
 Returns non-zero if the predecessor pos is a backedge. More...
 
void set_backedge (ir_node *n, int pos)
 Marks edge pos as a backedge. More...
 
int has_backedges (const ir_node *n)
 Returns non-zero if n has backedges. More...
 
void clear_backedges (ir_node *n)
 Clears all backedge information. More...
 
void set_irg_loop (ir_graph *irg, ir_loop *l)
 Sets the outermost loop in ir graph as basic access to loop tree. More...
 
ir_loopget_irg_loop (const ir_graph *irg)
 Returns the root loop info (if exists) for an irg. More...
 
ir_loopget_irn_loop (const ir_node *n)
 Returns the loop n is contained in. More...
 
ir_loopget_loop_outer_loop (const ir_loop *loop)
 Returns outer loop, itself if outermost. More...
 
unsigned get_loop_depth (const ir_loop *loop)
 Returns nesting depth of this loop. More...
 
size_t get_loop_n_elements (const ir_loop *loop)
 Returns the number of elements contained in loop. More...
 
loop_element get_loop_element (const ir_loop *loop, size_t pos)
 Returns a loop element. More...
 
long get_loop_loop_nr (const ir_loop *loop)
 Returns a unique node number for the loop node to make output readable. More...
 
void set_loop_link (ir_loop *loop, void *link)
 A field to connect additional information to a loop. More...
 
void * get_loop_link (const ir_loop *loop)
 Returns field with additional loop information. More...
 
void construct_cf_backedges (ir_graph *irg)
 Construct Intra-procedural control flow loop tree for a IR-graph. More...
 
void assure_loopinfo (ir_graph *irg)
 Computes Intra-procedural control flow loop tree on demand. More...
 
void free_loop_information (ir_graph *irg)
 Removes all loop information. More...
 
int is_loop_invariant (const ir_node *n, const ir_node *block)
 Tests whether a value is loop invariant. More...
 

Detailed Description


Data Structure Documentation

union loop_element

Loop elements: loop nodes and ir nodes.

Definition at line 42 of file irloop.h.

Data Fields
ir_graph * irg Pointer to an ir_graph element (only callgraph loop trees)
firm_kind * kind is either k_ir_node or k_ir_loop
ir_node * node Pointer to an ir_node element.
ir_loop * son Pointer to an ir_loop element.

Typedef Documentation

typedef struct ir_loop ir_loop

Loop.

Definition at line 80 of file firm_types.h.

Function Documentation

void assure_loopinfo ( ir_graph irg)

Computes Intra-procedural control flow loop tree on demand.

Parameters
irgthe graph
void clear_backedges ( ir_node n)

Clears all backedge information.

void construct_cf_backedges ( ir_graph irg)

Construct Intra-procedural control flow loop tree for a IR-graph.

This constructs loop information resembling the program structure. It is useful for loop optimizations and analyses, as, e.g., finding iteration variables or loop invariant code motion.

This algorithm computes only back edge information for Block nodes, not for Phi nodes.

This algorithm destroyes the link field of block nodes.

Parameters
irgthe graph
void free_loop_information ( ir_graph irg)

Removes all loop information.

Resets all backedges. Works for any construction algorithm.

ir_loop* get_irg_loop ( const ir_graph irg)

Returns the root loop info (if exists) for an irg.

ir_loop* get_irn_loop ( const ir_node n)

Returns the loop n is contained in.

NULL if node is in no loop.

unsigned get_loop_depth ( const ir_loop loop)

Returns nesting depth of this loop.

loop_element get_loop_element ( const ir_loop loop,
size_t  pos 
)

Returns a loop element.

A loop element can be interpreted as a kind pointer, an ir_node* or an ir_loop*.

void* get_loop_link ( const ir_loop loop)

Returns field with additional loop information.

See also
set_loop_link()
long get_loop_loop_nr ( const ir_loop loop)

Returns a unique node number for the loop node to make output readable.

If libfirm_debug is not set it returns the loop cast to int.

size_t get_loop_n_elements ( const ir_loop loop)

Returns the number of elements contained in loop.

ir_loop* get_loop_outer_loop ( const ir_loop loop)

Returns outer loop, itself if outermost.

int has_backedges ( const ir_node n)

Returns non-zero if n has backedges.

int is_backedge ( const ir_node n,
int  pos 
)

Returns non-zero if the predecessor pos is a backedge.

int is_loop_invariant ( const ir_node n,
const ir_node block 
)

Tests whether a value is loop invariant.

Parameters
nThe node to be tested.
blockA block node.

Returns non-zero, if the node n is not changed in the loop block belongs to or in inner loops of this block.

void set_backedge ( ir_node n,
int  pos 
)

Marks edge pos as a backedge.

void set_irg_loop ( ir_graph irg,
ir_loop l 
)

Sets the outermost loop in ir graph as basic access to loop tree.

void set_loop_link ( ir_loop loop,
void *  link 
)

A field to connect additional information to a loop.