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 TypeClassDescriptionclassStorage-location generator for routine arguments (inputs).classStorage-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()intdetermineSlotcountAlignment(int requestedSlotcount) Determine the slotcount alignment requirement of a non-compositetype.format(int type) Format this calling convention.Format this calling convention as parseable text.Format this calling convention for user display.Get a list of alternate names for this calling convention.Get the list of compiler types this calling convention may work with.intgetFlags()Retrieve convention flags.longGet 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.intReturn the number of slots that are reserved for parameters.Retrieve the optional calling convention, derived from this convention, used to return large composite prototypes.Retrieve the implicit input pointer storage entry.intRetrieve the minimum slot count for implicit pointer-to-return-data handling.Retrieve the implicit output pointer storage entry.getName()Get the common name of this calling convention.getNames()Retrieve all names for this calling convention (principal and alternates).getNotes()Retrieve implementation notes.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.intReturn the number of slots that are reserved for return values.Get the first processor type associated with this convention.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.Retrieve the return-address storage slot.getReturnAddressSlot(Integer inputStackSlotCount) Retrieve the return-address storage slot.Alignment specifications for non-compositetypes.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.booleanhasFlag(int f) Determine whether a flag is set.booleanisCompatibleWith(ProcessorType wantedProcessor, SubsystemType wantedSubsystem, CompilerType wantedCompiler) Determine whether this calling convention is compatible with the provided triple (processor, subsystem, compiler).booleanDetermine whether this is the unknown calling convention.toString()Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:ICallingConventionGet 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:
getIdentifierKeyin interfaceICallingConvention- Returns:
- the key for this calling convention
-
getNotes
Description copied from interface:ICallingConventionRetrieve implementation notes.- Specified by:
getNotesin interfaceICallingConvention- Returns:
- notes, or null
-
getFlags
public int getFlags()Description copied from interface:ICallingConventionRetrieve convention flags.- Specified by:
getFlagsin interfaceICallingConvention- Returns:
- flags
-
hasFlag
public boolean hasFlag(int f) Description copied from interface:ICallingConventionDetermine whether a flag is set.- Specified by:
hasFlagin interfaceICallingConvention- Parameters:
f- flag to test- Returns:
- true if the flag is set
-
isUnknown
public boolean isUnknown()Description copied from interface:ICallingConventionDetermine whether this is the unknown calling convention.- Specified by:
isUnknownin interfaceICallingConvention- Returns:
- true if this convention is unknown
-
getName
Description copied from interface:ICallingConventionGet the common name of this calling convention.- Specified by:
getNamein interfaceICallingConvention- Returns:
- principal name
-
getAlternateNames
Description copied from interface:ICallingConventionGet a list of alternate names for this calling convention.- Specified by:
getAlternateNamesin interfaceICallingConvention- Returns:
- alternate names
-
getNames
Description copied from interface:ICallingConventionRetrieve all names for this calling convention (principal and alternates).- Specified by:
getNamesin interfaceICallingConvention- Returns:
- principal and alternate names
-
getPrimaryProcessorType
Get the first processor type associated with this convention.- Returns:
- primary processor type, or null if none is defined
-
getProcessorTypes
Description copied from interface:ICallingConventionGet the list of processor types this calling convention may work with.- Specified by:
getProcessorTypesin interfaceICallingConvention- Returns:
- processor type list
-
getSubsystemTypes
Description copied from interface:ICallingConventionGet the list of subsystem types this calling convention may work with.- Specified by:
getSubsystemTypesin interfaceICallingConvention- Returns:
- subsystem type list
-
getCompilerTypes
Description copied from interface:ICallingConventionGet the list of compiler types this calling convention may work with.- Specified by:
getCompilerTypesin interfaceICallingConvention- Returns:
- compiler type list
-
isCompatibleWith
public boolean isCompatibleWith(ProcessorType wantedProcessor, SubsystemType wantedSubsystem, CompilerType wantedCompiler) Description copied from interface:ICallingConventionDetermine whether this calling convention is compatible with the provided triple (processor, subsystem, compiler).- Specified by:
isCompatibleWithin interfaceICallingConvention- Parameters:
wantedProcessor- mandatory (pass UNKNOWN if not known)wantedSubsystem- mandatory (pass UNKNOWN if not known)wantedCompiler- mandatory (pass UNKNOWN if not known)- Returns:
- true if this convention is compatible
-
getSpoiledRegisters
Description copied from interface:ICallingConventionGet 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:
getSpoiledRegistersin interfaceICallingConvention- Returns:
- spoiled register ids
-
getPureSpoiledRegisters
Description copied from interface:ICallingConventionGet 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:
getPureSpoiledRegistersin interfaceICallingConvention- Returns:
- pure spoiled register ids
-
getReturnAddressSlot
Description copied from interface:ICallingConventionRetrieve the return-address storage slot.- Specified by:
getReturnAddressSlotin interfaceICallingConvention- Returns:
- return-address storage slot
-
getReturnAddressSlot
Description copied from interface:ICallingConventionRetrieve the return-address storage slot.- Specified by:
getReturnAddressSlotin interfaceICallingConvention- Parameters:
inputStackSlotCount- input stack slot count- Returns:
- return-address storage slot
-
getOutput
Description copied from interface:ICallingConventionConvenience 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:
getOutputin 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:
- output storage entry, or null
-
getInputSlotCountHint
public int getInputSlotCountHint()Description copied from interface:ICallingConventionReturn the number of slots that are reserved for parameters. Note that this is just a hint on how many parameters are used.- Specified by:
getInputSlotCountHintin interfaceICallingConvention- Returns:
- input slot count hint
-
getOutputSlotCountHint
public int getOutputSlotCountHint()Description copied from interface:ICallingConventionReturn 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:
getOutputSlotCountHintin interfaceICallingConvention- Returns:
- output slot count hint
-
getSlotcountAlignmentMap
Description copied from interface:ICallingConventionAlignment specifications for non-compositetypes.- Specified by:
getSlotcountAlignmentMapin interfaceICallingConvention- Returns:
- slot-count alignment map
-
determineSlotcountAlignment
public int determineSlotcountAlignment(int requestedSlotcount) Description copied from interface:ICallingConventionDetermine the slotcount alignment requirement of a non-compositetype.- Specified by:
determineSlotcountAlignmentin interfaceICallingConvention- Parameters:
requestedSlotcount- requested slot count- Returns:
- aligned slot count
-
getIPRDMinimumSlotCount
public int getIPRDMinimumSlotCount()Description copied from interface:ICallingConventionRetrieve the minimum slot count for implicit pointer-to-return-data handling.- Specified by:
getIPRDMinimumSlotCountin interfaceICallingConvention- Returns:
- minimum slot count
-
getIPRDInputPtrEntry
Description copied from interface:ICallingConventionRetrieve the implicit input pointer storage entry.- Specified by:
getIPRDInputPtrEntryin interfaceICallingConvention- Returns:
- input pointer storage entry
-
getIPRDOutputPtrEntry
Description copied from interface:ICallingConventionRetrieve the implicit output pointer storage entry.- Specified by:
getIPRDOutputPtrEntryin interfaceICallingConvention- Returns:
- output pointer storage entry
-
getIPRDConvention
Description copied from interface:ICallingConventionRetrieve the optional calling convention, derived from this convention, used to return large composite prototypes. This only applies if the flagICallingConvention.FLAG_IPRDwas set.- Specified by:
getIPRDConventionin interfaceICallingConvention- Returns:
- a linked IPRD (Implicit Pointer to Return Data) convention, or null
-
toString
-
format
Description copied from interface:ICallingConventionFormat this calling convention.- Specified by:
formatin interfaceICallingConvention- Parameters:
type- 0: short-form (i.e.,toString()), 1: user-friendly long-form, 2: parseable yaml form- Returns:
- formatted convention
-
formatParseable
Format this calling convention as parseable text.- Returns:
- parseable calling convention definition
-
formatUser
Format this calling convention for user display.- Returns:
- user-facing calling convention description
-
getInputsGenerator
Description copied from interface:ICallingConventionCreate a storage-location generator for the inputs provided to a routine using this calling convention. convention.- Specified by:
getInputsGeneratorin interfaceICallingConvention- Returns:
- a generator
-
getOutputsGenerator
Description copied from interface:ICallingConventionCreate a storage-location generator for the outputs provided to a routine using this calling convention.- Specified by:
getOutputsGeneratorin 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_INPUTorICallingConvention.FLAG_OUTPUT_PUSHED)- Returns:
- a generator
-