Ignore:
Timestamp:
Sep 10, 2017, 11:24:44 PM (20 months ago)
Author:
nmedfort
Message:

Bug fix to avoid a LLVM bug when using a cross-compilable void pointer type on 32-bit VMs running on a 64-bit host.

File:
1 edited

Legend:

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

    r5630 r5633  
    201201    if (LLVM_UNLIKELY(printRegister == nullptr)) {
    202202        FunctionType *FT = FunctionType::get(getVoidTy(), { getInt8PtrTy(), int64Ty }, false);
    203         Function * function = Function::Create(FT, Function::ExternalLinkage, "PrintInt", m);
     203        Function * function = Function::Create(FT, Function::InternalLinkage, "PrintInt", m);
    204204        auto arg = function->arg_begin();
    205205        std::string out = "%-40s = %" PRIx64 "\n";
     
    561561
    562562PointerType * CBuilder::getVoidPtrTy() const {
    563     return TypeBuilder<void *, false>::get(getContext());
     563    return TypeBuilder<void *, true>::get(getContext());
    564564}
    565565
     
    664664    if (pthreadCreateFunc == nullptr) {
    665665        Type * pthreadTy = getSizeTy();
    666         FunctionType * funVoidPtrVoidTy = FunctionType::get(getVoidTy(), {getVoidPtrTy()}, false);
     666        FunctionType * funVoidPtrVoidTy = FunctionType::get(getVoidTy(), {voidPtrTy}, false);
    667667        FunctionType * fty = FunctionType::get(getInt32Ty(), {pthreadTy->getPointerTo(), voidPtrTy, funVoidPtrVoidTy->getPointerTo(), voidPtrTy}, false);
    668668        pthreadCreateFunc = Function::Create(fty, Function::ExternalLinkage, "pthread_create", m);
     
    10791079    }
    10801080
    1081 LoadInst * CBuilder::CreateLoad(Value *Ptr, const char * Name) {
     1081LoadInst * CBuilder::CreateLoad(Value *Ptr, const char * Name) {   
    10821082    CHECK_ADDRESS(Ptr, "CreateLoad");
    10831083    return IRBuilder<>::CreateLoad(Ptr, Name);
     
    11001100
    11011101StoreInst * CBuilder::CreateStore(Value * Val, Value * Ptr, bool isVolatile) {
     1102    assert (Val->getType()->getPointerTo() == Ptr->getType());
    11021103    CHECK_ADDRESS(Ptr, "CreateStore");
    11031104    return IRBuilder<>::CreateStore(Val, Ptr, isVolatile);
     
    11761177}
    11771178
    1178 llvm::CallInst * CBuilder::CreateMemCpy(llvm::Value *Dst, llvm::Value *Src, llvm::Value *Size, unsigned Align, bool isVolatile,
    1179                                         llvm::MDNode *TBAATag, llvm::MDNode *TBAAStructTag, llvm::MDNode *ScopeTag, llvm::MDNode *NoAliasTag) {
     1179CallInst * CBuilder::CreateMemCpy(Value *Dst, Value *Src, Value *Size, unsigned Align, bool isVolatile,
     1180                                  MDNode *TBAATag, MDNode *TBAAStructTag, MDNode *ScopeTag, MDNode *NoAliasTag) {
    11801181    if (codegen::EnableAsserts) {
    11811182        DataLayout DL(getModule());
Note: See TracChangeset for help on using the changeset viewer.