I'm working with LLVM and I want to recreate a piece of IR with the API:
declare void @fun(i32* inreg, i32 inreg)
But I can't seem to get it to actually do it.
My current attempt is:
Function* fun = cast<Function>(M.getOrInsertFunction("fun",type));
((fun -> getAttributes()).getParamAttributes(0)).addAttribute(c,0,Attribute::InReg);
((fun -> getAttributes()).getParamAttributes(1)).addAttribute(c,0,Attribute::InReg);
This code literally doesn't do anything after line 1, lines 2 and 3 are completely ignored and all I get in the IR output is:
declare void @fun(i32* , i32 )
How do I get it to work correctly?