Displaying 1 result from an estimated 1 matches for "m_context".
Did you mean:
  _context
  
2017 Apr 08
2
Getting a pointer to a i8 from a global variable that holds a constant string
...is to generate the IR for something like "puts("Hello World")";
I'm stuck on the parameter part of the call instruction.
So far I have something like this:
const std::string& str = strExpr->value();
llvm::ArrayType* type = llvm::ArrayType::get(llvm::IntegerType::get(m_context,
8), str.size()+1);
llvm::GlobalVariable* var = new llvm::GlobalVariable(m_module, type, true,
llvm::GlobalValue::PrivateLinkage, nullptr, ".str");
var->setAlignment(1);;
llvm::Constant* c = llvm::ConstantDataArray::getString(m_context, str);
var->setInitializer(c);
The part below...