Ignore:
Timestamp:
Feb 9, 2017, 4:06:24 PM (2 years ago)
Author:
cameron
Message:

Boundary assertions; comment out a bug with RemoveNullableAfterAssertion?

File:
1 edited

Legend:

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

    r5283 r5308  
    1111#include <llvm/IR/Function.h>
    1212#include <llvm/IR/TypeBuilder.h>
     13#include <fcntl.h>  // for
    1314
    1415using namespace llvm;
     16
     17llvm::Value * CBuilder::CreateOpenCall(Value * filename, Value * oflag, Value * mode) {
     18    Function * openFn = mMod->getFunction("open");
     19    if (openFn == nullptr) {
     20        IntegerType * int32Ty = getInt32Ty();
     21        PointerType * int8PtrTy = getInt8PtrTy();
     22        openFn = cast<Function>(mMod->getOrInsertFunction("open",
     23                                                         int32Ty, int8PtrTy, int32Ty, int32Ty, nullptr));
     24    }
     25    return CreateCall(openFn, {filename, oflag, mode});
     26}
     27
     28
    1529
    1630// ssize_t write(int fildes, const void *buf, size_t nbyte);
     
    4054    return CreateCall(readFn, {fildes, buf, nbyte});
    4155}
     56
     57llvm::Value * CBuilder::CreateCloseCall(Value * fildes) {
     58    Function * closeFn = mMod->getFunction("close");
     59    if (closeFn == nullptr) {
     60        IntegerType * int32Ty = getInt32Ty();
     61        closeFn = cast<Function>(mMod->getOrInsertFunction("close",
     62                                                           int32Ty, int32Ty, nullptr));
     63    }
     64    return CreateCall(closeFn, {fildes});
     65}
     66
     67
    4268
    4369Function * CBuilder::GetPrintf() {
Note: See TracChangeset for help on using the changeset viewer.