I've been trying to figure out how to basically take a portion of LLVM IR Code and execute it inline in C. I would like to do be able to inline the IR code so that a virtual function call is not needed (In the same way that assembly code can be inlined using _asm{}
). See the following example:
LLVM IR code to execute:
define i64 @square(i64 %x){
%y = mul i64 %x, %x
ret i64 %y
}
C Program:
for(i = 0; i < length; i++){
//run LLVM IR Code here
}
I know I could read the IR code in using parseIRFile()
and create a pointer to the function but that is not what I am looking for as a virtual function call is needed.