Class CallingConventionUtil
java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.type.CallingConventionUtil
Utility routines for calling convention objects.
-
Method Summary
Modifier and TypeMethodDescriptiongetInputRegisters(ICallingConvention cc, Endianness endian) Get input registers used by a calling convention.static Collection<Long> Get single-register input slots in declaration order.static Collection<Long> Get single-register output slots in declaration order.getOutputRegisters(ICallingConvention cc, Endianness endian) Get output registers used by a calling convention.static intgetParameterIndexByArgumentStackOffset(ICallingConvention cc, IPrototypeItem proto, int stackOffset, int stackSlotSize) Given a calling convention and a stack offset, determine a method's parameter index (if the parameter is on the stack on of course).getParameterRegisters(ICallingConventionManager ccManager, Endianness endian) Collect parameter registers from all defined calling conventions in the given manager.getSpoiledRegisters(ICallingConventionManager ccManager) Collect spoiled registers from all defined calling conventions in the given manager.static booleanisValidForProcessor(ICallingConvention cc, List<ProcessorType> candidateProcessors) Determine whether a calling convention is compatible with one of the candidate processors.static CallingConventionBuilderParse and create a new calling convention object.static ICallingConventionparseAndBuild(String data, boolean build) Parse a calling convention definition and optionally build it.
-
Method Details
-
getOrderedSingleInputRegisters
public static Collection<Long> getOrderedSingleInputRegisters(ICallingConvention cc, Endianness endian) Get single-register input slots in declaration order.- Parameters:
cc- calling conventionendian- endianness used for endian-dependent storage entries- Returns:
- ordered native register identifiers
-
getOrderedSingleOutputRegisters
public static Collection<Long> getOrderedSingleOutputRegisters(ICallingConvention cc, Endianness endian) Get single-register output slots in declaration order.- Parameters:
cc- calling conventionendian- endianness used for endian-dependent storage entries- Returns:
- ordered native register identifiers
-
getInputRegisters
Get input registers used by a calling convention.- Parameters:
cc- calling conventionendian- endianness used for endian-dependent register pairs- Returns:
- a set of native register ids
-
getOutputRegisters
Get output registers used by a calling convention.- Parameters:
cc- calling conventionendian- endianness used for endian-dependent register pairs- Returns:
- a set of native register ids
-
getParameterRegisters
public static Set<Long> getParameterRegisters(ICallingConventionManager ccManager, Endianness endian) Collect parameter registers from all defined calling conventions in the given manager.- Parameters:
ccManager- calling convention managerendian- endianness used for endian-dependent register pairs- Returns:
- ids of the registers used as parameter in the known calling conventions
-
getSpoiledRegisters
Collect spoiled registers from all defined calling conventions in the given manager.- Parameters:
ccManager- calling convention manager- Returns:
- ids of the registers used as parameter in the known calling conventions
-
getParameterIndexByArgumentStackOffset
public static int getParameterIndexByArgumentStackOffset(ICallingConvention cc, IPrototypeItem proto, int stackOffset, int stackSlotSize) Given a calling convention and a stack offset, determine a method's parameter index (if the parameter is on the stack on of course).- Parameters:
cc- calling conventionproto- prototype whose parameters are examinedstackOffset- argument stack offsetstackSlotSize- size of one stack slot, in bytes- Returns:
- -1 if undetermined
-
parseAndBuild
Parse a calling convention definition and optionally build it.- Parameters:
data- calling convention definition, formatted as YAML databuild- true to build the convention object- Returns:
- parsed calling convention
-
parse
Parse and create a new calling convention object.- Parameters:
data- definition of a calling convention, formatted as yaml data (see doc)- Returns:
- a calling convention object (the method throws
IllegalArgumentExceptionon error)
-
isValidForProcessor
public static boolean isValidForProcessor(ICallingConvention cc, List<ProcessorType> candidateProcessors) Determine whether a calling convention is compatible with one of the candidate processors.- Parameters:
cc- calling conventioncandidateProcessors- candidate processor types- Returns:
- true if the convention has no processor restriction or matches a candidate processor
-