C# Class Reko.Core.Frame

Contains the non-global locations accessed by the code inside a procedure.
Variables accessed by the procedure can live in many places: registers, stack, and temporaries.

The frame layout is particularly interesting. On the Intel x86 architecture in real mode we have the following:

Layout offset value +-----------------+ | arg3 | 6 +-----------------+ | arg2 | 4 +-----------------+ | arg1 | 2 +-----------------+ | return address | 0 +-----------------+ | frame pointer | -2 +-----------------+ | local1 | -4 +-----------------+ | local2 | -6 etc.

Note that variables that are stack arguments use offsets based on the state of stack _after_ the return address was pushed. The return address, if passed on the stack, is always considered to be at offset 0.

In addition, support has to be provided for architectures that have separate FPU stacks.

Afficher le fichier Open project: uxmal/reko Class Usage Examples

Méthodes publiques

Méthode Description
CreateSequence ( System.IO.Storage head, System.IO.Storage tail, DataType dt ) : Identifier
CreateTemporary ( DataType dt ) : Identifier

Creates a temporary variable whose storage and name is guaranteed not to collide with any other variable.

CreateTemporary ( string name, DataType dt ) : Identifier
EnsureFlagGroup ( FlagGroupStorage grf ) : Identifier
EnsureFlagGroup ( FlagRegister freg, uint grfMask, string name, DataType dt ) : Identifier
EnsureFpuStackVariable ( int depth, DataType type ) : Identifier
EnsureIdentifier ( System.IO.Storage stgForeign ) : Identifier
EnsureOutArgument ( Identifier idOrig, DataType outArgumentPointer ) : Identifier
EnsureRegister ( RegisterStorage reg ) : Identifier

Ensures a register access in this function.

EnsureSequence ( System.IO.Storage head, System.IO.Storage tail, DataType dt ) : Identifier
EnsureStackArgument ( int cbOffset, DataType type ) : Identifier
EnsureStackArgument ( int cbOffset, DataType type, string argName ) : Identifier
EnsureStackLocal ( int cbOffset, DataType type ) : Identifier

Makes sure that there is a local variable at the given offset.

EnsureStackLocal ( int cbOffset, DataType type, string name ) : Identifier
EnsureStackVariable ( Constant imm, int cbOffset, DataType type ) : Identifier
EnsureStackVariable ( int byteOffset, DataType type ) : Identifier
ExternalOffset ( Identifier id ) : int

The offset of a variable from the return address, as seen from a caller.

FindFlagGroup ( uint grfMask ) : Identifier
FindFpuStackVariable ( int off ) : Identifier
FindOutArgument ( Identifier idOrig ) : Identifier
FindRegister ( RegisterStorage reg ) : Identifier
FindSequence ( System.IO.Storage n1, System.IO.Storage n2 ) : Identifier
FindStackArgument ( int offset, int size ) : Identifier
FindStackLocal ( int offset, int size ) : Identifier
FindTemporary ( string name ) : Identifier
FormatStackAccessName ( DataType type, string prefix, int cbOffset ) : string
FormatStackAccessName ( DataType type, string prefix, int cbOffset, string nameOverride ) : string
Frame ( PrimitiveType framePointerSize ) : Reko.Core.Expressions

Creates a Frame instance for maintaining the local variables and arguments.

GetStackArgumentSpace ( ) : int

Returns the number of bytes the stack arguments consume on the stack.

Write ( TextWriter text ) : void

Method Details

CreateSequence() public méthode

public CreateSequence ( System.IO.Storage head, System.IO.Storage tail, DataType dt ) : Identifier
head System.IO.Storage
tail System.IO.Storage
dt DataType
Résultat Identifier

CreateTemporary() public méthode

Creates a temporary variable whose storage and name is guaranteed not to collide with any other variable.
public CreateTemporary ( DataType dt ) : Identifier
dt DataType
Résultat Identifier

CreateTemporary() public méthode

public CreateTemporary ( string name, DataType dt ) : Identifier
name string
dt DataType
Résultat Identifier

EnsureFlagGroup() public méthode

public EnsureFlagGroup ( FlagGroupStorage grf ) : Identifier
grf FlagGroupStorage
Résultat Identifier

EnsureFlagGroup() public méthode

public EnsureFlagGroup ( FlagRegister freg, uint grfMask, string name, DataType dt ) : Identifier
freg FlagRegister
grfMask uint
name string
dt DataType
Résultat Identifier

EnsureFpuStackVariable() public méthode

public EnsureFpuStackVariable ( int depth, DataType type ) : Identifier
depth int
type DataType
Résultat Identifier

EnsureIdentifier() public méthode

public EnsureIdentifier ( System.IO.Storage stgForeign ) : Identifier
stgForeign System.IO.Storage
Résultat Identifier

EnsureOutArgument() public méthode

public EnsureOutArgument ( Identifier idOrig, DataType outArgumentPointer ) : Identifier
idOrig Identifier
outArgumentPointer DataType
Résultat Identifier

EnsureRegister() public méthode

Ensures a register access in this function.
public EnsureRegister ( RegisterStorage reg ) : Identifier
reg RegisterStorage
Résultat Identifier

EnsureSequence() public méthode

public EnsureSequence ( System.IO.Storage head, System.IO.Storage tail, DataType dt ) : Identifier
head System.IO.Storage
tail System.IO.Storage
dt DataType
Résultat Identifier

EnsureStackArgument() public méthode

public EnsureStackArgument ( int cbOffset, DataType type ) : Identifier
cbOffset int
type DataType
Résultat Identifier

EnsureStackArgument() public méthode

public EnsureStackArgument ( int cbOffset, DataType type, string argName ) : Identifier
cbOffset int
type DataType
argName string
Résultat Identifier

EnsureStackLocal() public méthode

Makes sure that there is a local variable at the given offset.
public EnsureStackLocal ( int cbOffset, DataType type ) : Identifier
cbOffset int
type DataType
Résultat Identifier

EnsureStackLocal() public méthode

public EnsureStackLocal ( int cbOffset, DataType type, string name ) : Identifier
cbOffset int
type DataType
name string
Résultat Identifier

EnsureStackVariable() public méthode

public EnsureStackVariable ( Constant imm, int cbOffset, DataType type ) : Identifier
imm Constant
cbOffset int
type DataType
Résultat Identifier

EnsureStackVariable() public méthode

public EnsureStackVariable ( int byteOffset, DataType type ) : Identifier
byteOffset int
type DataType
Résultat Identifier

ExternalOffset() public méthode

The offset of a variable from the return address, as seen from a caller.
public ExternalOffset ( Identifier id ) : int
id Identifier
Résultat int

FindFlagGroup() public méthode

public FindFlagGroup ( uint grfMask ) : Identifier
grfMask uint
Résultat Identifier

FindFpuStackVariable() public méthode

public FindFpuStackVariable ( int off ) : Identifier
off int
Résultat Identifier

FindOutArgument() public méthode

public FindOutArgument ( Identifier idOrig ) : Identifier
idOrig Identifier
Résultat Identifier

FindRegister() public méthode

public FindRegister ( RegisterStorage reg ) : Identifier
reg RegisterStorage
Résultat Identifier

FindSequence() public méthode

public FindSequence ( System.IO.Storage n1, System.IO.Storage n2 ) : Identifier
n1 System.IO.Storage
n2 System.IO.Storage
Résultat Identifier

FindStackArgument() public méthode

public FindStackArgument ( int offset, int size ) : Identifier
offset int
size int
Résultat Identifier

FindStackLocal() public méthode

public FindStackLocal ( int offset, int size ) : Identifier
offset int
size int
Résultat Identifier

FindTemporary() public méthode

public FindTemporary ( string name ) : Identifier
name string
Résultat Identifier

FormatStackAccessName() public méthode

public FormatStackAccessName ( DataType type, string prefix, int cbOffset ) : string
type DataType
prefix string
cbOffset int
Résultat string

FormatStackAccessName() public méthode

public FormatStackAccessName ( DataType type, string prefix, int cbOffset, string nameOverride ) : string
type DataType
prefix string
cbOffset int
nameOverride string
Résultat string

Frame() public méthode

Creates a Frame instance for maintaining the local variables and arguments.
public Frame ( PrimitiveType framePointerSize ) : Reko.Core.Expressions
framePointerSize PrimitiveType The size of the frame pointer must match the size of the /// stack register, if any, or at the least the size of a pointer.
Résultat Reko.Core.Expressions

GetStackArgumentSpace() public méthode

Returns the number of bytes the stack arguments consume on the stack.
public GetStackArgumentSpace ( ) : int
Résultat int

Write() public méthode

public Write ( TextWriter text ) : void
text System.IO.TextWriter
Résultat void