functions are created like this:
llvm::FunctionType* FunctionTypePtr = llvm::FunctionType::get( returnTypePtr , types , false );
llvm::Function* llvmFunction = llvm::Function::Create(FunctionTypePtr,
llvm::GlobalValue::ExternalLinkage,
functionName,
llvmModule);
then the body of the function is created by adding instructions to the block:
llvm::BasicBlock* entryBlock = llvm::BasicBlock::Create(llvmContext, "", llvmFunction);
llvm::IRBuilder<> builder(entryBlock);
Enough context, now to the problem: I want to add load instructions for the function argument values, like:
//where do i get address??
llvm::LoadInst* load = builder.CreateLoad(address, "read");
I don't know how/where to grab the address
variable for a function parameter.
You should not load anything. Use Function::arg_iterator to get the Value's corresponding to the arguments.
See http://llvm.org/docs/doxygen/html/classllvm_1_1Function.html (arg_begin / arg_end) and http://llvm.org/docs/ProgrammersManual.html#Function for more information