Package ghidra.program.model.lang

# Class ParamListStandard

java.lang.Object
ghidra.program.model.lang.ParamListStandard

All Implemented Interfaces:
  `ParamList`

Direct Known Subclasses:
  `ParamListStandardOut`

public class ParamListStandard extends Object implements ParamList
Standard analysis for parameter lists

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface ghidra.program.model.lang.ParamList

  `ParamList.WithSlotRec`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected ParamEntry[]`
  `entry`
  `protected ModelRule[]`
  `modelRules`
  `protected int`
  `numgroup`
  `protected AddressSpace`
  `spacebase`
  `protected boolean`
  `splitMetatype`
  `protected boolean`
  `thisbeforeret`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ParamListStandard()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `assignAddress(DataType dt, PrototypePieces proto, int pos, DataTypeManager dtManager, int[] status, ParameterPieces res)`
  Fill in the Address and other details for the given parameter Attempt to apply a ModelRule first.
  `int`
  `assignAddressFallback(StorageClass resource, DataType tp, boolean matchExact, int[] status, ParameterPieces param)`
  Assign storage for given parameter class, using the fallback assignment algorithm Given a resource list, a data-type, and the status of previously allocated slots, select the storage location for the parameter.
  `void`
  `assignMap(PrototypePieces proto, DataTypeManager dtManager, ArrayList<ParameterPieces> res, boolean addAutoParams)`
  Given a list of datatypes, calculate the storage locations used for passing those data-types
  `void`
  `encode(Encoder encoder, boolean isInput)`
  `ParamEntry`
  `getEntry(int index)`
  Within this list, get the ParamEntry at the given index
  `int`
  `getNumParamEntry()`
  `VariableStorage[]`
  `getPotentialRegisterStorage(Program prog)`
  Get a list of all parameter storage locations consisting of a single register
  `AddressSpace`
  `getSpacebase()`
  Get the address space associated with any stack based parameters in this list.
  `int`
  `getStackParameterAlignment()`
  Return the amount of alignment used for parameters passed on the stack, or -1 if there are no stack params
  `Long`
  `getStackParameterOffset()`
  Find the boundary offset that separates parameters on the stack from other local variables This is usually the address of the first stack parameter, but if the stack grows positive, this is the first address AFTER the parameters on the stack
  `boolean`
  `isEquivalent(ParamList obj)`
  Determine if this ParmList is equivalent to another instance
  `boolean`
  `isThisBeforeRetPointer()`
  Return true if the this pointer occurs before an indirect return pointer The automatic parameters: this parameter and the hidden return value pointer both tend to be allocated from the initial general purpose registers reserved for parameter passing.
  `boolean`
  `possibleParamWithSlot(Address loc, int size, ParamList.WithSlotRec res)`
  Determine if a particular address range is a possible parameter, and if so what slot(s) it occupies
  `void`
  `restoreXml(XmlPullParser parser, CompilerSpec cspec)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### numgroup

    protected int numgroup

  - ### thisbeforeret

    protected boolean thisbeforeret

  - ### splitMetatype

    protected boolean splitMetatype

  - ### entry

    protected ParamEntry[] entry

  - ### modelRules

    protected ModelRule[] modelRules

  - ### spacebase

    protected AddressSpace spacebase

- ## Constructor Details

  - ### ParamListStandard

    public ParamListStandard()

- ## Method Details

  - ### assignAddressFallback

    public int assignAddressFallback(StorageClass resource, DataType tp, boolean matchExact, int[] status, ParameterPieces param)
    Assign storage for given parameter class, using the fallback assignment algorithm Given a resource list, a data-type, and the status of previously allocated slots, select the storage location for the parameter. The status array is indexed by group: a positive value indicates how many slots have been allocated from that group, and a -1 indicates the group/resource is fully consumed. If an Address can be assigned to the parameter, it and other details are passed back in the ParameterPieces object and the SUCCESS code is returned. Otherwise, the FAIL code is returned.
    Parameters:
      `resource` - is the resource list to allocate from
      `tp` - is the data-type of the parameter
      `matchExact` - is false if TYPECLASS_GENERAL is considered a match for any storage class
      `status` - is an array marking how many slots have already been consumed in a group
      `param` - will hold the address and other details of the assigned parameter
    Returns:
      either SUCCESS or FAIL

  - ### assignAddress

    public int assignAddress(DataType dt, PrototypePieces proto, int pos, DataTypeManager dtManager, int[] status, ParameterPieces res)
    Fill in the Address and other details for the given parameter Attempt to apply a ModelRule first. If these do not succeed, use the fallback assignment algorithm.
    Parameters:
      `dt` - is the data-type assigned to the parameter
      `proto` - is the description of the function prototype
      `pos` - is the position of the parameter to assign (pos=-1 for output, pos >=0 for input)
      `dtManager` - is the data-type manager for (possibly) transforming the parameter's data-type
      `status` - is the consumed resource status array
      `res` - is parameter description to be filled in
    Returns:
      the response code

  - ### getNumParamEntry

    public int getNumParamEntry()
    Returns:
      the number of ParamEntry objets in this list

  - ### getEntry

    public ParamEntry getEntry(int index)
    Within this list, get the ParamEntry at the given index
    Parameters:
      `index` - is the given index
    Returns:
      the selected ParamEntry

  - ### assignMap

    public void assignMap(PrototypePieces proto, DataTypeManager dtManager, ArrayList<ParameterPieces> res, boolean addAutoParams)
    Description copied from interface: `ParamList`
    Given a list of datatypes, calculate the storage locations used for passing those data-types
    Specified by:
      `assignMap` in interface `ParamList`
    Parameters:
      `proto` - is the list of datatypes
      `dtManager` - is the data-type manager
      `res` - is the vector for holding the storage locations and other parameter properties
      `addAutoParams` - if true add/process auto-parameters

  - ### getPotentialRegisterStorage

    public VariableStorage[] getPotentialRegisterStorage(Program prog)
    Description copied from interface: `ParamList`
    Get a list of all parameter storage locations consisting of a single register
    Specified by:
      `getPotentialRegisterStorage` in interface `ParamList`
    Parameters:
      `prog` - is the controlling program
    Returns:
      an array of VariableStorage

  - ### encode

    public void encode(Encoder encoder, boolean isInput) throws IOException
    Specified by:
      `encode` in interface `ParamList`
    Throws:
      `IOException`

  - ### restoreXml

    public void restoreXml(XmlPullParser parser, CompilerSpec cspec) throws XmlParseException
    Specified by:
      `restoreXml` in interface `ParamList`
    Throws:
      `XmlParseException`

  - ### getStackParameterAlignment

    public int getStackParameterAlignment()
    Description copied from interface: `ParamList`
    Return the amount of alignment used for parameters passed on the stack, or -1 if there are no stack params
    Specified by:
      `getStackParameterAlignment` in interface `ParamList`
    Returns:
      the alignment

  - ### getStackParameterOffset

    public Long getStackParameterOffset()
    Description copied from interface: `ParamList`
    Find the boundary offset that separates parameters on the stack from other local variables This is usually the address of the first stack parameter, but if the stack grows positive, this is the first address AFTER the parameters on the stack
    Specified by:
      `getStackParameterOffset` in interface `ParamList`
    Returns:
      the boundary offset

  - ### possibleParamWithSlot

    public boolean possibleParamWithSlot(Address loc, int size, ParamList.WithSlotRec res)
    Description copied from interface: `ParamList`
    Determine if a particular address range is a possible parameter, and if so what slot(s) it occupies
    Specified by:
      `possibleParamWithSlot` in interface `ParamList`
    Parameters:
      `loc` - is the starting address of the range
      `size` - is the size of the range in bytes
      `res` - holds the resulting slot and slotsize
    Returns:
      true if the range is a possible parameter

  - ### getSpacebase

    public AddressSpace getSpacebase()
    Description copied from interface: `ParamList`
    Get the address space associated with any stack based parameters in this list.
    Specified by:
      `getSpacebase` in interface `ParamList`
    Returns:
      the stack address space, if this models parameters passed on the stack, null otherwise

  - ### isEquivalent

    public boolean isEquivalent(ParamList obj)
    Description copied from interface: `ParamList`
    Determine if this ParmList is equivalent to another instance
    Specified by:
      `isEquivalent` in interface `ParamList`
    Parameters:
      `obj` - is the other instance
    Returns:
      true if they are equivalent

  - ### isThisBeforeRetPointer

    public boolean isThisBeforeRetPointer()
    Description copied from interface: `ParamList`
    Return true if the this pointer occurs before an indirect return pointer The automatic parameters: this parameter and the hidden return value pointer both tend to be allocated from the initial general purpose registers reserved for parameter passing. This method returns true if the this parameter is allocated first.
    Specified by:
      `isThisBeforeRetPointer` in interface `ParamList`
    Returns:
      false if the hidden return value pointer is allocated first