CS153/hw6
jmug cfe502c598 Add all the assignment code.
Signed-off-by: jmug <u.g.a.mariano@gmail.com>
2025-01-24 18:59:28 -08:00
..
hw5programs Add all the assignment code. 2025-01-24 18:59:28 -08:00
ll Add all the assignment code. 2025-01-24 18:59:28 -08:00
llprograms Add all the assignment code. 2025-01-24 18:59:28 -08:00
oatprograms Add all the assignment code. 2025-01-24 18:59:28 -08:00
util Add all the assignment code. 2025-01-24 18:59:28 -08:00
x86 Add all the assignment code. 2025-01-24 18:59:28 -08:00
.ocamlinit Add all the assignment code. 2025-01-24 18:59:28 -08:00
alias.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
analysis.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
analysistests.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
ast.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
astlib.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
backend.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
cfg.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
cinterop.c Add all the assignment code. 2025-01-24 18:59:28 -08:00
constprop.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
datastructures.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
dce.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
driver.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
dune Add all the assignment code. 2025-01-24 18:59:28 -08:00
dune-project Add all the assignment code. 2025-01-24 18:59:28 -08:00
frontend-break.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
frontend.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
gradedtests.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
lexer.mll Add all the assignment code. 2025-01-24 18:59:28 -08:00
liveness.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
main.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
Makefile Add all the assignment code. 2025-01-24 18:59:28 -08:00
opt.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
parser.mly Add all the assignment code. 2025-01-24 18:59:28 -08:00
printanalysis.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
README Add all the assignment code. 2025-01-24 18:59:28 -08:00
registers.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
runtime.c Add all the assignment code. 2025-01-24 18:59:28 -08:00
solver.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
tctxt.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00
team.txt Add all the assignment code. 2025-01-24 18:59:28 -08:00
typechecker.ml Add all the assignment code. 2025-01-24 18:59:28 -08:00

Using main.native for testing:

* To run the automated test harness do:
  - on OS X:   ./main.native --test              
  - on Linux:  ./main.native -linux --test     

* To compile ll files using the Compiler Design backend:
  ./main.native path/to/foo.ll 

  - creates output/foo.s   backend assembly code
  - creates output/foo.o   assembled object file
  - creates a.out          linked executable

 NOTE: by default the .s and .o files are created in 
 a directory called output, and the filenames are 
 chosen so that multiple runs of the compiler will
 not overwrite previous outputs.  foo.ll will be 
 compiled first to foo.s then foo_1.s, foo_2.s, etc.


* To compile ll files using the clang backend:
  ./main.native --clang path/to/foo.ll

* Useful flags:

  --print-ll 
    echoes the ll program to the terminal

  --print-x86
    echoes the resulting .s file to the terminal

  --simulate-x86
    runs the resulting .s file through the reference 
    x86 simulator and outputs the result to the console

  --execute-x86
    runs the resulting a.out file natively
    (applies to either the Compiler Design backend or clang-compiled code)

  -v
    generates verbose output, showing which commands are used
    for linking, etc.

  -op <dirname>
    change the output path [DEFAULT=output]

  -o 
    change the generated executable's name [DEFAULT=a.out]

  -S
    stop after generating .s files 

  -c 
    stop after generating .o files 

  -h or --help
    display the list of options

* Example uses:

Run the test case /programs/factrect.ll using the Compiler Design backend:


./main.native --execute-x86 programs/factrect.ll 
--------------------------------------------------------------- Executing: a.out
* a.out returned 120


Run the test