Ignore:
Timestamp:
Nov 26, 2017, 12:09:25 PM (17 months ago)
Author:
cameron
Message:

ShowIR, ShowASM, ShowUnoptimizedIR options can set filename: -ShowIR=myIRfile

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/toolchain/toolchain.cpp

    r5738 r5745  
    2323
    2424static 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
     25DebugOptions(cl::values(clEnumVal(VerifyIR, "Run the IR verification pass."),
    3126                        clEnumVal(SerializeThreads, "Force segment threads to run sequentially."),
    3227                        clEnumVal(TraceCounts, "Show kernel processed and produced item counts."),
     
    3631                        CL_ENUM_VAL_SENTINEL), cl::cat(CodeGenOptions));
    3732
    38 static cl::opt<std::string> IROutputFilenameOption("dump-generated-IR-output", cl::init(""),
    39                                                        cl::desc("output IR filename"), cl::cat(CodeGenOptions));
     33std::string ShowIROption = OmittedOption;
     34static 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
     37std::string ShowUnoptimizedIROption = OmittedOption;
     38static 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));
    4040
    4141#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));
     42std::string ShowASMOption = OmittedOption;
     43static 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));
    4745#endif
    4846
     
    9088
    9189bool SegmentPipelineParallel;
    92 
    93 const char * ASMOutputFilename;
    94 
    95 const char * IROutputFilename;
    9690
    9791const char * ObjectCacheDir;
     
    160154#endif
    161155    cl::ParseCommandLineOptions(argc, argv);
    162     if (DebugOptions.getBits()) {
     156    if (DebugOptions.getBits() || (ShowIROption != OmittedOption) || (ShowUnoptimizedIROption != OmittedOption) || (ShowASMOption != OmittedOption)) {
    163157        EnableObjectCache = false;
    164158    }
    165159    ObjectCacheDir = ObjectCacheDirOption.empty() ? nullptr : ObjectCacheDirOption.data();
    166     IROutputFilename = IROutputFilenameOption.empty() ? nullptr : IROutputFilenameOption.data();
    167     ASMOutputFilename = ASMOutputFilenameOption.empty() ? nullptr : ASMOutputFilenameOption.data();
    168160    Options = InitTargetOptionsFromCodeGenFlags();
    169161#if LLVM_VERSION_INTEGER >= LLVM_3_7_0
    170     Options.MCOptions.AsmVerbose = AsmVerbose;
     162    Options.MCOptions.AsmVerbose = true;
    171163#endif
    172164    switch (OptLevelOption) {
Note: See TracChangeset for help on using the changeset viewer.