1#ifndef ROSE_BinaryAnalysis_CallingConvention_Definition_H
2#define ROSE_BinaryAnalysis_CallingConvention_Definition_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5#include <Rose/BinaryAnalysis/CallingConvention/BasicTypes.h>
7#include <Rose/BinaryAnalysis/Architecture/BasicTypes.h>
8#include <Rose/BinaryAnalysis/Alignment.h>
9#include <Rose/BinaryAnalysis/ByteOrder.h>
10#include <Rose/BinaryAnalysis/ConcreteLocation.h>
11#include <Rose/BinaryAnalysis/RegisterDescriptor.h>
13#include <Sawyer/Optional.h>
15#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
16#include <boost/serialization/access.hpp>
24namespace BinaryAnalysis {
25namespace CallingConvention {
44 std::weak_ptr<const Architecture::Base> architecture_;
47 std::vector<ConcreteLocation> nonParameterInputs_;
48 std::vector<ConcreteLocation> inputParameters_;
49 std::vector<ConcreteLocation> outputParameters_;
52 size_t nonParameterStackSize_ = 0;
57 std::set<RegisterDescriptor> calleeSavedRegisters_;
58 std::set<RegisterDescriptor> scratchRegisters_;
69#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
70 friend class boost::serialization::access;
71 template<
class S>
void serialize(S&,
unsigned);
114 const std::string&
name()
const {
return name_; }
115 void name(
const std::string &s) { name_ = s; }
125 const std::string&
comment()
const {
return comment_; }
126 void comment(
const std::string &s) { comment_ = s; }
155 nonParameterInputs_.clear();
165 const std::vector<ConcreteLocation>&
inputParameters()
const {
return inputParameters_; }
201 const std::vector<ConcreteLocation>&
outputParameters()
const {
return outputParameters_; }
267 return nonParameterStackSize_;
270 nonParameterStackSize_ = nBytes;
Information about alignments.
Information about calling conventions.
void stackCleanup(StackCleanup x)
Property: Who pops stack parameters.
RegisterParts calleeSavedRegisterParts() const
Compute the set of callee-saved registers.
RegisterParts scratchRegisterParts() const
Computes the set of scratch registers.
size_t bitsPerWord() const
Property: Word size in bits.
void thisParameter(RegisterDescriptor reg)
Property: Object pointer parameter.
void stackAlignment(const Alignment &)
Property: Stack alignment.
void thisParameter(RegisterDescriptor reg, int64_t offset)
Property: Object pointer parameter.
StackParameterOrder stackParameterOrder() const
Property: Stack parameter order.
const std::vector< ConcreteLocation > & outputParameters() const
Property: List of output parameters.
RegisterParts outputRegisterParts() const
Computes the set of output registers.
std::vector< ConcreteLocation > & nonParameterInputs()
Non-parameter inputs.
~Definition()
Property: Architecture with which this definition is associated.
void stackParameterOrder(StackParameterOrder x)
Property: Stack parameter order.
const std::set< RegisterDescriptor > & scratchRegisters() const
Property: Scratch registers.
const std::set< RegisterDescriptor > & calleeSavedRegisters() const
Property: Callee-saved registers.
void clearInputParameters()
Erase enumerated input parameters.
ByteOrder::Endianness byteOrder() const
Property: Order of bytes for multi-byte values in memory.
Definition()
Default constructor.
void instructionPointerRegister(RegisterDescriptor x)
Property: Register that points to next instruction to execute.
Definition(const std::string &name, const std::string &comment, const Architecture::BaseConstPtr &)
Property: Architecture with which this definition is associated.
const std::string & name() const
Property: Short name of calling convention.
void name(const std::string &s)
Property: Architecture with which this definition is associated.
void clearParameters()
Erase all parameters.
void appendOutputParameter(RegisterDescriptor reg, int64_t offset)
Append output parameter.
std::set< RegisterDescriptor > & scratchRegisters()
Property: Scratch registers.
RegisterDescriptor instructionPointerRegister() const
Property: Register that points to next instruction to execute.
RegisterDictionaryPtr registerDictionary() const
Property: Register dictionary for the architecture.
void appendInputParameter(RegisterDescriptor reg, int64_t offset)
Append input parameter.
const Alignment & stackAlignment() const
Property: Stack alignment.
void print(std::ostream &, const RegisterDictionaryPtr ®Dict) const
Print detailed information about this calling convention.
void clearOutputParameters()
Erase output parameters.
const std::string & comment() const
Property: Full name of calling convention.
const std::vector< ConcreteLocation > & inputParameters() const
Property: Enumerated input parameters.
const ConcreteLocation & thisParameter() const
Property: Object pointer parameter.
size_t nonParameterStackSize() const
Property: Size of non-parameter stack area.
void stackDirection(StackDirection x)
Property: Direction that stack grows for a push operation.
void print(std::ostream &) const
Print detailed information about this calling convention.
void stackPointerRegister(RegisterDescriptor)
Property: Register for implied stack parameters.
void argumentValueAllocator(const AllocatorPtr &)
Property: Allocator for argument values.
Architecture::BaseConstPtr architecture() const
Property: Architecture with which this definition is associated.
const ConcreteLocation & returnAddressLocation() const
Property: Location of return address.
AllocatorPtr argumentValueAllocator() const
Property: Allocator for argument values.
std::set< RegisterDescriptor > & calleeSavedRegisters()
Property: Callee-saved registers.
RegisterDescriptor stackPointerRegister() const
Property: Register for implied stack parameters.
AllocatorPtr returnValueAllocator() const
Property: Allocator for return values.
void returnAddressLocation(const ConcreteLocation &x)
Property: Location of return address.
void comment(const std::string &s)
Property: Full name of calling convention.
RegisterParts getUsedRegisterParts() const
Returns all registers mentioned in this definition.
static Ptr instance(const std::string &name, const std::string &comment, const Architecture::BaseConstPtr &)
Allocating constructor.
void appendInputParameter(RegisterDescriptor reg)
Append input parameter.
StackDirection stackDirection() const
Property: Direction that stack grows for a push operation.
StackCleanup stackCleanup() const
Property: Who pops stack parameters.
void nonParameterStackSize(size_t nBytes)
Property: Size of non-parameter stack area.
void appendOutputParameter(rose_addr_t va)
Append output parameter.
void appendInputParameter(rose_addr_t va)
Append input parameter.
void appendInputParameter(const ConcreteLocation &)
Append input parameter.
void appendOutputParameter(const ConcreteLocation &)
Append output parameter.
void appendOutputParameter(RegisterDescriptor reg)
Append output parameter.
const std::vector< ConcreteLocation > & nonParameterInputs() const
Non-parameter inputs.
void thisParameter(rose_addr_t va)
Property: Object pointer parameter.
RegisterParts inputRegisterParts() const
Compute the set of input registers.
void returnValueAllocator(const AllocatorPtr &)
Property: Allocator for return values.
void thisParameter(const ConcreteLocation &x)
Property: Object pointer parameter.
void bitsPerWord(const Sawyer::Optional< size_t > &)
Property: Word size in bits.
Concrete location of data.
Describes (part of) a physical CPU register.
Holds a set of registers without regard for register boundaries.
Holds a value or nothing.
Base class for reference counted objects.
std::shared_ptr< const Base > BaseConstPtr
Reference counted pointer for Architecture::Base.
Sawyer::SharedPointer< Definition > DefinitionPtr
Shared-ownership pointer for Definition.
std::shared_ptr< Allocator > AllocatorPtr
Shared-ownership pointer to Allocator.
StackParameterOrder
The order that arguments are pushed onto the stack.
@ UNSPECIFIED
Stack parameter order is unknown or unspecified.
StackCleanup
Who is responsible for popping stack parameters.
@ UNSPECIFIED
Stack parameter cleanup is unknown or unspecified.
StackDirection
The direction in which the stack grows.
@ GROWS_DOWN
A push decrements the stack pointer.