public interface

ICallingConvention

com.pnfsoftware.jeb.core.units.code.asm.type.ICallingConvention
Known Indirect Subclasses

Class Overview

Calling convention objects are immutable.

Notes:
- several (potentially as many as necessary) input slots
- a single output slot
- input slots can be registers, register pairs, or stack slots
- the output slot can be a register or a register pair
- the "routine return address" slot is a single slot, either register or stack
- register ids are well-defined in corresponding IRegisterBank implementations

Summary

Constants
int FLAG_COMPLEX_VALUE_RETURNED_VIA_IMPLICIT_FIRST_PARAMETER_POINTER The flag indicates that the calling convention uses an implicit pointer as first parameter when the function prototype specifies that a "complex" data type (some fundamental types, all aggregate types) is to be returned.
int FLAG_FLOAT_INPUT_ON_STACK The flag indicates that all float arguments must go on the stack, regardless of registers declared to be holding storage items, if any.
int FLAG_OUTPUT_AFTER_INPUT The flag indicates that output values are located on the stack after the input values (whose count may not be known).
int FLAG_STACK_CLEANED_BY_CALLEE The flag indicates that the stack is cleaned by the callee (which is not the norm; if the flag is not set, it should be assumed the stack is cleaned by the caller).
Public Methods
abstract int determineSlotcountAlignment(int requestedSlotcount)
Determine the slotcount alignment requirement of a non-composite type.
abstract String format(int type)
abstract List<String> getAlternateNames()
Get a list of alternate names for this calling convention.
abstract List<CompilerType> getCompilerTypes()
Get the list of compiler types this calling convention may work with.
abstract int getFlags()
abstract long getIdentifierKey()
Get an internally-generated identifier for this calling convention object.
abstract RoutineIOSlot getInput(RoutineIOSlot previousStorageEntry, TypeLayoutInfo ti)
Determine the storage item assigned to a method invocation parameter.
abstract int getInputSlotCountHint()
Return the number of slots that are reserved for parameters.
abstract String getName()
Get the common name of this calling convention.
abstract List<String> getNames()
Retrieve all names for this calling convention (principal and alternates).
abstract String getNotes()
abstract RoutineIOSlot getOutput(int index, int requestedSlotCount, boolean isFloat, Integer inputStackSlotCount)
Determine the storage item assigned to a method return value.
abstract RoutineIOSlot getOutput(int index, int requestedSlotCount, boolean isFloat)
Determine the storage item assigned to a method return value.
abstract int getOutputSlotCountHint()
Return the number of slots that are reserved for return values.
abstract List<ProcessorType> getProcessorTypes()
Get the list of processor types this calling convention may work with.
abstract Collection<Long> getPureSpoiledRegisters()
Get the list of registers that are spoiled by a callee, in the strictest sense, i.e.
abstract RoutineIOSlot getReturnAddressSlot()
abstract Map<Integer, Integer> getSlotcountAlignmentMap()
Alignment specifications for non-composite types.
abstract Collection<Long> getSpoiledRegisters()
Get the list of all registers that may be modified and/or spoiled by a callee, in the most general sense.
abstract List<SubsystemType> getSubsystemTypes()
Get the list of subsystem types this calling convention may work with.
abstract boolean isFloatInputOnStack()
abstract boolean isOutputAfterInput()
abstract boolean isStackCleanedByCallee()
Determine whether routine parameters pushed on stack before a routine call are cleaned by the callee.
abstract boolean isStackCleanedByCaller()
Determine whether routine parameters pushed on stack before a routine call are cleaned by the caller.
abstract boolean isUnknown()

Constants

public static final int FLAG_COMPLEX_VALUE_RETURNED_VIA_IMPLICIT_FIRST_PARAMETER_POINTER

The flag indicates that the calling convention uses an implicit pointer as first parameter when the function prototype specifies that a "complex" data type (some fundamental types, all aggregate types) is to be returned.

Constant Value: 256 (0x00000100)

public static final int FLAG_FLOAT_INPUT_ON_STACK

The flag indicates that all float arguments must go on the stack, regardless of registers declared to be holding storage items, if any. (I.e., input registers will be used for integral types, at least, not FP types.)

Constant Value: 64 (0x00000040)

public static final int FLAG_OUTPUT_AFTER_INPUT

The flag indicates that output values are located on the stack after the input values (whose count may not be known).

Constant Value: 32 (0x00000020)

public static final int FLAG_STACK_CLEANED_BY_CALLEE

The flag indicates that the stack is cleaned by the callee (which is not the norm; if the flag is not set, it should be assumed the stack is cleaned by the caller).

Constant Value: 1 (0x00000001)

Public Methods

public abstract int determineSlotcountAlignment (int requestedSlotcount)

Determine the slotcount alignment requirement of a non-composite type.

public abstract String format (int type)

Parameters
type 0: short-form (i.e., #toString()), 1: user-friendly long-form, 2: parseable yaml form

public abstract List<String> getAlternateNames ()

Get a list of alternate names for this calling convention.

public abstract List<CompilerType> getCompilerTypes ()

Get the list of compiler types this calling convention may work with.

public abstract int getFlags ()

public abstract long getIdentifierKey ()

Get an internally-generated identifier for this calling convention object. Two calling conventions using:
- the same names
- same flags
- same processor targets
- same subsystem targets
- same compiler targets
will have the same UUID.

public abstract RoutineIOSlot getInput (RoutineIOSlot previousStorageEntry, TypeLayoutInfo ti)

Determine the storage item assigned to a method invocation parameter.

Parameters
previousStorageEntry the previous entry, null if this input entry is the first one
ti type information of the input parameter
Returns
  • the input entry

public abstract int getInputSlotCountHint ()

Return the number of slots that are reserved for parameters. Note that this is just a hint on how many parameters are used.

public abstract String getName ()

Get the common name of this calling convention.

public abstract List<String> getNames ()

Retrieve all names for this calling convention (principal and alternates).

public abstract String getNotes ()

public abstract RoutineIOSlot getOutput (int index, int requestedSlotCount, boolean isFloat, Integer inputStackSlotCount)

Determine the storage item assigned to a method return value.

Parameters
index first slot index (not an output value index) for the output value
requestedSlotCount number of slots required to accommodate the output value
isFloat the output value is an ieee754 float
inputStackSlotCount for calling conventions marked isOutputAfterInput(), this value is mandatory in order to calculate an accurate output slot
Returns
  • the output entry

public abstract RoutineIOSlot getOutput (int index, int requestedSlotCount, boolean isFloat)

Determine the storage item assigned to a method return value.

Parameters
index first slot index (not an output value index) for the output value
requestedSlotCount number of slots required to accommodate the output value
isFloat the output value is an ieee754 float
Returns
  • the output entry

public abstract int getOutputSlotCountHint ()

Return the number of slots that are reserved for return values. Note that this is just a hint on how many return values are defined.

public abstract List<ProcessorType> getProcessorTypes ()

Get the list of processor types this calling convention may work with.

public abstract Collection<Long> getPureSpoiledRegisters ()

Get the list of registers that are spoiled by a callee, in the strictest sense, i.e. their value may or may not be modified, but it is meaningless and should not be interpreted by the caller upon return. That set would NOT include return registers.

public abstract RoutineIOSlot getReturnAddressSlot ()

public abstract Map<Integer, Integer> getSlotcountAlignmentMap ()

Alignment specifications for non-composite types.

public abstract Collection<Long> getSpoiledRegisters ()

Get the list of all registers that may be modified and/or spoiled by a callee, in the most general sense. That set would include any type of return registers.

public abstract List<SubsystemType> getSubsystemTypes ()

Get the list of subsystem types this calling convention may work with.

public abstract boolean isFloatInputOnStack ()

public abstract boolean isOutputAfterInput ()

public abstract boolean isStackCleanedByCallee ()

Determine whether routine parameters pushed on stack before a routine call are cleaned by the callee.

public abstract boolean isStackCleanedByCaller ()

Determine whether routine parameters pushed on stack before a routine call are cleaned by the caller.

public abstract boolean isUnknown ()