Ignore:
Timestamp:
Jan 21, 2016, 5:15:33 PM (3 years ago)
Author:
nmedfort
Message:

Work on lowering + some timing and papi information that will be cleaned up later.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r4900 r4919  
    4747#include <llvm/ADT/Twine.h>
    4848#include <iostream>
     49#include <llvm/Support/raw_ostream.h>
     50#include <llvm/Support/FileSystem.h>
     51
     52//#include <llvm/PassManager.h>
     53//#include <llvm/Transforms/IPO/PassManagerBuilder.h>
     54
     55#include <hrtime.h>
    4956
    5057static cl::OptionCategory eIRDumpOptions("LLVM IR Dump Options", "These options control dumping of LLVM IR.");
    5158static cl::opt<bool> DumpGeneratedIR("dump-generated-IR", cl::init(false), cl::desc("Print LLVM IR generated by Pablo Compiler."), cl::cat(eIRDumpOptions));
     59static cl::opt<std::string> IROutputFilename("dump-generated-IR-output", cl::init(""), cl::desc("output IR filename"), cl::cat(eIRDumpOptions));
     60
    5261
    5362static cl::OptionCategory fTracingOptions("Run-time Tracing Options", "These options control execution traces.");
     
    7685llvm::Function * PabloCompiler::compile(PabloFunction * function) {
    7786
     87    #ifdef PRINT_TIMING_INFORMATION
     88    const timestamp_t pablo_compilation_start = read_cycle_counter();
     89    #endif
    7890 
    7991    PabloBlock * const mainScope = function->getEntryBlock();
     
    126138   
    127139    // Clean up
    128     delete mCarryManager; mCarryManager = nullptr;
    129    
     140    delete mCarryManager;
     141    mCarryManager = nullptr;
     142   
     143    #ifdef PRINT_TIMING_INFORMATION
     144    const timestamp_t pablo_compilation_end = read_cycle_counter();
     145    std::cerr << "PABLO COMPILATION TIME: " << (pablo_compilation_end - pablo_compilation_start) << std::endl;
     146    #endif
     147
     148//    llvm::PassManager pm;
     149//    llvm::PassManagerBuilder pmb;
     150//    pmb.OptLevel = 3;
     151//    pmb.populateModulePassManager(pm);
     152//    pm.run(*mMod);
     153
    130154    if (LLVM_UNLIKELY(DumpGeneratedIR)) {
    131         mMod->dump();
     155
     156        if (IROutputFilename.empty()) {
     157            mMod->dump();
     158        } else {
     159            std::error_code error;
     160            llvm::raw_fd_ostream out(IROutputFilename, error, sys::fs::OpenFlags::F_None);
     161            mMod->print(out, nullptr);
     162        }
    132163    }
    133164
Note: See TracChangeset for help on using the changeset viewer.