Package ghidra.program.model.lang
Class PrototypeModel
- java.lang.Object
-
- ghidra.program.model.lang.PrototypeModel
-
- Direct Known Subclasses:
PrototypeModelMerged
public class PrototypeModel extends java.lang.Object
A function calling convention model. Formal specification of how a compiler passes arguments between functions.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
name
static int
UNKNOWN_EXTRAPOP
-
Constructor Summary
Constructors Constructor Description PrototypeModel()
PrototypeModel(java.lang.String name, PrototypeModel model)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description VariableStorage
getArgLocation(int argIndex, Parameter[] params, DataType dataType, Program program)
Get the preferred parameter location for a specified parameter specified by argIndex which will be added/inserted within the set of existing function params.int
getExtrapop()
GenericCallingConvention
getGenericCallingConvention()
InputListType
getInputListType()
java.lang.String
getName()
VariableStorage
getNextArgLocation(Parameter[] params, DataType dataType, Program program)
Get the preferred parameter location for a new parameter which will appended to the end of an existing set of params.VariableStorage[]
getPotentialInputRegisterStorage(Program prog)
VariableStorage
getReturnLocation(DataType dataType, Program program)
Deprecated.Get the preferred return location given the specified dataType.int
getStackParameterAlignment()
java.lang.Long
getStackParameterOffset()
int
getStackshift()
VariableStorage[]
getStorageLocations(Program program, DataType[] dataTypes, boolean addAutoParams)
Compute the variable storage for a given function and set of return/parameter datatypes defined by an array of data types.boolean
hasThisPointer()
boolean
isConstructor()
boolean
isMerged()
boolean
possibleInputParamWithSlot(Address loc, int size, ParamList.WithSlotRec res)
boolean
possibleOutputParamWithSlot(Address loc, int size, ParamList.WithSlotRec res)
void
restoreXml(XmlPullParser parser, CompilerSpec cspec, boolean normalstack)
java.lang.String
toString()
-
-
-
Field Detail
-
UNKNOWN_EXTRAPOP
public static final int UNKNOWN_EXTRAPOP
- See Also:
- Constant Field Values
-
name
protected java.lang.String name
-
-
Constructor Detail
-
PrototypeModel
public PrototypeModel(java.lang.String name, PrototypeModel model)
-
PrototypeModel
public PrototypeModel()
-
-
Method Detail
-
getGenericCallingConvention
public GenericCallingConvention getGenericCallingConvention()
-
isMerged
public boolean isMerged()
-
getName
public java.lang.String getName()
-
getExtrapop
public int getExtrapop()
-
getStackshift
public int getStackshift()
-
hasThisPointer
public boolean hasThisPointer()
-
isConstructor
public boolean isConstructor()
-
getInputListType
public InputListType getInputListType()
-
getReturnLocation
@Deprecated public VariableStorage getReturnLocation(DataType dataType, Program program)
Deprecated.Get the preferred return location given the specified dataType. In truth, there is no one location. The routines that use this method tend to want the default storage location for integer or pointer return values.- Parameters:
dataType
- first parameter dataType or null for a default undefined type.program
-- Returns:
- return location or
VariableStorage.UNASSIGNED_STORAGE
if unable to determine suitable location
-
getNextArgLocation
public VariableStorage getNextArgLocation(Parameter[] params, DataType dataType, Program program)
Get the preferred parameter location for a new parameter which will appended to the end of an existing set of params. If existing parameters use custom storage, this method should not be used.- Parameters:
params
- existing set parameters to which the next parameter will be appended. (may be null)dataType
- dataType associated with next parameter location or null for a default undefined type.program
-- Returns:
- next parameter location or
VariableStorage.UNASSIGNED_STORAGE
if unable to determine suitable location
-
getArgLocation
public VariableStorage getArgLocation(int argIndex, Parameter[] params, DataType dataType, Program program)
Get the preferred parameter location for a specified parameter specified by argIndex which will be added/inserted within the set of existing function params. If existing parameters use custom storage, this method should not be used.- Parameters:
params
- existing set parameters to which the parameter specified by argIndex will be added/inserted be appended (may be null).dataType
- dataType associated with next parameter location or null for a default undefined type.program
-- Returns:
- parameter location or
VariableStorage.UNASSIGNED_STORAGE
if unable to determine suitable location
-
getStorageLocations
public VariableStorage[] getStorageLocations(Program program, DataType[] dataTypes, boolean addAutoParams)
Compute the variable storage for a given function and set of return/parameter datatypes defined by an array of data types.- Parameters:
program
-dataTypes
- return/parameter datatypes (first element is always the return datatype, i.e., minimum array length is 1)addAutoParams
- TODO- Returns:
- dynamic storage locations orders by ordinal where first element corresponds to return storage. The returned array may also include additional auto-parameter storage locations.
-
restoreXml
public void restoreXml(XmlPullParser parser, CompilerSpec cspec, boolean normalstack) throws XmlParseException
- Throws:
XmlParseException
-
possibleInputParamWithSlot
public boolean possibleInputParamWithSlot(Address loc, int size, ParamList.WithSlotRec res)
-
possibleOutputParamWithSlot
public boolean possibleOutputParamWithSlot(Address loc, int size, ParamList.WithSlotRec res)
-
getStackParameterAlignment
public int getStackParameterAlignment()
-
getStackParameterOffset
public java.lang.Long getStackParameterOffset()
-
getPotentialInputRegisterStorage
public VariableStorage[] getPotentialInputRegisterStorage(Program prog)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-