Interface CompilerSpec

  • All Known Implementing Classes:
    BasicCompilerSpec

    public interface CompilerSpec
    Interface for classes that hold compiler option information
    • Field Detail

      • CALLING_CONVENTION_cdecl

        static final java.lang.String CALLING_CONVENTION_cdecl
        See Also:
        Constant Field Values
      • CALLING_CONVENTION_pascal

        static final java.lang.String CALLING_CONVENTION_pascal
        See Also:
        Constant Field Values
      • CALLING_CONVENTION_thiscall

        static final java.lang.String CALLING_CONVENTION_thiscall
        See Also:
        Constant Field Values
      • CALLING_CONVENTION_stdcall

        static final java.lang.String CALLING_CONVENTION_stdcall
        See Also:
        Constant Field Values
      • CALLING_CONVENTION_fastcall

        static final java.lang.String CALLING_CONVENTION_fastcall
        See Also:
        Constant Field Values
      • CALLING_CONVENTION_vectorcall

        static final java.lang.String CALLING_CONVENTION_vectorcall
        See Also:
        Constant Field Values
    • Method Detail

      • getLanguage

        Language getLanguage()
        Get the Language this compiler spec is based on. Note that compiler specs may be reused across multiple languages in the cspec files on disk, but once loaded in memory are actually separate objects. (M:N on disk, 1:N in memory)
        Returns:
        the language this compiler spec is based on
      • getCompilerSpecDescription

        CompilerSpecDescription getCompilerSpecDescription()
        Returns a brief description of the compiler spec
      • getCompilerSpecID

        CompilerSpecID getCompilerSpecID()
        Returns the id string associated with this compiler spec;
        Returns:
        the id string associated with this compiler spec;
      • getStackPointer

        Register getStackPointer()
        Get the default Stack Pointer register for this language if there is one.
        Returns:
        default stack pointer register.
      • isStackRightJustified

        boolean isStackRightJustified()
        Indicates whether variables are right-justified within the stack alignment.
        Returns:
        true if right stack justification applies.
      • getAddressSpace

        AddressSpace getAddressSpace​(java.lang.String spaceName)
        Get an address space by name. This can be value added over the normal AddressFactory.getAddressSpace routine because the compiler spec can refer to special internal spaces like the stack space
        Parameters:
        spaceName -
        Returns:
        the corresponding AddressSpace object
      • getStackSpace

        AddressSpace getStackSpace()
        Get the stack address space defined by this specification
        Returns:
        stack address space
      • getStackBaseSpace

        AddressSpace getStackBaseSpace()
        Get the physical space used for stack data storage
        Returns:
        address space which contains the stack
      • stackGrowsNegative

        boolean stackGrowsNegative()
        Returns true if stack grows with negative offsets
      • applyContextSettings

        void applyContextSettings​(DefaultProgramContext ctx)
        Apply context settings to the ProgramContext as specified by the configuration
        Parameters:
        ctx - is the ProgramContext
      • getCallingConventions

        PrototypeModel[] getCallingConventions()
        Returns an array of the prototype models. Each prototype model specifies a calling convention.
      • getCallingConvention

        PrototypeModel getCallingConvention​(java.lang.String name)
        Returns the Calling Convention Model with the given name.
        Parameters:
        name - the name of the calling convention to retrieve
        Returns:
        the calling convention with the given name or null if there is none with that name.
      • getNamedCallingConventions

        PrototypeModel[] getNamedCallingConventions()
        Returns an array of the named prototype models. Each prototype model specifies a calling convention.
      • getDefaultCallingConvention

        PrototypeModel getDefaultCallingConvention()
        Returns the prototype model that is the default calling convention or else null.
        Returns:
        the default calling convention or null.
      • isGlobal

        boolean isGlobal​(Address addr)
        Returns true if specified address location has been designated global
        Parameters:
        addr - address location
      • registerProgramOptions

        void registerProgramOptions​(Program program)
        Register program-specific compiler-spec options
        Parameters:
        program -
      • getPrototypeEvaluationModel

        java.lang.Object getPrototypeEvaluationModel​(Program program)
        Get the program-specific prototype evaluation model.
        Parameters:
        program -
        Returns:
        prototype evaluation model
      • getDecompilerOutputLanguage

        DecompilerLanguage getDecompilerOutputLanguage​(Program program)
        Get the language that the decompiler produces
        Parameters:
        program -
        Returns:
        an enum specifying the language
      • matchConvention

        PrototypeModel matchConvention​(GenericCallingConvention genericCallingConvention)
        Get the PrototypeModel based on the genericCallingConvention
        Parameters:
        genericCallingConvention -
        Returns:
        the matching model or the defaultModel if nothing matches
      • findBestCallingConvention

        PrototypeModel findBestCallingConvention​(Parameter[] params)
        Find the best guess at a calling convention model from this compiler spec given an ordered list of (potential) parameters.
        Returns:
        prototype model corresponding to the specified function signature
      • hasProperty

        boolean hasProperty​(java.lang.String key)
        Returns whether this lanugage has a property defined.
        Parameters:
        key - the property key
        Returns:
        if the property is defined
      • doesCDataTypeConversions

        boolean doesCDataTypeConversions()
        Return true if function prototypes respect the C-language datatype conversion conventions. This amounts to converting array datatypes to pointer-to-element datatypes. In C, arrays are passed by reference (structures are still passed by value)
        Returns:
      • getPropertyAsInt

        int getPropertyAsInt​(java.lang.String key,
                             int defaultInt)
        Gets the value of a property as an int, returning defaultInt if undefined.
        Parameters:
        key - the property key
        defaultInt - the default value to return if property is undefined
        Returns:
        the property value as an int, or the default value if undefined
      • getPropertyAsBoolean

        boolean getPropertyAsBoolean​(java.lang.String key,
                                     boolean defaultBoolean)
        Gets the value of a property as a boolean, returning defaultBoolean if undefined.
        Parameters:
        key - the property key
        defaultBoolean - the default value to return if property is undefined
        Returns:
        the property value as a boolean, or the default value if undefined
      • getProperty

        java.lang.String getProperty​(java.lang.String key,
                                     java.lang.String defaultString)
        Gets the value of a property as a String, returning defaultString if undefined.
        Parameters:
        key - the property key
        defaultString - the default value to return if property is undefined
        Returns:
        the property value as a String, or the default value if undefined
      • getProperty

        java.lang.String getProperty​(java.lang.String key)
        Gets a property defined for this language, or null if that property isn't defined.
        Parameters:
        key - the property key
        Returns:
        the property value, or null if not defined
      • getPropertyKeys

        java.util.Set<java.lang.String> getPropertyKeys()
        Returns a read-only set view of the property keys defined on this language.
        Returns:
        read-only set of property keys