The Reference Implementation¶
The so-called “reference compiler” is the compiler the LRDE develops to (i) prototype what students will have to implement, and to (ii) control the output from student compilers. It might be useful to some to see the name we gave to our options. The following is informative only, the exact contract for a conforming implementation of a Tiger compiler is defined above, Implementation.
$ tc --help
Tiger Compiler, Copyright (C) 2004-2018 LRDE.:
0. Tasks:
--task-list list registered tasks
--task-graph show task graph
--task-selection list tasks to be run
--time-report report execution times
1. Parsing:
--scan-trace trace the scanning
--parse-trace trace the parse
--prelude STRING name of the prelude. Defaults to
"builtin" denoting the builtin prelude
-X [ --no-prelude ] don't include prelude
--parse parse a file
--library-display display library search path
-P [ --library-append ] DIR append directory DIR to the search path
-p [ --library-prepend ] DIR prepend directory DIR to the search path
2. Abstract Syntax Tree:
-A [ --ast-display ] display the AST
--ast-dump dump the AST
--tikz-style enable TikZ-style output in AST dumping
2.5 Cloning:
--clone clone the Ast
3. Bind:
--bound default the computation of bindings to
Tiger (without objects nor overloading)
-b [ --bindings-compute ] bind the identifiers
-B [ --bindings-display ] enable bindings display in the AST
--rename rename identifiers to unique names
3. Callgraph:
--escapes-sl-compute compute the escaping static links and the
functions requiring a static link
--escapes-sl-display enable static links' escapes in the AST
--callgraph-compute build the call graph
--callgraph-dump dump the call graph
--parentgraph-compute build the parent graph
--parentgraph-dump dump the parent graph
3. Escapes:
-e [ --escapes-compute ] compute the escaping variables and the
functions requiring a static link
-E [ --escapes-display ] enable escape display in the AST
--escapes-check check that escape tags are correct
--escapes-necessary-check check that tagged variables are escaping
--escapes-sufficient-check check that escaping variables are tagged
--escapes-tags-display enable escape tags display in the AST
4. Type checking:
-T [ --typed ] default the type-checking to Tiger
(without objects nor overloading)
--types-compute check for type violations
4.5 Type checking with overloading:
--overfun-bindings-compute bind the identifiers, allowing function
overloading
-O [ --overfun-types-compute ] check for type violations, allowing
function overloading
5. Translation to High Level Intermediate Representation:
--hir-compute translate to HIR
-H [ --hir-display ] display the HIR
--hir-naive don't use "Ix" during the translation
5.5. Translation to LLVM Intermediate Representation:
--llvm-compute translate to LLVM IR
--llvm-runtime-display enable runtime displayingalong with the
LLVM IR
--llvm-display display the LLVM IR
6. Translation to Low Level Intermediate Representation:
--canon-compute canonicalize
--canon-trace trace the canonicalization of the LIR
-C [ --canon-display ] display the canonicalized IR
--traces-compute make traces
--traces-trace trace the traces computation
--lir-compute translate to LIR (alias for
--trace-compute)
-L [ --lir-display ] display the low level intermediate
representation
7. Target selection:
-i [ --inst-compute ] select the instructions
-R [ --runtime-display ] display the runtime
--inst-debug enable instructions verbose display
--rule-trace enable rule reducing display
--garbage-collection enable garbage collection
-I [ --inst-display ] display the instructions
-Y [ --nolimips-display ] display Nolimips compatible instructions
(i.e., allocate the frames and then
display the instructions
--targeted default the target to MIPS
--target-mips select MIPS as target
--target-ia32 select IA-32 as target
--target-arm select ARM as target
--target-display display the current target
--callee-save NUM max number of callee save registers
--caller-save NUM max number of caller save registers
--argument NUM max number of argument registers
8. Liveness:
-F [ --flowgraph-dump ] dump the flowgraphs
-V [ --liveness-dump ] dump the liveness graphs
-N [ --interference-dump ] dump the interference graphs
9. Register Allocation:
--asm-coalesce-disable disable coalescence
--asm-trace trace register allocation
-s [ --asm-compute ] allocate the registers
-S [ --asm-display ] display the final assembler
Desugaring and bounds-checking:
--desugar-for desugar `for' loops
--desugar-string-cmp desugar string comparisons
--desugared Default the removal of syntactic sugar
from the AST to Tiger (without
overloading)
--desugar desugar the AST
--overfun-desugar desugar the AST, allowing function
overloading
--raw-desugar desugar the AST without recomputing
bindings nor types
--bounds-checks-add add dynamic bounds checks
--overfun-bounds-checks-add add dynamic bounds checks with support
for overloading
--raw-bounds-checks-add add bounds-checking to the AST without
recomputing bindings nor types
Inlining:
--inline inline functions
--overfun-inline inline functions with support for
overloading
--prune prune unused functions
--overfun-prune prune unused functions with support for
overloading
Object:
-o [ --object ] enable object extensions
--object-parse parse a file, allowing objects
--object-bindings-compute bind the identifiers, allowing objects
--object-types-compute check for type violations, allowing
objects
--object-rename rename identifiers to unique names,
allowing objects
--object-desugar remove object constructs from the program
--raw-object-desugar remove object constructs from the program
without recomputing bindings nor types
--overfun-object-bindings-compute bind the identifiers, allowing function
overloading with object
--overfun-object-types-compute check for type violations, allowing
function overloading with object
--overfun-object-rename rename identifiers to unique names,
allowing function overloading with
objects
--overfun-object-desugar remove object constructs from the
programallowing function overloading with
objects
Temporaries:
--tempmap-display display the temporary table
-? [ --help ] Give this help list
--usage Give a short usage message
--version Print program version