Ignore:
Timestamp:
May 10, 2017, 4:26:11 PM (2 years ago)
Author:
nmedfort
Message:

Large refactoring step. Removed IR generation code from Kernel (formally KernelBuilder?) and moved it into the new KernelBuilder? class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/IR_Gen/CBuilder.h

    r5436 r5440  
    1010#include <llvm/IR/Constants.h>
    1111#include <llvm/ADT/Triple.h>
     12#ifndef NDEBUG
     13#include <llvm/IR/Function.h>
     14#endif
    1215
    1316namespace kernels { class KernelBuilder; }
     
    3033
    3134    llvm::Module * getModule() const {
    32         return mMod;
    33     }
    34 
    35     void setModule(llvm::Module * const mod) {
    36         mMod = mod;
     35        #ifndef NDEBUG
     36        llvm::BasicBlock * const bb = GetInsertBlock();
     37        if (bb) {
     38            llvm::Function * const f = bb->getParent();
     39            assert ("CBuilder has an insert point that is not contained within a Function" && f);
     40            assert ("CBuilder module differs from insertion point module" && (mModule == f->getParent()));
     41        }
     42        #endif
     43        return mModule;
     44    }
     45
     46    void setModule(llvm::Module * module) {
     47        mModule = module;
     48        ClearInsertionPoint();
    3749    }
    3850
     
    173185    }
    174186
     187    llvm::BasicBlock * CreateBasicBlock(std::string && name);
     188
    175189    virtual bool supportsIndirectBr() const {
    176190        return true;
     
    210224
    211225protected:
    212     llvm::Module *                  mMod;
     226
     227    llvm::Module *                  mModule;
    213228    unsigned                        mCacheLineAlignment;
    214229    llvm::IntegerType *             mSizeType;
Note: See TracChangeset for help on using the changeset viewer.