merging branch lab2-IRGen into master
This commit is contained in:
@@ -9,6 +9,7 @@ using namespace antlr4;
|
||||
#include "ASTPrinter.h"
|
||||
#include "Backend.h"
|
||||
#include "SysYIRGenerator.h"
|
||||
#include "LLVMIRGenerator.h"
|
||||
using namespace sysy;
|
||||
|
||||
static string argStopAfter;
|
||||
@@ -20,7 +21,7 @@ void usage(int code = EXIT_FAILURE) {
|
||||
"Supported options:\n"
|
||||
" -h \tprint help message and exit\n";
|
||||
" -f \tpretty-format the input file\n";
|
||||
" -s {ast,ir,asm}\tstop after generating AST/IR/Assembly\n";
|
||||
" -s {ast,ir,asm,llvmir}\tstop after generating AST/IR/Assembly\n";
|
||||
cerr << msg;
|
||||
exit(code);
|
||||
}
|
||||
@@ -83,6 +84,10 @@ int main(int argc, char **argv) {
|
||||
if (argStopAfter == "ir") {
|
||||
moduleIR->print(cout);
|
||||
return EXIT_SUCCESS;
|
||||
} else if (argStopAfter == "llvmir") {
|
||||
LLVMIRGenerator llvmirGenerator;
|
||||
cout << llvmirGenerator.getIR();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
// generate assembly
|
||||
|
||||
Reference in New Issue
Block a user