Class PrototypeModel

  • Direct Known Subclasses:
    PrototypeModelError, PrototypeModelMerged

    public class PrototypeModel
    extends java.lang.Object
    A function calling convention model. Formal specification of how a compiler passes arguments between functions.
    • Field Detail

      • name

        protected java.lang.String name
      • isExtension

        protected boolean isExtension
    • Constructor Detail

      • PrototypeModel

        public PrototypeModel​(java.lang.String name,
                              PrototypeModel model)
      • PrototypeModel

        public PrototypeModel()
    • Method Detail

      • getUnaffectedList

        public Varnode[] getUnaffectedList()
        Returns:
        list of registers unaffected by called functions
      • getKilledByCallList

        public Varnode[] getKilledByCallList()
        Returns:
        list of registers definitely affected by called functions
      • getLikelyTrash

        public Varnode[] getLikelyTrash()
        Returns:
        list of registers whose input value is likely meaningless
      • getReturnAddress

        public Varnode[] getReturnAddress()
        Returns:
        list of registers/memory used to store the return address
      • isMerged

        public boolean isMerged()
      • isProgramExtension

        public boolean isProgramExtension()
        Returns:
        true if this model is a Program specific extension to the CompilerSpec
      • getName

        public java.lang.String getName()
      • getExtrapop

        public int getExtrapop()
      • getStackshift

        public int getStackshift()
      • hasThisPointer

        public boolean hasThisPointer()
      • isConstructor

        public boolean isConstructor()
      • hasInjection

        public boolean hasInjection()
      • 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 an undefined type.
        program - is the 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 - is the 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 index, 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:
        argIndex - is the index
        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 - is the 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 - is the 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.
      • isErrorPlaceholder

        public boolean isErrorPlaceholder()
        If a PrototypeModel fails to parse (from XML) a substitute model may be provided, in which case this method returns true. In all other cases this method returns false;
        Returns:
        true if this object is a substitute for a model that didn't parse
      • saveXml

        public void saveXml​(java.lang.StringBuilder buffer,
                            PcodeInjectLibrary injectLibrary)
      • getInjectName

        protected java.lang.String getInjectName()
      • getStackParameterAlignment

        public int getStackParameterAlignment()
      • getStackParameterOffset

        public java.lang.Long getStackParameterOffset()
      • getPotentialInputRegisterStorage

        public VariableStorage[] getPotentialInputRegisterStorage​(Program prog)
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object