Ignore:
Timestamp:
Sep 14, 2016, 2:56:54 PM (3 years ago)
Author:
nmedfort
Message:

Work on multiplexing and distribution passes + a few AST modification bug fixes.

File:
1 edited

Legend:

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

    r5151 r5156  
    3838static cl::opt<std::string> IROutputFilename("dump-generated-IR-output", cl::init(""), cl::desc("output IR filename"), cl::cat(CodeGenOptions));
    3939static cl::opt<bool> DumpASM("DumpASM", cl::init(false), cl::desc("Print Assembly Code."), cl::cat(CodeGenOptions));
     40static cl::opt<std::string> ASMOutputFilename("asm-output", cl::init(""), cl::desc("output ASM filename"), cl::cat(CodeGenOptions));
    4041static cl::opt<bool> AsmVerbose("asm-verbose",
    4142                                cl::desc("Add comments to directives."),
     
    126127
    127128    llvm::SmallString<128> Str;
    128     llvm::raw_svector_ostream dest(Str);
    129 
    130     if (TM->addPassesToEmitFile( PM , dest , llvm::TargetMachine::CGFT_AssemblyFile ) ) {
    131       std::cout << "addPassesToEmitFile failed\n";
    132       exit(1);
     129    llvm::raw_svector_ostream dest(Str);
     130
     131    if (TM->addPassesToEmitFile(PM, dest, llvm::TargetMachine::CGFT_AssemblyFile ) ) {
     132        throw std::runtime_error("LLVM error: addPassesToEmitFile failed.");
    133133    }
    134134    PM.run(*m);
    135     std::cerr << std::string( Str.c_str() ) << "\n";
     135
     136    if (codegen::ASMOutputFilename.empty()) {
     137        errs() << Str;
     138    } else {
     139        std::error_code error;
     140        llvm::raw_fd_ostream out(codegen::ASMOutputFilename, error, sys::fs::OpenFlags::F_None);
     141        out << Str;
     142    }
    136143}
    137144
Note: See TracChangeset for help on using the changeset viewer.