Struct falcon::il::ControlFlowGraph[][src]

pub struct ControlFlowGraph { /* fields omitted */ }

A directed graph of types Block and Edge.

Entry and Exit

A ControlFlowGraph has an optional, "Entry," and an optional, "Exit." When these are provided, certain convenience functions become available.

For example, when translating a native instruction to Falcon IL, it can be useful to consider an instruction as its own ControlFlowGraph. rep scasb is a great example of when this pattern is helpful. Instructions in a Block will have one entry, and one exit. Explicitly declaring these makes merging ControlFlowGraphs easier.

Methods

impl ControlFlowGraph
[src]

Returns the underlying graph

Sets the entry point for this ControlFlowGraph to the given Block index.

Sets the exit point for this ControlFlowGraph to the given Block index.

Get the entry Block index for this ControlFlowGraph.

Get the exit Block index for this ControlFlowGraph.

Get a Block by index.

Get a mutable reference to a Block by index.

Get every Block in this ControlFlowGraph.

Get a mutable reference to every Block in this ControlFlowGraph.

Get an Edge by its head and tail Block indices.

Get a mutable reference to an Edge by its head and tail Block indices.

Get every Edge in thie ControlFlowGraph.

Get a mutable reference to every Edge in this ControlFlowGraph.

Get every incoming edge to a block

Get every outgoing edge from a block

Sets the address for all instructions in this ControlFlowGraph.

Useful for translators to set address information.

Returns the entry block for this ControlFlowGraph

Generates a temporary scalar unique to this control flow graph.

Creates a new basic block, adds it to the graph, and returns it

Creates an unconditional edge from one block to another block

Creates a conditional edge from one block to another block

Merge Blocks.

When a Block as only one successor, and that successor has only one predecessor, we merge both into one Block.

Appends a control flow graph to this control flow graph.

In order for this to work, the entry and exit of boths graphs must be set, which should be the case for all conformant translators. You can also append to an empty ControlFlowGraph.

Inserts a control flow graph into this control flow graph, and returns the entry and exit indices for inserted graph.

Requires the graph being inserted to have entry set.

This function causes the ControlFlowGraph to become disconnected.

This function is useful for inserting multiple ControlFlowGraphs into one before adding all Edges in a subsequent pass.

Warnings

This invalidates the entry and exit of the control flow graph.

Trait Implementations

impl Clone for ControlFlowGraph
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for ControlFlowGraph
[src]

Formats the value using the given formatter. Read more

impl Hash for ControlFlowGraph
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl Eq for ControlFlowGraph
[src]

impl PartialEq for ControlFlowGraph
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Display for ControlFlowGraph
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations