Class BasicCompilerSpec

  • All Implemented Interfaces:
    CompilerSpec

    public class BasicCompilerSpec
    extends java.lang.Object
    implements CompilerSpec
    • Method Detail

      • getCompilerSpecString

        public java.lang.String getCompilerSpecString()
                                               throws java.io.FileNotFoundException,
                                                      java.io.IOException
        Throws:
        java.io.FileNotFoundException
        java.io.IOException
      • applyContextSettings

        public void applyContextSettings​(DefaultProgramContext programContext)
        Description copied from interface: CompilerSpec
        Apply context settings to the ProgramContext as specified by the configuration
        Specified by:
        applyContextSettings in interface CompilerSpec
        Parameters:
        programContext - is the ProgramContext
      • getCompilerSpecID

        public CompilerSpecID getCompilerSpecID()
        Description copied from interface: CompilerSpec
        Returns the id string associated with this compiler spec;
        Specified by:
        getCompilerSpecID in interface CompilerSpec
        Returns:
        the id string associated with this compiler spec;
      • doesCDataTypeConversions

        public boolean doesCDataTypeConversions()
        Description copied from interface: CompilerSpec
        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)
        Specified by:
        doesCDataTypeConversions in interface CompilerSpec
        Returns:
      • getCallingConvention

        public PrototypeModel getCallingConvention​(java.lang.String name)
        Description copied from interface: CompilerSpec
        Returns the Calling Convention Model with the given name.
        Specified by:
        getCallingConvention in interface CompilerSpec
        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.
      • getDefaultCallingConvention

        public PrototypeModel getDefaultCallingConvention()
        Description copied from interface: CompilerSpec
        Returns the prototype model that is the default calling convention or else null.
        Specified by:
        getDefaultCallingConvention in interface CompilerSpec
        Returns:
        the default calling convention or null.
      • getStackPointer

        public Register getStackPointer()
        Description copied from interface: CompilerSpec
        Get the default Stack Pointer register for this language if there is one.
        Specified by:
        getStackPointer in interface CompilerSpec
        Returns:
        default stack pointer register.
      • isStackRightJustified

        public boolean isStackRightJustified()
        Description copied from interface: CompilerSpec
        Indicates whether variables are right-justified within the stack alignment.
        Specified by:
        isStackRightJustified in interface CompilerSpec
        Returns:
        true if right stack justification applies.
      • getStackSpace

        public AddressSpace getStackSpace()
        Description copied from interface: CompilerSpec
        Get the stack address space defined by this specification
        Specified by:
        getStackSpace in interface CompilerSpec
        Returns:
        stack address space
      • getStackBaseSpace

        public AddressSpace getStackBaseSpace()
        Description copied from interface: CompilerSpec
        Get the physical space used for stack data storage
        Specified by:
        getStackBaseSpace in interface CompilerSpec
        Returns:
        address space which contains the stack
      • stackGrowsNegative

        public boolean stackGrowsNegative()
        Description copied from interface: CompilerSpec
        Returns true if stack grows with negative offsets
        Specified by:
        stackGrowsNegative in interface CompilerSpec
      • isGlobal

        public boolean isGlobal​(Address addr)
        Description copied from interface: CompilerSpec
        Returns true if specified address location has been designated global
        Specified by:
        isGlobal in interface CompilerSpec
        Parameters:
        addr - address location
      • getLanguage

        public Language getLanguage()
        Description copied from interface: CompilerSpec
        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)
        Specified by:
        getLanguage in interface CompilerSpec
        Returns:
        the language this compiler spec is based on
      • getAddressSpace

        public AddressSpace getAddressSpace​(java.lang.String spaceName)
        Description copied from interface: CompilerSpec
        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
        Specified by:
        getAddressSpace in interface CompilerSpec
        Returns:
        the corresponding AddressSpace object
      • getPrototypeEvaluationModel

        public java.lang.Object getPrototypeEvaluationModel​(Program program)
        Description copied from interface: CompilerSpec
        Get the program-specific prototype evaluation model.
        Specified by:
        getPrototypeEvaluationModel in interface CompilerSpec
        Returns:
        prototype evaluation model
      • findBestCallingConvention

        public PrototypeModel findBestCallingConvention​(Parameter[] params)
        Description copied from interface: CompilerSpec
        Find the best guess at a calling convention model from this compiler spec given an ordered list of (potential) parameters.
        Specified by:
        findBestCallingConvention in interface CompilerSpec
        Returns:
        prototype model corresponding to the specified function signature
      • getProperty

        public java.lang.String getProperty​(java.lang.String key)
        Description copied from interface: CompilerSpec
        Gets a property defined for this language, or null if that property isn't defined.
        Specified by:
        getProperty in interface CompilerSpec
        Parameters:
        key - the property key
        Returns:
        the property value, or null if not defined
      • getPropertyKeys

        public java.util.Set<java.lang.String> getPropertyKeys()
        Description copied from interface: CompilerSpec
        Returns a read-only set view of the property keys defined on this language.
        Specified by:
        getPropertyKeys in interface CompilerSpec
        Returns:
        read-only set of property keys
      • getProperty

        public java.lang.String getProperty​(java.lang.String key,
                                            java.lang.String defaultString)
        Description copied from interface: CompilerSpec
        Gets the value of a property as a String, returning defaultString if undefined.
        Specified by:
        getProperty in interface CompilerSpec
        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
      • getPropertyAsBoolean

        public boolean getPropertyAsBoolean​(java.lang.String key,
                                            boolean defaultBoolean)
        Description copied from interface: CompilerSpec
        Gets the value of a property as a boolean, returning defaultBoolean if undefined.
        Specified by:
        getPropertyAsBoolean in interface CompilerSpec
        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
      • getPropertyAsInt

        public int getPropertyAsInt​(java.lang.String key,
                                    int defaultInt)
        Description copied from interface: CompilerSpec
        Gets the value of a property as an int, returning defaultInt if undefined.
        Specified by:
        getPropertyAsInt in interface CompilerSpec
        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
      • hasProperty

        public boolean hasProperty​(java.lang.String key)
        Description copied from interface: CompilerSpec
        Returns whether this lanugage has a property defined.
        Specified by:
        hasProperty in interface CompilerSpec
        Parameters:
        key - the property key
        Returns:
        if the property is defined
      • enableJavaLanguageDecompilation

        public static void enableJavaLanguageDecompilation​(Program program)
        Adds and enables an option to have the decompiler display java.
        Parameters:
        program - to be enabled