public class

CallingConvention

extends Object
implements ICallingConvention
java.lang.Object
   ↳ com.pnfsoftware.jeb.core.units.code.asm.type.CallingConvention

Class Overview

Standard implementation of a calling convention object. It can be sub-classed to generate custom input/output layout.

Summary

Nested Classes
class CallingConvention.ArgLocationGenerator Storage-location generator for routine arguments (inputs). 
class CallingConvention.RetLocationGenerator Storage-location generator for routine return values (outputs). 
[Expand]
Inherited Constants
From interface com.pnfsoftware.jeb.core.units.code.asm.type.ICallingConvention
Public Constructors
CallingConvention()
Reserved.
Public Methods
CallingConvention clone()
int determineSlotcountAlignment(int requestedSlotcount)
Determine the slotcount alignment requirement of a non-composite type.
String format(int type)
String formatParseable()
String formatUser()
List<String> getAlternateNames()
Get a list of alternate names for this calling convention.
List<CompilerType> getCompilerTypes()
Get the list of compiler types this calling convention may work with.
int getFlags()
ICallingConvention getIPRDConvention()
Retrieve the optional calling convention, derived from this convention, used to return large composite prototypes.
StorageEntry getIPRDInputPtrEntry()
int getIPRDMinimumSlotCount()
StorageEntry getIPRDOutputPtrEntry()
long getIdentifierKey()
Get an internally-generated identifier for this calling convention object.
int getInputSlotCountHint()
Return the number of slots that are reserved for parameters.
CallingConvention.ArgLocationGenerator getInputsGenerator()
Create a storage-location generator for the inputs provided to a routine using this calling convention.
String getName()
Get the common name of this calling convention.
List<String> getNames()
Retrieve all names for this calling convention (principal and alternates).
String getNotes()
StorageEntry getOutput(TypeLayoutInfo ti, int inputStackSlotCount)
Convenience method to retrieve the storage location of the single return value for this calling convention.
int getOutputSlotCountHint()
Return the number of slots that are reserved for return values.
CallingConvention.RetLocationGenerator getOutputsGenerator(int inputStackSlotCount)
Create a storage-location generator for the outputs provided to a routine using this calling convention.
ProcessorType getPrimaryProcessorType()
List<ProcessorType> getProcessorTypes()
Get the list of processor types this calling convention may work with.
Collection<Long> getPureSpoiledRegisters()
Get the list of registers that are spoiled by a callee, in the strictest sense, i.e.
StorageEntry getReturnAddressSlot(Integer inputStackSlotCount)
StorageEntry getReturnAddressSlot()
Map<Integer, Integer> getSlotcountAlignmentMap()
Alignment specifications for non-composite types.
Collection<Long> getSpoiledRegisters()
Get the list of all registers that may be modified and/or spoiled by a callee, in the most general sense.
List<SubsystemType> getSubsystemTypes()
Get the list of subsystem types this calling convention may work with.
boolean hasFlag(int f)
boolean isCompatibleWith(ProcessorType wantedProcessor, SubsystemType wantedSubsystem, CompilerType wantedCompiler)
Determine whether this calling convention is compatible with the provided triple (processor, subsystem, compiler).
boolean isUnknown()
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pnfsoftware.jeb.core.units.code.asm.type.ICallingConvention

Public Constructors

public CallingConvention ()

Reserved.

Public Methods

public CallingConvention clone ()

public int determineSlotcountAlignment (int requestedSlotcount)

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

public String format (int type)

public String formatParseable ()

public String formatUser ()

public List<String> getAlternateNames ()

Get a list of alternate names for this calling convention.

public List<CompilerType> getCompilerTypes ()

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

public int getFlags ()

public ICallingConvention getIPRDConvention ()

Retrieve the optional calling convention, derived from this convention, used to return large composite prototypes. This only applies if the flag FLAG_IPRD was set.

Returns
  • a linked IPRD (Implicit Pointer to Return Data) convention, or null

public StorageEntry getIPRDInputPtrEntry ()

public int getIPRDMinimumSlotCount ()

public StorageEntry getIPRDOutputPtrEntry ()

public long getIdentifierKey ()

Get an internally-generated identifier for this calling convention object. The id is generated using:

  • the same names
  • same flags
  • same processor targets
  • same subsystem targets
  • same compiler targets

Returns
  • the key for this calling convention

public 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 CallingConvention.ArgLocationGenerator getInputsGenerator ()

Create a storage-location generator for the inputs provided to a routine using this calling convention. convention.

Returns
  • a generator

public String getName ()

Get the common name of this calling convention.

public List<String> getNames ()

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

public String getNotes ()

public StorageEntry getOutput (TypeLayoutInfo ti, int inputStackSlotCount)

Convenience method to retrieve the storage location of the single return value for this calling convention. Most calling conventions allow the return of a single value.

Parameters
ti storage type
inputStackSlotCount the number of stack slots used to provide input parameters (some calling conventions require that to calculate proper positioning for output values)

public 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 CallingConvention.RetLocationGenerator getOutputsGenerator (int inputStackSlotCount)

Create a storage-location generator for the outputs provided to a routine using this calling convention.

Parameters
inputStackSlotCount optional value indicating how many stack slots were used to provide parameters (this value is the calling convention has the flags FLAG_OUTPUT_AFTER_INPUT or FLAG_OUTPUT_PUSHED)
Returns
  • a generator

public ProcessorType getPrimaryProcessorType ()

public List<ProcessorType> getProcessorTypes ()

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

public 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 StorageEntry getReturnAddressSlot (Integer inputStackSlotCount)

public StorageEntry getReturnAddressSlot ()

public Map<Integer, Integer> getSlotcountAlignmentMap ()

Alignment specifications for non-composite types.

public 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 List<SubsystemType> getSubsystemTypes ()

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

public boolean hasFlag (int f)

public boolean isCompatibleWith (ProcessorType wantedProcessor, SubsystemType wantedSubsystem, CompilerType wantedCompiler)

Determine whether this calling convention is compatible with the provided triple (processor, subsystem, compiler).

Parameters
wantedProcessor mandatory (pass UNKNOWN if not known)
wantedSubsystem mandatory (pass UNKNOWN if not known)
wantedCompiler mandatory (pass UNKNOWN if not known)

public boolean isUnknown ()

public String toString ()