ROSE  0.9.9.109
Public Types | Public Member Functions | List of all members
Rose::BinaryAnalysis::CallingConvention::ParameterLocation Class Reference

Description

Abstract parameter location.

This class is used to describe the location of a parameter or return value location in a calling convention definition outside any analysis (locations resulting from an analysis often contain more information). The location can be a register, a memory location at a constant address (e.g., global variable), or a memory location relative to some register (e.g., on a stack). Location descriptors are immutable.

The same type is used for input parameters, output parameters, and in-out parameters. Return values are a kind of output parameter, although the API usually does not include the return value when it talks about "parameters".

Definition at line 83 of file BinaryCallingConvention.h.

#include <BinaryCallingConvention.h>

Public Types

enum  Type {
  NO_LOCATION,
  REGISTER,
  STACK,
  ABSOLUTE
}
 Type of location. More...
 

Public Member Functions

 ParameterLocation ()
 Default constructed no-location. More...
 
 ParameterLocation (RegisterDescriptor reg)
 Constructs a parameter in a register location. More...
 
 ParameterLocation (RegisterDescriptor reg, int64_t offset)
 Constructs a parameter at a register-relative memory address. More...
 
 ParameterLocation (rose_addr_t va)
 Constructs a parameter at a fixed memory address. More...
 
Type type () const
 Type of parameter location. More...
 
bool isValid () const
 Predicate to determine if location is valid. More...
 
RegisterDescriptor reg () const
 Register part of location. More...
 
int64_t offset () const
 Offset part of location. More...
 
rose_addr_t address () const
 Fixed address location. More...
 
bool operator== (const ParameterLocation &other) const
 Equality. More...
 
bool operator!= (const ParameterLocation &other) const
 Inequality. More...
 
void print (std::ostream &out, const RegisterDictionary *regdict) const
 Print location.
 
void print (std::ostream &out, const RegisterNames &regnames) const
 Print location.
 

Member Enumeration Documentation

Type of location.

Enumerator
NO_LOCATION 

Used by default-constructed locations.

REGISTER 

Parameter is in a register.

STACK 

Parameter in memory relative to a register.

E.g., stack.

ABSOLUTE 

Parameter is at a fixed memory address.

Definition at line 86 of file BinaryCallingConvention.h.

Constructor & Destructor Documentation

Rose::BinaryAnalysis::CallingConvention::ParameterLocation::ParameterLocation ( )
inline

Default constructed no-location.

This default constructor is useful for indicating no location or for using an STL container, such as std::vector, that requires a default constructor. The isValid predicate will return false for default-constructed locations.

Definition at line 123 of file BinaryCallingConvention.h.

Rose::BinaryAnalysis::CallingConvention::ParameterLocation::ParameterLocation ( RegisterDescriptor  reg)
inlineexplicit

Constructs a parameter in a register location.

Definition at line 127 of file BinaryCallingConvention.h.

Rose::BinaryAnalysis::CallingConvention::ParameterLocation::ParameterLocation ( RegisterDescriptor  reg,
int64_t  offset 
)
inline

Constructs a parameter at a register-relative memory address.

Definition at line 131 of file BinaryCallingConvention.h.

Rose::BinaryAnalysis::CallingConvention::ParameterLocation::ParameterLocation ( rose_addr_t  va)
inlineexplicit

Constructs a parameter at a fixed memory address.

Definition at line 135 of file BinaryCallingConvention.h.

Member Function Documentation

Type Rose::BinaryAnalysis::CallingConvention::ParameterLocation::type ( ) const
inline

Type of parameter location.

Definition at line 139 of file BinaryCallingConvention.h.

Referenced by isValid().

bool Rose::BinaryAnalysis::CallingConvention::ParameterLocation::isValid ( ) const
inline

Predicate to determine if location is valid.

Returns false for default-constructed locations, true for all others.

Definition at line 144 of file BinaryCallingConvention.h.

References NO_LOCATION, and type().

RegisterDescriptor Rose::BinaryAnalysis::CallingConvention::ParameterLocation::reg ( ) const
inline

Register part of location.

Returns the register where the parameter is stored (for register parameters) or the register holding the base address for register-relative memory parameters. Returns an invalid (default constructed) register descriptor when invoked on a default constructed location or a fixed memory addresses.

Definition at line 153 of file BinaryCallingConvention.h.

int64_t Rose::BinaryAnalysis::CallingConvention::ParameterLocation::offset ( ) const
inline

Offset part of location.

Returns the signed byte offset from the base register for register-relative memory parameters. The memory address of the parameter is the contents of the base register plus this byte offset. Returns zero for register parameters, parameters stored at fixed memory addresses, and default constructed locations.

Definition at line 162 of file BinaryCallingConvention.h.

References STACK.

rose_addr_t Rose::BinaryAnalysis::CallingConvention::ParameterLocation::address ( ) const
inline

Fixed address location.

Returns the address for a parameter stored at a fixed memory address. Returns zero for register parameters, register-relative (stack) parameters, and default constructed locations.

Definition at line 170 of file BinaryCallingConvention.h.

References ABSOLUTE.

bool Rose::BinaryAnalysis::CallingConvention::ParameterLocation::operator== ( const ParameterLocation other) const
inline

Equality.

Two locations are equal if they are the same type and register, offset, and/or address as appropriate to the type.

Definition at line 177 of file BinaryCallingConvention.h.

bool Rose::BinaryAnalysis::CallingConvention::ParameterLocation::operator!= ( const ParameterLocation other) const
inline

Inequality.

Two locations are unequal if they have different types, registers, offsets, or addresses.

Definition at line 184 of file BinaryCallingConvention.h.


The documentation for this class was generated from the following file: