I was wondering if anyone knew how to declare a global integer instance in LLVM IR. So far, I've been doing the following:
// Create symbol to identify previous block. Added by Justin.
llvm::Type::TypeID stupidTypeID = llvm::Type::IntegerTyID;
llvm::Type* typePtr = llvm::Type::getPrimitiveType(_context, stupidTypeID);
llvm::GlobalVariable* prevBlockID = new llvm::GlobalVariable(typePtr,
false,
llvm::GlobalValue::LinkerPrivateLinkage,
NULL,
"PREV_BLOCK_ID");
When I try to run, I get the following error:
static llvm::PointerType* llvm::PointerType::get(llvm::Type*, unsigned int): Assertion `EltTy && "Can't get a pointer to <null> type!"' failed.