1#ifndef ROSE_BinaryAnalysis_Partitioner2_DataFlow_H
2#define ROSE_BinaryAnalysis_Partitioner2_DataFlow_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5#include <Rose/BinaryAnalysis/Partitioner2/BasicTypes.h>
6#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics/BasicTypes.h>
8#include <Rose/BinaryAnalysis/DataFlow.h>
9#include <Rose/BinaryAnalysis/Variables.h>
10#include <Sawyer/Graph.h>
16namespace BinaryAnalysis {
17namespace Partitioner2 {
94 void print(std::ostream&)
const;
133 virtual bool operator()(
const ControlFlowGraph&,
const ControlFlowGraph::ConstEdgeIterator&,
size_t depth) = 0;
139 bool operator()(
const ControlFlowGraph&,
const ControlFlowGraph::ConstEdgeIterator&,
size_t )
override {
179 ASSERT_require(retval == dfCfg.
vertices().end());
201 bool ignoringSemanticFailures_;
Basic merge operation for instruction semantics.
CFG vertex for data-flow analysis.
DfCfgVertex(const BasicBlockPtr &, const FunctionPtr &parentFunction, size_t inliningId)
Construct a basic block vertex.
std::string toString() const
Single-line description of this vertex.
void print(std::ostream &) const
Print a short description of this vertex.
Sawyer::Optional< rose_addr_t > address() const
Virtual address of vertex.
DfCfgVertex(Type type, const FunctionPtr &parentFunction, size_t inliningId)
Construct a vertex of specified type that takes no auxiliary data.
FunctionPtr parentFunction() const
Function owning this vertex.
Type type() const
Type of the vertex.
size_t inliningId() const
Inlining invocation number.
DfCfgVertex(const FunctionPtr &function, const FunctionPtr &parentFunction, size_t inliningId)
Construct a faked call vertex.
@ FAKED_CALL
Represents a whole called function.
@ FUNCRET
Vertex represents returning to the caller.
@ INDET
Indeterminate basic block where no information is available.
@ BBLOCK
Vertex represents a basic block.
const FunctionPtr & callee() const
Function represented by faked call.
const BasicBlockPtr & bblock() const
Basic block.
Predicate that decides when to use inter-procedural data-flow.
Predicate that always returns false, preventing interprocedural analysis.
Data-Flow transfer functor.
void ignoringSemanticFailures(bool)
Property: Whether to ignore instructions with unknown semantics.
InstructionSemantics::BaseSemantics::DispatcherPtr cpu() const
Property: Virtual CPU.
bool ignoringSemanticFailures() const
Property: Whether to ignore instructions with unknown semantics.
TransferFunction(const InstructionSemantics::BaseSemantics::DispatcherPtr &)
Construct from a CPU.
void defaultCallingConvention(const CallingConvention::DefinitionPtr &)
Property: Default calling convention.
InstructionSemantics::BaseSemantics::StatePtr initialState() const
Construct an initial state.
CallingConvention::DefinitionPtr defaultCallingConvention() const
Property: Default calling convention.
Describes (part of) a physical CPU register.
Graph containing user-defined vertices and edges.
boost::iterator_range< VertexIterator > vertices()
Iterators for all vertices.
Holds a value or nothing.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
boost::shared_ptr< Dispatcher > DispatcherPtr
Shared-ownership pointer to a semantics instruction dispatcher.
boost::shared_ptr< State > StatePtr
Shared-ownership pointer to a semantic state.
std::vector< SgAsmInstruction * > vertexUnpacker(const DfCfgVertex &)
Unpacks a vertex into a list of instructions.
FunctionPtr bestSummaryFunction(const FunctionSet &functions)
Choose best function for data-flow summary vertex.
Variables::StackVariables findFunctionArguments(const FunctionPtr &function, const InstructionSemantics::BaseSemantics::RiscOperatorsPtr &ops, const InstructionSemantics::BaseSemantics::SValuePtr &initialStackPointer)
Returns the list of all known function arguments.
Variables::StackVariables findStackVariables(const FunctionPtr &function, const InstructionSemantics::BaseSemantics::RiscOperatorsPtr &ops, const InstructionSemantics::BaseSemantics::SValuePtr &initialStackPointer)
Returns the list of all known stack variables.
Rose::BinaryAnalysis::DataFlow::SemanticsMerge MergeFunction
Data-flow merge function.
Sawyer::Container::Graph< DfCfgVertex > DfCfg
Control flow graph used by data-flow analysis.
std::vector< AbstractLocation > findGlobalVariables(const InstructionSemantics::BaseSemantics::RiscOperatorsPtr &ops, size_t wordNBytes)
Returns a list of global variables.
Sawyer::Container::GraphTraits< DfCfg >::VertexIterator findReturnVertex(DfCfg &dfCfg)
Find the return vertex.
DfCfg buildDfCfg(const PartitionerConstPtr &, const ControlFlowGraph &, const ControlFlowGraph::ConstVertexIterator &startVertex, InterproceduralPredicate &predicate=NOT_INTERPROCEDURAL)
build a cfg useful for data-flow analysis.
Variables::StackVariables findLocalVariables(const FunctionPtr &function, const InstructionSemantics::BaseSemantics::RiscOperatorsPtr &ops, const InstructionSemantics::BaseSemantics::SValuePtr &initialStackPointer)
Returns the list of all known local variables.
void dumpDfCfg(std::ostream &, const DfCfg &)
Emit a data-flow CFG as a GraphViz file.
Container classes that store user-defined values.
G::VertexIterator VertexIterator
Const or non-const vertex iterator.