Class CallingConvention
java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.type.CallingConvention
- All Implemented Interfaces:
ICallingConvention
Standard implementation of a calling convention object. It can be sub-classed to generate custom
input/output layout.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Storage-location generator for routine arguments (inputs).class
Storage-location generator for routine return values (outputs). -
Field Summary
Fields inherited from interface com.pnfsoftware.jeb.core.units.code.asm.type.ICallingConvention
FLAG_COMPOSITE_INPUT_ON_STACK, FLAG_FIRST_ARG_IS_THIS_POINTER, FLAG_FLOAT_INPUT_ON_STACK, FLAG_FORBID_PARAMS_2SLOTSUP, FLAG_FORBID_PARAMS_3SLOTSUP, FLAG_IPRD, FLAG_LINK_AFTER_INPUT, FLAG_OUTPUT_AFTER_INPUT, FLAG_OUTPUT_PUSHED, FLAG_PARALLEL_INPUT_REGISTER_STACKS, FLAG_SKIP_PASSED_INPUT_REGISTERS, FLAG_STACK_CLEANED_BY_CALLEE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
int
determineSlotcountAlignment
(int requestedSlotcount) Determine the slotcount alignment requirement of a non-composite
type.format
(int type) Get a list of alternate names for this calling convention.Get the list of compiler types this calling convention may work with.int
getFlags()
long
Get an internally-generated identifier for this calling convention object.Create a storage-location generator for the inputs provided to a routine using this calling convention.int
Return the number of slots that are reserved for parameters.Retrieve the optional calling convention, derived from this convention, used to return large composite prototypes.int
getName()
Get the common name of this calling convention.getNames()
Retrieve all names for this calling convention (principal and alternates).getNotes()
getOutput
(TypeLayoutInfo ti, int inputStackSlotCount) Convenience method to retrieve the storage location of the single return value for this calling convention.getOutputsGenerator
(int inputStackSlotCount) Create a storage-location generator for the outputs provided to a routine using this calling convention.int
Return the number of slots that are reserved for return values.Get the list of processor types this calling convention may work with.Get the list of registers that are spoiled by a callee, in the strictest sense, i.e.getReturnAddressSlot
(Integer inputStackSlotCount) Alignment specifications for non-composite
types.Get the list of all registers that may be modified and/or spoiled by a callee, in the most general sense.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
toString()
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.pnfsoftware.jeb.core.units.code.asm.type.ICallingConvention
isStackCleanedByCallee, isStackCleanedByCaller
-
Constructor Details
-
CallingConvention
public CallingConvention()Reserved.
-
-
Method Details
-
clone
-
getIdentifierKey
public long getIdentifierKey()Description copied from interface:ICallingConvention
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
- Specified by:
getIdentifierKey
in interfaceICallingConvention
- Returns:
- the key for this calling convention
-
getNotes
- Specified by:
getNotes
in interfaceICallingConvention
- Returns:
-
getFlags
public int getFlags()- Specified by:
getFlags
in interfaceICallingConvention
- Returns:
-
hasFlag
public boolean hasFlag(int f) - Specified by:
hasFlag
in interfaceICallingConvention
- Returns:
-
isUnknown
public boolean isUnknown()- Specified by:
isUnknown
in interfaceICallingConvention
- Returns:
-
getName
Description copied from interface:ICallingConvention
Get the common name of this calling convention.- Specified by:
getName
in interfaceICallingConvention
- Returns:
-
getAlternateNames
Description copied from interface:ICallingConvention
Get a list of alternate names for this calling convention.- Specified by:
getAlternateNames
in interfaceICallingConvention
- Returns:
-
getNames
Description copied from interface:ICallingConvention
Retrieve all names for this calling convention (principal and alternates).- Specified by:
getNames
in interfaceICallingConvention
- Returns:
-
getPrimaryProcessorType
-
getProcessorTypes
Description copied from interface:ICallingConvention
Get the list of processor types this calling convention may work with.- Specified by:
getProcessorTypes
in interfaceICallingConvention
- Returns:
-
getSubsystemTypes
Description copied from interface:ICallingConvention
Get the list of subsystem types this calling convention may work with.- Specified by:
getSubsystemTypes
in interfaceICallingConvention
- Returns:
-
getCompilerTypes
Description copied from interface:ICallingConvention
Get the list of compiler types this calling convention may work with.- Specified by:
getCompilerTypes
in interfaceICallingConvention
- Returns:
-
isCompatibleWith
public boolean isCompatibleWith(ProcessorType wantedProcessor, SubsystemType wantedSubsystem, CompilerType wantedCompiler) Description copied from interface:ICallingConvention
Determine whether this calling convention is compatible with the provided triple (processor, subsystem, compiler).- Specified by:
isCompatibleWith
in interfaceICallingConvention
- Parameters:
wantedProcessor
- mandatory (pass UNKNOWN if not known)wantedSubsystem
- mandatory (pass UNKNOWN if not known)wantedCompiler
- mandatory (pass UNKNOWN if not known)- Returns:
-
getSpoiledRegisters
Description copied from interface:ICallingConvention
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.- Specified by:
getSpoiledRegisters
in interfaceICallingConvention
- Returns:
-
getPureSpoiledRegisters
Description copied from interface:ICallingConvention
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.- Specified by:
getPureSpoiledRegisters
in interfaceICallingConvention
- Returns:
-
getReturnAddressSlot
- Specified by:
getReturnAddressSlot
in interfaceICallingConvention
- Returns:
-
getReturnAddressSlot
- Specified by:
getReturnAddressSlot
in interfaceICallingConvention
- Returns:
-
getOutput
Description copied from interface:ICallingConvention
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.- Specified by:
getOutput
in interfaceICallingConvention
- Parameters:
ti
- storage typeinputStackSlotCount
- the number of stack slots used to provide input parameters (some calling conventions require that to calculate proper positioning for output values)- Returns:
-
getInputSlotCountHint
public int getInputSlotCountHint()Description copied from interface:ICallingConvention
Return the number of slots that are reserved for parameters. Note that this is just a hint on how many parameters are used.- Specified by:
getInputSlotCountHint
in interfaceICallingConvention
- Returns:
-
getOutputSlotCountHint
public int getOutputSlotCountHint()Description copied from interface:ICallingConvention
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.- Specified by:
getOutputSlotCountHint
in interfaceICallingConvention
- Returns:
-
getSlotcountAlignmentMap
Description copied from interface:ICallingConvention
Alignment specifications for non-composite
types.- Specified by:
getSlotcountAlignmentMap
in interfaceICallingConvention
- Returns:
-
determineSlotcountAlignment
public int determineSlotcountAlignment(int requestedSlotcount) Description copied from interface:ICallingConvention
Determine the slotcount alignment requirement of a non-composite
type.- Specified by:
determineSlotcountAlignment
in interfaceICallingConvention
- Returns:
-
getIPRDMinimumSlotCount
public int getIPRDMinimumSlotCount()- Specified by:
getIPRDMinimumSlotCount
in interfaceICallingConvention
- Returns:
-
getIPRDInputPtrEntry
- Specified by:
getIPRDInputPtrEntry
in interfaceICallingConvention
- Returns:
-
getIPRDOutputPtrEntry
- Specified by:
getIPRDOutputPtrEntry
in interfaceICallingConvention
- Returns:
-
getIPRDConvention
Description copied from interface:ICallingConvention
Retrieve the optional calling convention, derived from this convention, used to return large composite prototypes. This only applies if the flagICallingConvention.FLAG_IPRD
was set.- Specified by:
getIPRDConvention
in interfaceICallingConvention
- Returns:
- a linked IPRD (Implicit Pointer to Return Data) convention, or null
-
toString
-
format
- Specified by:
format
in interfaceICallingConvention
- Parameters:
type
- 0: short-form (i.e.,#toString()
), 1: user-friendly long-form, 2: parseable yaml form- Returns:
-
formatParseable
-
formatUser
-
getInputsGenerator
Description copied from interface:ICallingConvention
Create a storage-location generator for the inputs provided to a routine using this calling convention. convention.- Specified by:
getInputsGenerator
in interfaceICallingConvention
- Returns:
- a generator
-
getOutputsGenerator
Description copied from interface:ICallingConvention
Create a storage-location generator for the outputs provided to a routine using this calling convention.- Specified by:
getOutputsGenerator
in interfaceICallingConvention
- Parameters:
inputStackSlotCount
- optional value indicating how many stack slots were used to provide parameters (this value is the calling convention has the flagsICallingConvention.FLAG_OUTPUT_AFTER_INPUT
orICallingConvention.FLAG_OUTPUT_PUSHED
)- Returns:
- a generator
-