ROSE 0.11.145.192
|
Binary inliner.
This binary inliner builds a new CFG (called here the paths graph) from a master CFG. The paths graph initially contains some vertices that correspond to a function call site in the master CFG, and this inliner will copy part of the master CFG corresponding to the called function into the paths graph.
When a function is copied from the master CFG to the paths graph, only those edges in the called function that participate in some path from the entry vertex to a returning vertex are copied. Usually a call site will call a single function, but an indirect call (e.g., x86 call eax
) could have calls to multiple functions, and/or the special indeterminate vertex (e.g., depending on whether anything is known about eax
in call eax
). Once all the functions called from a call site are inlined, the E_CALL_RETURN edge is removed from that vertex.
The inliner has an optional list of blacklisted vertices and edges. These vertices and edges cannot appear in any path.
A user-defined predicate determines whether a function call should be inlined or skipped.
#include <Rose/BinaryAnalysis/Partitioner2/CfgPath.h>
Classes | |
class | ShouldInline |
Predicate to determine whether inlining should be performed. More... | |
Public Types | |
enum | HowInline { INLINE_NONE , INLINE_NORMAL , INLINE_USER } |
What action to take for inlining. More... | |
Public Member Functions | |
Inliner () | |
Default constructor. | |
void | inlinePaths (const PartitionerConstPtr &partitioner, const CfgConstVertexSet &cfgBeginVertices, const CfgConstVertexSet &cfgEndVertices, const CfgConstVertexSet &cfgAvoidVertices, const CfgConstEdgeSet &cfgAvoidEdges) |
Construct a CFG with inlined functions. | |
const ControlFlowGraph & | paths () const |
Resulting paths graph. | |
const CfgConstVertexSet & | pathsBeginVertices () const |
Paths begin vertices. | |
const CfgConstVertexSet & | pathsEndVertices () const |
Paths end vertices. | |
ShouldInline::Ptr | shouldInline () const |
Property: inline predicate. | |
void | shouldInline (const ShouldInline::Ptr &p) |
Property: inline predicate. | |
What action to take for inlining.
Enumerator | |
---|---|
INLINE_NONE | Do not inline anything for this call. |
INLINE_NORMAL | Normal inlining for this call. |
INLINE_USER | Add a V_USER_DEFINED vertex for this call. |
|
inline |
|
inline |
|
inline |
void Rose::BinaryAnalysis::Partitioner2::Inliner::inlinePaths | ( | const PartitionerConstPtr & | partitioner, |
const CfgConstVertexSet & | cfgBeginVertices, | ||
const CfgConstVertexSet & | cfgEndVertices, | ||
const CfgConstVertexSet & | cfgAvoidVertices, | ||
const CfgConstEdgeSet & | cfgAvoidEdges | ||
) |
Construct a CFG with inlined functions.
Computes paths in the partitioner's global CFG from cfgBeginVertices
to cfgEndVertices
that do not pass through cfgAvoidVertices
or cfgAvoidEdges
. Any function calls along these paths are then inlined, but only those paths through the function that don't pass through the cfgAvoidVertices
or cfgAvoidEdges
. The return value of the shouldInline property callback determines whether a function is inlined or summarized.
Returns the resulting control flow graph, a.k.a., the paths graph.
|
inline |
|
inline |
Paths begin vertices.
This is the set of vertices corresponding to the cfgBeginVertices
of the inlinePaths function. Only those CFG vertices that are part of a path are in this set.
|
inline |
Paths end vertices.
This is the set of vertices corresponding to the cfgEndVertices
of the inlinePaths function. Only those CFG vertices that are part of a path are in this set.