1#ifndef ROSE_BinaryAnalysis_NoOperation_H
2#define ROSE_BinaryAnalysis_NoOperation_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
6#include <Rose/BinaryAnalysis/Disassembler/BasicTypes.h>
7#include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics.h>
8#include <Sawyer/Message.h>
11namespace BinaryAnalysis {
25 size_t ignorePoppedMemory_;
64 bool ignoreTerminalBranches_ =
true;
124 bool isNoop(
const std::vector<SgAsmInstruction*>&)
const;
Base class for normalizing a state.
virtual InstructionSemantics::BaseSemantics::StatePtr initialState(const InstructionSemantics::BaseSemantics::DispatcherPtr &, SgAsmInstruction *firstInsn)
Constructs an initial state.
static Ptr instance()
Allocating constructor.
Sawyer::SharedPointer< StateNormalizer > Ptr
Shared ownership pointer to a NoOperation::StateNormalizer.
virtual std::string toString(const InstructionSemantics::BaseSemantics::DispatcherPtr &, const InstructionSemantics::BaseSemantics::StatePtr &)
Takes a state and returns a normalized string.
size_t ignorePoppedMemory() const
Property: ignore recently popped memory.
void ignorePoppedMemory(size_t nbytes)
Property: ignore recently popped memory.
Analysis that looks for no-op equivalents.
NoOperation(const InstructionSemantics::BaseSemantics::DispatcherPtr &cpu)
Construct a new analysis with specified virtual CPU.
bool isNoop(SgAsmInstruction *) const
Determines if an instruction is a no-op.
Sawyer::Container::Interval< size_t > IndexInterval
An interval of instruction indices.
bool ignoreTerminalBranches() const
Property: Whether terminal branches can be no-ops.
IndexIntervals findNoopSubsequences(const std::vector< SgAsmInstruction * > &) const
Finds all sequences of instructions that are equivalent to no-operation.
void ignoreTerminalBranches(bool b)
Property: Whether terminal branches can be no-ops.
const Sawyer::Optional< rose_addr_t > initialStackPointer() const
Property: initial concrete value for stack pointer.
std::vector< IndexInterval > IndexIntervals
A vector of instruction indices.
static IndexIntervals largestEarliestNonOverlapping(const IndexIntervals &)
Select certain no-op sequences.
static void initDiagnostics()
Initializes and registers disassembler diagnostic streams.
NoOperation()
Default constructor.
bool isNoop(const std::vector< SgAsmInstruction * > &) const
Determines if a sequence of instructions is a no-op.
NoOperation(const BinaryAnalysis::Disassembler::BasePtr &)
Construct a new analysis for a specific disassembler.
void initialStackPointer(const Sawyer::Optional< rose_addr_t > &v)
Property: initial concrete value for stack pointer.
StateNormalizer::Ptr stateNormalizer() const
Property: state normalizer.
static std::vector< bool > toVector(const IndexIntervals &, size_t size=0)
Return a boolean vector.
static Sawyer::Message::Facility mlog
Diagnostic streams.
void stateNormalizer(const StateNormalizer::Ptr &f)
Property: state normalizer.
Range of values delimited by endpoints.
Holds a value or nothing.
Base class for reference counted objects.
Reference-counting intrusive smart pointer.
Base class for machine instructions.
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.