Ghidra 11.3.2
Ghidra internal decompiler documentation.
Loading...
Searching...
No Matches
ghidra::ConsumeAs Class Reference

Consume a parameter from a specific resource list. More...

#include <modelrules.hh>

Inheritance diagram for ghidra::ConsumeAs:
[legend]
Collaboration diagram for ghidra::ConsumeAs:
[legend]

Public Member Functions

 ConsumeAs (type_class store, const ParamListStandard *res)
 Constructor.
 
virtual AssignActionclone (const ParamListStandard *newResource) const
 Make a copy of this action.
 
virtual uint4 assignAddress (Datatype *dt, const PrototypePieces &proto, int4 pos, TypeFactory &tlist, vector< int4 > &status, ParameterPieces &res) const
 Assign an address and other meta-data for a specific parameter or for return storage in context.
 
virtual bool fillinOutputMap (ParamActive *active) const
 Test if this action could produce return value storage matching the given set of trials.
 
virtual void decode (Decoder &decoder)
 Configure any details of how this action should behave from the stream.
 
- Public Member Functions inherited from ghidra::AssignAction
 AssignAction (const ParamListStandard *res)
 Constructor.
 
bool canAffectFillinOutput (void) const
 Return true if fillinOutputMap is active.
 

Private Attributes

type_class resourceType
 The resource list the parameter is consumed from.
 

Additional Inherited Members

- Public Types inherited from ghidra::AssignAction
enum  {
  success , fail , no_assignment , hiddenret_ptrparam ,
  hiddenret_specialreg , hiddenret_specialreg_void
}
 
- Static Public Member Functions inherited from ghidra::AssignAction
static AssignActiondecodeAction (Decoder &decoder, const ParamListStandard *res)
 Read the next model rule action element from the stream.
 
static AssignActiondecodeSideeffect (Decoder &decoder, const ParamListStandard *res)
 Read the next model rule sideeffect element from the stream.
 
- Protected Attributes inherited from ghidra::AssignAction
const ParamListStandardresource
 Resources to which this action applies.
 
bool fillinOutputActive
 If true, fillinOutputMap is active.
 

Detailed Description

Consume a parameter from a specific resource list.

Normally the resource list is determined by the parameter data-type, but this action specifies an overriding resource list. Assignment will not fall through to the stack.

Member Function Documentation

◆ assignAddress()

uint4 ghidra::ConsumeAs::assignAddress ( Datatype dt,
const PrototypePieces proto,
int4  pos,
TypeFactory tlist,
vector< int4 > &  status,
ParameterPieces res 
) const
virtual

Assign an address and other meta-data for a specific parameter or for return storage in context.

The Address is assigned based on the data-type of the parameter, available register resources, and other details of the function prototype. Consumed resources are marked. This method returns a response code:

  • success - indicating the Address was successfully assigned
  • fail - if the Address could not be assigned
  • hiddenret_ptrparam - if an additional hidden return parameter is required
Parameters
dtis the data-type of the parameter or return value
protois the high-level description of the function prototype
posis the position of the parameter (pos>=0) or return storage (pos=-1)
tlistis a data-type factory for (possibly) transforming the data-type
statusis the resource consumption array
reswill hold the resulting description of the parameter
Returns
the response code

Implements ghidra::AssignAction.

References ghidra::ParamListStandard::assignAddressFallback(), ghidra::AssignAction::resource, and resourceType.

◆ clone()

virtual AssignAction * ghidra::ConsumeAs::clone ( const ParamListStandard newResource) const
inlinevirtual

Make a copy of this action.

Parameters
newResourceis the new resource object that will own the clone
Returns
the newly allocated copy

Implements ghidra::AssignAction.

References resourceType.

◆ decode()

void ghidra::ConsumeAs::decode ( Decoder decoder)
virtual

Configure any details of how this action should behave from the stream.

Parameters
decoderis the given stream decoder

Implements ghidra::AssignAction.

References ghidra::Decoder::closeElement(), ghidra::Decoder::openElement(), ghidra::Decoder::readString(), and resourceType.

◆ fillinOutputMap()

bool ghidra::ConsumeAs::fillinOutputMap ( ParamActive active) const
virtual

Test if this action could produce return value storage matching the given set of trials.

If there is a return value data-type that could be assigned storage matching the trials by this action, return true. The trials have their matching ParamEntry and offset already set and are already sorted.

Parameters
activeis the given set of trials
Returns
true if the trials could form a valid return value

Reimplemented from ghidra::AssignAction.

References ghidra::ParamTrial::getEntry(), ghidra::ParamActive::getNumTrials(), ghidra::ParamTrial::getOffset(), ghidra::ParamActive::getTrial(), ghidra::ParamEntry::getType(), ghidra::ParamEntry::isFirstInClass(), and resourceType.


The documentation for this class was generated from the following files: