Skip to content

Commit

Permalink
MLIR: #1 Command Line Flags - Introduces MLIR in the CL options
Browse files Browse the repository at this point in the history
  • Loading branch information
Robertorosmaninho committed Feb 8, 2020
1 parent 3f5e526 commit c92d161
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions dmd/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ struct Param

// LDC stuff
OUTPUTFLAG output_ll;
OUTPUTFLAG output_mlir;
OUTPUTFLAG output_bc;
OUTPUTFLAG output_s;
OUTPUTFLAG output_o;
Expand Down Expand Up @@ -293,6 +294,7 @@ struct Global
DString obj_ext;
#if IN_LLVM
DString ll_ext;
DString mlir_ext; //MLIR code
DString bc_ext;
DString s_ext;
DString ldc_version;
Expand Down
1 change: 1 addition & 0 deletions driver/cl_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ extern cl::opt<std::string> objectDir;
extern cl::opt<std::string> soname;
extern cl::opt<bool> output_bc;
extern cl::opt<bool> output_ll;
extern cl::opt<bool> output_mlir;
extern cl::opt<bool> output_s;
extern cl::opt<cl::boolOrDefault> output_o;
extern cl::opt<std::string> ddocDir;
Expand Down
8 changes: 7 additions & 1 deletion driver/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,13 @@ void parseCommandLine(Strings &sourceFiles) {

global.params.output_o =
(opts::output_o == cl::BOU_UNSET &&
!(opts::output_bc || opts::output_ll || opts::output_s))
!(opts::output_bc || opts::output_ll || opts::output_s ||
opts::output_mlir))
? OUTPUTFLAGdefault
: opts::output_o == cl::BOU_TRUE ? OUTPUTFLAGset : OUTPUTFLAGno;
global.params.output_bc = opts::output_bc ? OUTPUTFLAGset : OUTPUTFLAGno;
global.params.output_ll = opts::output_ll ? OUTPUTFLAGset : OUTPUTFLAGno;
global.params.output_mlir = opts::output_mlir ? OUTPUTFLAGset : OUTPUTFLAGno;
global.params.output_s = opts::output_s ? OUTPUTFLAGset : OUTPUTFLAGno;

global.params.cov = (global.params.covPercent <= 100);
Expand Down Expand Up @@ -503,6 +505,10 @@ void parseCommandLine(Strings &sourceFiles) {
strcmp(ext, global.s_ext.ptr) == 0) {
global.params.output_s = OUTPUTFLAGset;
global.params.output_o = OUTPUTFLAGno;
}else if(opts::output_mlir.getNumOccurrences() == 0 &&
strcmp(ext, global.mlir_ext.ptr) == 0) {
global.params.output_mlir = OUTPUTFLAGset;
global.params.output_o = OUTPUTFLAGno;
}
}

Expand Down

0 comments on commit c92d161

Please sign in to comment.