In my llvm written compiler (using c++17), I want to synthesize a function that has an integer argument.
- If that integer's bit width is less than 65, I want that argument's type to be
uint64_t. - Otherwise, I want that argument's type to be
uint64_t*, or auint64_tthat holds an array's address.
In the synthetization of that function, the integer's value is given in an llvm::APint, which can hold big integers; I know that the type of such llvm::APInt value might be a uint64_t or a uint64_t*, and that depends on the size of the given value.
The thing is, that when passing a big integer (bit width of 501), I get the following error:
i64 call void @myFunc(i501 -3041471953062192995039706191509879097447877415144190182463294413280942179769929755723507030244044466058102684219790242203873301936326800667497770127617)
Call parameter type does not match function signature!
The argument that I pass to the function while synthesizing it is:
llvm::ConstantInt::get(context, apint);
And the function's signature is:
void myFunc(uint64_t value)
To summarize - I don't understand what type i501 is, and I don't understand what type should myFunc expect to get in its argument. Alternatively, other suggestions for passing such value are welcome :)
I've tried using other llvm types when synthesizing myFunc, such as:
llvm::ConstantArrayllvm::GlobalVariablethat contains thellvm::ConstantIntas its initializerllvm::GlobalVariablethat contains thellvm::ConstantArrayas its initializer
Either way, I get the same error that indicates a difference between my argument type to the expected argument type, but either way I don't understand what is the expected type.
I have also tried changing the signature to
void myFunc(uint64_t* value)
But it didn't help as well.