Changeset 5745
- Timestamp:
- Nov 26, 2017, 12:09:25 PM (15 months ago)
- Location:
- icGREP/icgrep-devel/icgrep/toolchain
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
icGREP/icgrep-devel/icgrep/toolchain/cpudriver.cpp
r5735 r5745 148 148 149 149 legacy::PassManager PM; 150 if (LLVM_UNLIKELY(codegen:: DebugOptionIsSet(codegen::ShowUnoptimizedIR))) {150 if (LLVM_UNLIKELY(codegen::ShowUnoptimizedIROption != codegen::OmittedOption)) { 151 151 if (LLVM_LIKELY(mIROutputStream == nullptr)) { 152 if (codegen:: IROutputFilename) {152 if (codegen::ShowUnoptimizedIROption != "") { 153 153 std::error_code error; 154 mIROutputStream = new raw_fd_ostream(codegen:: IROutputFilename, error, sys::fs::OpenFlags::F_None);154 mIROutputStream = new raw_fd_ostream(codegen::ShowUnoptimizedIROption, error, sys::fs::OpenFlags::F_None); 155 155 } else { 156 156 mIROutputStream = new raw_fd_ostream(STDERR_FILENO, false, true); … … 170 170 PM.add(createCFGSimplificationPass()); // Repeat CFG Simplification to "clean up" any newly found redundant phi nodes 171 171 172 if (LLVM_UNLIKELY(codegen:: DebugOptionIsSet(codegen::ShowIR))) {172 if (LLVM_UNLIKELY(codegen::ShowIROption != codegen::OmittedOption)) { 173 173 if (LLVM_LIKELY(mIROutputStream == nullptr)) { 174 if (codegen:: IROutputFilename) {174 if (codegen::ShowIROption != "") { 175 175 std::error_code error; 176 mIROutputStream = new raw_fd_ostream(codegen:: IROutputFilename, error, sys::fs::OpenFlags::F_None);176 mIROutputStream = new raw_fd_ostream(codegen::ShowIROption, error, sys::fs::OpenFlags::F_None); 177 177 } else { 178 178 mIROutputStream = new raw_fd_ostream(STDERR_FILENO, false, true); … … 183 183 184 184 #if LLVM_VERSION_INTEGER >= LLVM_3_7_0 185 if (LLVM_UNLIKELY(codegen:: DebugOptionIsSet(codegen::ShowASM))) {186 if (codegen:: ASMOutputFilename) {185 if (LLVM_UNLIKELY(codegen::ShowASMOption != codegen::OmittedOption)) { 186 if (codegen::ShowASMOption != "") { 187 187 std::error_code error; 188 mASMOutputStream = new raw_fd_ostream(codegen:: ASMOutputFilename, error, sys::fs::OpenFlags::F_None);188 mASMOutputStream = new raw_fd_ostream(codegen::ShowASMOption, error, sys::fs::OpenFlags::F_None); 189 189 } else { 190 190 mASMOutputStream = new raw_fd_ostream(STDERR_FILENO, false, true); -
icGREP/icgrep-devel/icgrep/toolchain/toolchain.cpp
r5738 r5745 23 23 24 24 static cl::bits<DebugFlags> 25 DebugOptions(cl::values(clEnumVal(ShowUnoptimizedIR, "Print generated LLVM IR."), 26 clEnumVal(ShowIR, "Print optimized LLVM IR."), 27 clEnumVal(VerifyIR, "Run the IR verification pass."), 28 #if LLVM_VERSION_INTEGER >= LLVM_3_7_0 29 clEnumVal(ShowASM, "Print assembly code."), 30 #endif 25 DebugOptions(cl::values(clEnumVal(VerifyIR, "Run the IR verification pass."), 31 26 clEnumVal(SerializeThreads, "Force segment threads to run sequentially."), 32 27 clEnumVal(TraceCounts, "Show kernel processed and produced item counts."), … … 36 31 CL_ENUM_VAL_SENTINEL), cl::cat(CodeGenOptions)); 37 32 38 static cl::opt<std::string> IROutputFilenameOption("dump-generated-IR-output", cl::init(""), 39 cl::desc("output IR filename"), cl::cat(CodeGenOptions)); 33 std::string ShowIROption = OmittedOption; 34 static cl::opt<std::string, true> IROutputOption("ShowIR", cl::location(ShowIROption), cl::ValueOptional, 35 cl::desc("Print optimized LLVM IR to stderr (by omitting =<filename>) or a file"), cl::value_desc("filename"), cl::cat(CodeGenOptions)); 36 37 std::string ShowUnoptimizedIROption = OmittedOption; 38 static cl::opt<std::string, true> UnoptimizedIROutputOption("ShowUnoptimizedIR", cl::location(ShowUnoptimizedIROption), cl::ValueOptional, 39 cl::desc("Print generated LLVM IR to stderr (by omitting =<filename> or a file"), cl::value_desc("filename"), cl::cat(CodeGenOptions)); 40 40 41 41 #if LLVM_VERSION_INTEGER >= LLVM_3_7_0 42 static cl::opt<std::string> ASMOutputFilenameOption("asm-output", cl::init(""), 43 cl::desc("output ASM filename"), cl::cat(CodeGenOptions)); 44 45 static cl::opt<bool> AsmVerbose("asm-verbose", cl::init(true), 46 cl::desc("Add comments to directives."), cl::cat(CodeGenOptions)); 42 std::string ShowASMOption = OmittedOption; 43 static cl::opt<std::string, true> ASMOutputFilenameOption("ShowASM", cl::location(ShowASMOption), cl::ValueOptional, 44 cl::desc("Print generated assembly code to stderr (by omitting =<filename> or a file"), cl::value_desc("filename"), cl::cat(CodeGenOptions)); 47 45 #endif 48 46 … … 90 88 91 89 bool SegmentPipelineParallel; 92 93 const char * ASMOutputFilename;94 95 const char * IROutputFilename;96 90 97 91 const char * ObjectCacheDir; … … 160 154 #endif 161 155 cl::ParseCommandLineOptions(argc, argv); 162 if (DebugOptions.getBits() ) {156 if (DebugOptions.getBits() || (ShowIROption != OmittedOption) || (ShowUnoptimizedIROption != OmittedOption) || (ShowASMOption != OmittedOption)) { 163 157 EnableObjectCache = false; 164 158 } 165 159 ObjectCacheDir = ObjectCacheDirOption.empty() ? nullptr : ObjectCacheDirOption.data(); 166 IROutputFilename = IROutputFilenameOption.empty() ? nullptr : IROutputFilenameOption.data();167 ASMOutputFilename = ASMOutputFilenameOption.empty() ? nullptr : ASMOutputFilenameOption.data();168 160 Options = InitTargetOptionsFromCodeGenFlags(); 169 161 #if LLVM_VERSION_INTEGER >= LLVM_3_7_0 170 Options.MCOptions.AsmVerbose = AsmVerbose;162 Options.MCOptions.AsmVerbose = true; 171 163 #endif 172 164 switch (OptLevelOption) { -
icGREP/icgrep-devel/icgrep/toolchain/toolchain.h
r5734 r5745 42 42 // Command Parameters 43 43 enum DebugFlags { 44 ShowUnoptimizedIR,45 ShowIR,46 44 VerifyIR, 47 #if LLVM_VERSION_INTEGER >= LLVM_3_7_048 ShowASM,49 #endif50 45 SerializeThreads, 51 46 TraceCounts, … … 60 55 extern bool PipelineParallel; 61 56 extern bool SegmentPipelineParallel; 57 58 // Options for generating IR or ASM to files 59 const std::string OmittedOption = "."; 60 extern std::string ShowUnoptimizedIROption; 61 extern std::string ShowIROption; 62 62 #if LLVM_VERSION_INTEGER >= LLVM_3_7_0 63 extern const char * ASMOutputFilename;63 extern std::string ShowASMOption; 64 64 #endif 65 extern const char * IROutputFilename;66 65 extern const char * ObjectCacheDir; 67 66 extern llvm::CodeGenOpt::Level OptLevel; // set from command line
Note: See TracChangeset
for help on using the changeset viewer.