Ignore:
Timestamp:
Jan 19, 2017, 2:41:02 PM (2 years ago)
Author:
nmedfort
Message:

Code clean-up. Removed Pablo Call, SetIthBit? and Prototype.

Location:
icGREP/icgrep-devel/icgrep/IR_Gen
Files:
4 edited

Legend:

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

    r5260 r5267  
    66
    77#include "CBuilder.h"
    8 #include <llvm/IR/IRBuilder.h>
    98#include <llvm/IR/Module.h>
    109#include <llvm/IR/Constants.h>
    1110#include <llvm/IR/Intrinsics.h>
    1211#include <llvm/IR/Function.h>
    13 #include <llvm/Support/raw_ostream.h>
    1412#include <llvm/IR/TypeBuilder.h>
    1513
     
    9492    Function * malloc = m->getFunction("malloc");
    9593    if (malloc == nullptr) {
    96         Type * const voidPtrTy = getVoidPtrTy();
     94        PointerType * const voidPtrTy = getVoidPtrTy();
    9795        malloc = cast<Function>(m->getOrInsertFunction("malloc", voidPtrTy, intTy, nullptr));
    9896        malloc->setCallingConv(CallingConv::C);
     
    203201    Function * realloc = m->getFunction("realloc");
    204202    if (realloc == nullptr) {
    205         Type * const voidPtrTy = getVoidPtrTy();
     203        PointerType * const voidPtrTy = getVoidPtrTy();
    206204        realloc = cast<Function>(m->getOrInsertFunction("realloc", voidPtrTy, voidPtrTy, intTy, nullptr));
    207205        realloc->setCallingConv(CallingConv::C);
     
    230228}
    231229
    232 
    233230LoadInst * CBuilder::CreateAtomicLoadAcquire(Value * ptr) {
    234231    unsigned alignment = dyn_cast<PointerType>(ptr->getType())->getElementType()->getPrimitiveSizeInBits()/8;
     
    245242}
    246243
    247 //
    248 // int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
    249 //                    void *(*start_routine)(void*), void *arg);
    250 //
    251244Value * CBuilder::CreatePThreadCreateCall(Value * thread, Value * attr, Function * start_routine, Value * arg) {
    252245    Function * pthreadCreateFunc = mMod->getFunction("pthread_create");
     
    266259}
    267260
    268 //  #include <pthread.h>
    269 //  void pthread_exit(void *value_ptr);
    270 
    271261Value * CBuilder::CreatePThreadExitCall(Value * value_ptr) {
    272262    Function * pthreadExitFunc = mMod->getFunction("pthread_exit");
     
    281271}
    282272
    283 //  int pthread_join(pthread_t thread, void **value_ptr);
    284273Value * CBuilder::CreatePThreadJoinCall(Value * thread, Value * value_ptr){
    285274    Type * pthreadTy = getSizeTy();
     
    292281}
    293282
    294 CBuilder::CBuilder(llvm::Module * m, unsigned archBitWidth, unsigned CacheAlignment)
     283CBuilder::CBuilder(llvm::Module * m, unsigned GeneralRegisterWidthInBits, unsigned CacheLineAlignmentInBytes)
    295284: IRBuilder<>(m->getContext())
    296285, mMod(m)
    297 , mCacheLineAlignment(CacheAlignment)
    298 , mSizeType(getIntNTy(archBitWidth)) {
    299 }
     286, mCacheLineAlignment(CacheLineAlignmentInBytes)
     287, mSizeType(getIntNTy(GeneralRegisterWidthInBits)) {
     288}
  • icGREP/icgrep-devel/icgrep/IR_Gen/CBuilder.h

    r5260 r5267  
    2020public:
    2121   
    22     CBuilder(llvm::Module * m, unsigned archBitWidth, unsigned CacheAlignment=64);
     22    CBuilder(llvm::Module * m, unsigned GeneralRegisterWidthInBits, unsigned CacheLineAlignmentInBytes = 64);
    2323   
    2424    virtual ~CBuilder() {}
     
    3131        mMod = m;
    3232    }
    33    
    34     llvm::Function * GetPrintf();
     33       
    3534    llvm::Value * CreateMalloc(llvm::Type * type, llvm::Value * size);
     35
    3636    llvm::Value * CreateAlignedMalloc(llvm::Type * type, llvm::Value * size, const unsigned alignment);
     37
    3738    void CreateFree(llvm::Value * const ptr);
     39
    3840    void CreateAlignedFree(llvm::Value * const ptr, const bool ptrMayBeNull = false);
     41
    3942    llvm::Value * CreateRealloc(llvm::Value * ptr, llvm::Value * size);
     43
    4044    void CreateMemZero(llvm::Value * ptr, llvm::Value * size, const unsigned alignment = 1);
    4145
     
    4650    }
    4751   
    48     // Create calls to unistd.h functions.
    49     //
    50     // ssize_t write(int fildes, const void *buf, size_t nbyte);
     52    llvm::Function * GetPrintf();
     53
    5154    llvm::Value * CreateWriteCall(llvm::Value * fildes, llvm::Value * buf, llvm::Value * nbyte);
    5255   
    53     // Create calls to Posix thread (pthread.h) functions.
    54     //
    55     //  int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
    56     //                    void *(*start_routine)(void*), void *arg);
    5756    llvm::Value * CreatePThreadCreateCall(llvm::Value * thread, llvm::Value * attr, llvm::Function * start_routine, llvm::Value * arg);
    58     //  void pthread_exit(void *value_ptr);
     57
    5958    llvm::Value * CreatePThreadExitCall(llvm::Value * value_ptr);
    60     //  int pthread_join(pthread_t thread, void **value_ptr);
     59
    6160    llvm::Value * CreatePThreadJoinCall(llvm::Value * thread, llvm::Value * value_ptr);
    6261   
     
    6766    }
    6867   
    69     inline llvm::ConstantInt * getSize(const size_t value) const {
     68    inline llvm::ConstantInt * getSize(const size_t value) {
    7069        return llvm::ConstantInt::get(getSizeTy(), value);
    7170    }
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_builder.cpp

    r5260 r5267  
    184184    }
    185185}
    186 
    187186   
    188187Value * IDISA_Builder::esimd_mergeh(unsigned fw, Value * a, Value * b) {
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_target.cpp

    r5260 r5267  
    1010#include <IR_Gen/idisa_i64_builder.h>
    1111#include <IR_Gen/idisa_nvptx_builder.h>
     12#include <llvm/ADT/Triple.h>
    1213
    1314namespace IDISA {
    1415   
    15 IDISA_Builder * GetIDISA_Builder(Module * mod) {
     16IDISA_Builder * GetIDISA_Builder(llvm::Module * mod) {
    1617    const bool hasAVX2 = AVX2_available();
    1718    const bool isArch32Bit = Triple(llvm::sys::getProcessTriple()).isArch32Bit();
     
    2930}
    3031
    31 IDISA_Builder * GetIDISA_GPU_Builder(Module * mod) {
     32IDISA_Builder * GetIDISA_GPU_Builder(llvm::Module * mod) {
    3233    return new IDISA_NVPTX20_Builder(mod, 64);
    3334}
Note: See TracChangeset for help on using the changeset viewer.