cscm.X86_CompilerModel¶
- class
cscm.X86_CompilerModel¶ -
Bases:
cscm.CompilerModelA subclass of
CompilerModelthat provides implementations ofget_prepend_flags()andget_append_flags()with some default arguments used in all x86 compiler models.Subclass this if you are defining a custom x86 compiler model.
This class should not have any member variables or state. If you think you need to add mutable member variables to this class, you probably need to add locals to
__call__().Methods
__call__()Implement this function to generate and return a CompilerModelResultbased on a list of arguments passed from the command line and aParseConfiguration.__init__()Default initializer. get_append_flags()Get a list of flags to be appended to the raw arguments, containing some default arguments used in all x86 compiler models. get_prepend_flags()Get a list of flags to be prepended to the raw arguments, containing some default arguments used in all x86 compiler models. name()All compiler models must implement this to return a unique name for the model. translate_raw_args()Takes in a list of arguments, augments it with relevant prepends/appends, and invokes __call__()on the result.verbose_name()All compiler models must implement this to return a verbose version of the model name. -
__call__(args, config)¶ -
Implement this function to generate and return a
CompilerModelResultbased on a list of arguments passed from the command line and aParseConfiguration.Parameters: - args (iterable of str) –
- config (
ParseConfiguration) –
Returns: A
CompilerModelResultobject containing a list ofFrontEndCommandobjects: one for every source file on the native command line.Return type: This function should take all the arguments that the modeled compiler recognizes and turn them into front end arguments. For example, it could take something like
--define BUNCAKE=0x12and turn it into-DBUNCAKE=0x12In many cases, reading the arguments in args is not enough. The model may have to invoke the compiler to obtain things like version information or predefined macros. It may need to read additional arguments from a file. Or maybe examine various environment variables.
Usually you do not need to care about the information in
config. You could, for instance, print out extra information ifconfig.get_verbose()returns non-zero.
-
__init__()¶ -
Default initializer.
Note that you will need to create an instance of your compiler model class to pass to
register_compiler_model().
-
get_append_flags(config)¶ -
Get a list of flags to be appended to the raw arguments, containing some default arguments used in all x86 compiler models.
Parameters: config ( ParseConfiguration) –Returns: A list of flags to be appended to the raw arguments. Return type: [str] Override this function in your subclass if you want to append additional flags (or a different set of flags entirely).
-
get_prepend_flags(config)¶ -
Get a list of flags to be prepended to the raw arguments, containing some default arguments used in all x86 compiler models.
Parameters: config ( ParseConfiguration) –Returns: A list of flags to be prepended to the raw arguments. Return type: [str] Override this function in your subclass if you want to prepend additional flags (or a different set of flags entirely).
-
name()¶ -
All compiler models must implement this to return a unique name for the model.
If you want to register a single model under multiple names, construct multiple instances of your class, each of which has a different name() return value, then register each instance with cscm.register_compiler_model().Returns: The base name of this compiler model. Return type: str This will generally entail defining a nondefault initializer, then basing the name() return value on the argument or arguments provided to that initializer.
-
translate_raw_args(args, config)¶ -
Takes in a list of arguments, augments it with relevant prepends/appends, and invokes
__call__()on the result.Parameters: - args (iterable of str) –
- config (
ParseConfiguration) –
Return type: You will not usually need to modify this function.
-
verbose_name()¶ -
All compiler models must implement this to return a verbose version of the model name.
Returns: The verbose name of this compiler model. In general this will consist of the full name for the compiler, including the name of the vendor. Return type: str
-