From eefdae5d755c8f5f6dcbdf19fe6919076aa65a02 Mon Sep 17 00:00:00 2001
From: Reid Spencer
+
Name | -Value Type | -Description | -Default | -
---|---|---|---|
LANG ITEMS | |||
lang.name | -string | -Provides the common name for a language definition. - For example "C++", "Pascal", "FORTRAN", etc. | -blank | -
lang.opt1 | -string | -Specifies the parameters to give the optimizer when -O1 is - specified on the llvmc command line. | --simplifycfg -instcombine -mem2reg | -
lang.opt2 | -string | -Specifies the parameters to give the optimizer when -O2 is - specified on the llvmc command line. | -TBD | -
lang.opt3 | -string | -Specifies the parameters to give the optimizer when -O3 is - specified on the llvmc command line. | -TBD | -
lang.opt4 | -string | -Specifies the parameters to give the optimizer when -O4 is - specified on the llvmc command line. | -TBD | -
lang.opt5 | -string | -Specifies the parameters to give the optimizer when -O5 is - specified on the llvmc command line. | -TBD | -
PREPROCESSOR ITEMS | |||
preprocessor.command | -command | -This provides the command prototype that will be used - to run the preprocessor. Valid substitutions are @in@ for the - input file and @out@ for the output file. This is generally only - used with the -E option. | -<blank> | -
preprocessor.required | -boolean | -This item specifies whether the pre-processing phase - is required by the language. If the value is true, then the - preprocessor.command value must not be blank. With this option, - llvmc will always run the preprocessor as it assumes that the - translation and optimization phases don't know how to pre-process their - input. | -false | -
TRANSLATOR ITEMS | |||
translator.command | -command | -This provides the command prototype that will be used - to run the translator. Valid substitutions are @in@ for the - input file and @out@ for the output file. | -<blank> | -
translator.output | -native, bytecode or assembly | -This item specifies the kind of output the language's - translator generates. | -bytecode | -
translator.preprocesses | -boolean | -Indicates that the translator also preprocesses. If this is true, then - llvmc will skip the pre-processing phase whenever the final - phase is not pre-processing. | -false | -
translator.optimizers | -boolean | -Indicates that the translator also optimizes. If this is true, then - llvmc will skip the optimization phase whenever the final phase - is optimization or later. | -false | -
translator.groks_dash_o | -boolean | -Indicates that the translator understands the intent of the - various -On options to llvmc. This will cause the - -On option to be based to the translator instead of the - equivalent options provided by lang.optn. | -false | -
OPTIMIZER ITEMS | |||
ASSEMBLER ITEMS | |||
LINKER ITEMS | |||
Name | +Value Type | +Description | +Default | +
LANG ITEMS | |||
lang.name | +string | +Provides the common name for a language definition. + For example "C++", "Pascal", "FORTRAN", etc. | +blank | +
lang.opt1 | +string | +Specifies the parameters to give the optimizer when + -O1 is specified on the llvmc command line. | +-simplifycfg -instcombine -mem2reg | +
lang.opt2 | +string | +Specifies the parameters to give the optimizer when + -O2 is specified on the llvmc command line. | +TBD | +
lang.opt3 | +string | +Specifies the parameters to give the optimizer when + -O3 is specified on the llvmc command line. | +TBD | +
lang.opt4 | +string | +Specifies the parameters to give the optimizer when + -O4 is specified on the llvmc command line. | +TBD | +
lang.opt5 | +string | +Specifies the parameters to give the optimizer when + -O5 is specified on the llvmc command line. | +TBD | +
PREPROCESSOR ITEMS | |||
preprocessor.command | +command | +This provides the command prototype that will be used + to run the preprocessor. This is generally only used with the + -E option. | +<blank> | +
preprocessor.required | +boolean | +This item specifies whether the pre-processing phase + is required by the language. If the value is true, then the + preprocessor.command value must not be blank. With this option, + llvmc will always run the preprocessor as it assumes that the + translation and optimization phases don't know how to pre-process their + input. | +false | +
TRANSLATOR ITEMS | |||
translator.command | +command | +This provides the command prototype that will be used + to run the translator. Valid substitutions are @in@ for the + input file and @out@ for the output file. | +<blank> | +
translator.output | +native, bytecode or assembly | +This item specifies the kind of output the language's + translator generates. | +bytecode | +
translator.preprocesses | +boolean | +Indicates that the translator also preprocesses. If + this is true, then llvmc will skip the pre-processing phase + whenever the final phase is not pre-processing. | +false | +
translator.optimizers | +boolean | +Indicates that the translator also optimizes. If + this is true, then llvmc will skip the optimization phase + whenever the final phase is optimization or later. | +false | +
translator.groks_dash_o | +boolean | +Indicates that the translator understands the + intent of the various -On options to + llvmc. This will cause the -On option to be + given to the translator instead of the equivalent options provided by + lang.optn. | +false | +
OPTIMIZER ITEMS | |||
optimizer.command | +command | +This provides the command prototype that will be used + to run the optimizer. Valid substitutions are @in@ for the + input file and @out@ for the output file. | +<blank> | +
optimizer.output | +native, bytecode or assembly | +This item specifies the kind of output the language's + optimizer generates. | +bytecode | +
optimizer.preprocesses | +boolean | +Indicates that the optimizer also preprocesses. If + this is true, then llvmc will skip the pre-processing phase + whenever the final phase is optimization or later. | +false | +
optimizer.translates | +boolean | +Indicates that the optimizer also translates. If + this is true, then llvmc will skip the translation phase + whenever the final phase is optimization or later. | +false | +
optimizer.groks_dash_o | +boolean | +Indicates that the translator understands the + intent of the various -On options to + llvmc. This will cause the -On option to be + given to the translator instead of the equivalent options provided by + lang.optn. | +false | +
ASSEMBLER ITEMS | |||
assembler.command | +command | +This provides the command prototype that will be used + to run the assembler. Valid substitutions are @in@ for the + input file and @out@ for the output file. | +<blank> | +
LINKER ITEMS | |||
linker.libs | +library names | +This provides the list of runtime libraries that the + source language could link with. In general, the libraries + needed will be encoded into the LLVM Assembly or bytecode file. + However, this list tells llvmc the names of the ones that + apply to this source language. The names provided here should be + unadorned with no suffix and no "lib" prefix. + | +<blank> | +
linker.lib_paths | +Fully qualifed local path names | +This item provides a list of potential directories + in which the source language's runtime libraries might be located. If + a given object file compiled with this language's translator is linked + then those libraries will be given as -L options to the + linker. | +<blank> | +
linker.output | +native, bytecode or assembly | +This item specifies the kind of output the language's + translator generates. | +bytecode | +
On any configruation item that ends in command, you must + specify substitution tokens. Substitution tokens begin and end with a percent + sign (%) and are replaced by the corresponding text. Any substitution + token may be given on any command line but some are more useful than + others. In particular each command should have both an %in% + and an %out% substittution. The table below provides definitions of + each of the allowed substitution tokens.
+Substitution Token | +Replacement Description | +
---|---|
%args% | +Replaced with all the tool-specific arguments given + to llvmc via the -T set of options. This just allows + you to place these arguments in the correct place on the command line. + If the %args% option does not appear on your command line, then you + are explicitly disallowing the -T option for your tool. + | +
%in% | +Replaced with the full path of the input file. You + needn't worry about the cascading of file names. llvmc will + create temporary files and ensure that the output of one phase is the + input to the next phase. | +
%opt% | +Replaced with the optimization options for the + tool. If the tool understands the -O options then that will + be passed. Otherwise, the lang.optN series of configuration + items will specify which arguments are to be given. | +
%out% | +Replaced with the full path of the output file. + Note that this is not necessarily the output file specified with the + -o option on llvmc's command line. It might be a + temporary file that will be passed to a subsequent phase's input. + | +
%stats% | +If your command accepts the -stats option, + use this substitution token. If the user requested -stats + from the llvmc command line then this token will be replaced + with -stats, otherwise it will be ignored. + | +
%target% | +Replaced with the name of the target "machine" for + which code should be generated. The value used here is taken from the + llvmc option -march. + | +
%time% | +If your command accepts the -time-passes + option, use this substitution token. If the user requested + -time-passes from the llvmc command line then this + token will be replaced with -time-passes, otherwise it will + be ignored. + | +
Since an example is always instructive, here's how the Stacker language + configuration file looks.
++# Stacker Configuration File For llvmc + +########################################################## +# Language definitions +########################################################## + lang.name=Stacker + lang.opt1=-simplifycfg -instcombine -mem2reg + lang.opt2=-simplifycfg -instcombine -mem2reg -load-vn \ + -gcse -dse -scalarrepl -sccp + lang.opt3=-simplifycfg -instcombine -mem2reg -load-vn \ + -gcse -dse -scalarrepl -sccp -branch-combine -adce \ + -globaldce -inline -licm -pre + lang.opt4=-simplifycfg -instcombine -mem2reg -load-vn \ + -gcse -dse -scalarrepl -sccp -ipconstprop \ + -branch-combine -adce -globaldce -inline -licm -pre + lang.opt5=-simplifycfg -instcombine -mem2reg --load-vn \ + -gcse -dse scalarrepl -sccp -ipconstprop \ + -branch-combine -adce -globaldce -inline -licm -pre \ + -block-placement + +########################################################## +# Pre-processor definitions +########################################################## + + # Stacker doesn't have a preprocessor but the following + # allows the -E option to be supported + preprocessor.command=cp %in% %out% + preprocessor.required=false + +########################################################## +# Translator definitions +########################################################## + + # To compile stacker source, we just run the stacker + # compiler with a default stack size of 2048 entries. + translator.command=stkrc -s 2048 %in% -o %out% %time% \ + %stats% %args% + + # stkrc doesn't preprocess but we set this to true so + # that we don't run the cp command by default. + translator.preprocesses=true + + # The translator is required to run. + translator.required=true + + # stkrc doesn't do any optimization, it just translates + translator.optimizes=no + + # stkrc doesn't handle the -On options + translator.groks_dash_O=no + +########################################################## +# Optimizer definitions +########################################################## + + # For optimization, we use the LLVM "opt" program + optimizer.command=opt %in% -o %out% %opt% %time% %stats% \ + %args% + + # opt doesn't (yet) grok -On + optimizer.groks_dash_O=no + + # opt doesn't translate + optimizer.translates = no + + # opt doesn't preprocess + optimizer.preprocesses=no + +########################################################## +# Assembler definitions +########################################################## + assembler.command=llc %in% -o %out% %target% \ + "-regalloc=linearscan" %time% %stats% + +########################################################## +# Linker definitions +########################################################## + linker.libs=stkr_runtime + linker.paths= ++ + -- 2.34.1