Ignore:
Timestamp:
Aug 19, 2015, 12:15:30 PM (4 years ago)
Author:
cameron
Message:

Reorganize icgrep into RE/Pablo/IR passes, support -precompiled IR

Location:
icGREP/icgrep-devel/icgrep/pablo
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/function.h

    r4726 r4734  
    7777    }
    7878
    79     static PabloFunction Create(std::string name, const unsigned numOfParameters, const unsigned numOfResults);
    80 
     79    static PabloFunction * Create(std::string name, const unsigned numOfParameters, const unsigned numOfResults);
     80   
    8181    virtual bool operator==(const PabloAST & other) const {
    8282        return &other == this;
     
    158158};
    159159
    160 inline PabloFunction PabloFunction::Create(std::string name, const unsigned numOfParameters, const unsigned numOfResults) {
    161     return PabloFunction(std::move(name), numOfParameters, numOfResults);
     160inline PabloFunction * PabloFunction::Create(std::string name, const unsigned numOfParameters, const unsigned numOfResults) {
     161    return new PabloFunction(std::move(name), numOfParameters, numOfResults);
    162162}
    163 
     163   
    164164}
    165165
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.cpp

    r4731 r4734  
    9292}
    9393
    94 llvm::Function * PabloCompiler::compile(PabloFunction & function) {
     94llvm::Function * PabloCompiler::compile(PabloFunction * function) {
    9595    Module * module = new Module("", getGlobalContext());
    9696   
     
    107107}
    108108
    109 llvm::Function * PabloCompiler::compile(PabloFunction & function, Module * module) {
     109llvm::Function * PabloCompiler::compile(PabloFunction * function, Module * module) {
    110110
    111111 
    112     PabloBlock & mainScope = function.getEntryBlock();
     112    PabloBlock & mainScope = function->getEntryBlock();
    113113
    114114    mainScope.enumerateScopes(0);
    115115   
    116     Examine(function);
     116    Examine(*function);
    117117
    118118    mMod = module;
     
    126126    if (DumpTrace) DeclareDebugFunctions();
    127127       
    128     GenerateFunction(function);
     128    GenerateFunction(*function);
    129129   
    130130    mBuilder->SetInsertPoint(BasicBlock::Create(mMod->getContext(), "entry", mFunction,0));
    131131
    132132    //The basis bits structure
    133     for (unsigned i = 0; i != function.getNumOfParameters(); ++i) {
     133    for (unsigned i = 0; i != function->getNumOfParameters(); ++i) {
    134134        Value* indices[] = {mBuilder->getInt64(0), mBuilder->getInt32(i)};
    135135        Value * gep = mBuilder->CreateGEP(mInputAddressPtr, indices);
    136         LoadInst * basisBit = mBuilder->CreateAlignedLoad(gep, BLOCK_SIZE/8, false, function.getParameter(i)->getName()->to_string());
    137         mMarkerMap[function.getParameter(i)] = basisBit;
     136        LoadInst * basisBit = mBuilder->CreateAlignedLoad(gep, BLOCK_SIZE/8, false, function->getParameter(i)->getName()->to_string());
     137        mMarkerMap[function->getParameter(i)] = basisBit;
    138138        if (DumpTrace) {
    139             genPrintRegister(function.getParameter(i)->getName()->to_string(), basisBit);
     139            genPrintRegister(function->getParameter(i)->getName()->to_string(), basisBit);
    140140        }
    141141    }
     
    158158   
    159159    // Write the output values out
    160     for (unsigned i = 0; i != function.getNumOfResults(); ++i) {
     160    for (unsigned i = 0; i != function->getNumOfResults(); ++i) {
    161161        assert (function.getResult(i));
    162         SetOutputValue(mMarkerMap[function.getResult(i)], i);
     162        SetOutputValue(mMarkerMap[function->getResult(i)], i);
    163163    }
    164164
  • icGREP/icgrep-devel/icgrep/pablo/pablo_compiler.h

    r4730 r4734  
    7676    PabloCompiler();
    7777    ~PabloCompiler();
    78     Function * compile(pablo::PabloFunction & function);
    79     Function * compile(pablo::PabloFunction & function, Module *module);
     78    Function * compile(pablo::PabloFunction * function);
     79    Function * compile(pablo::PabloFunction * function, Module *module);
    8080    Module *getModule();
    8181private:
Note: See TracChangeset for help on using the changeset viewer.