Reputation: 143
im trying to build language via LLVM (because i simply must), but was stuck at the simple start. Im trying to make int constants, but:
this was my try:
Value * val = ConstantInt::get(Context, APInt(m_Lexer.numVal())
but answer is, that there is no APInt contructor accepting 32bit signed int.
My questions are simple:
I tryed worked by this tutorial, but it works only with doubles, but i need ints: https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/LangImpl03.html
Upvotes: 1
Views: 936
Reputation: 1681
The first argument to ConstantInt::get
is an llvm Type
not a context
. Try this
Value * val = ConstantInt::get(Type::getInt32Ty(Context), m_Lexer.numVal(), true);
where the last boolean argument determines if val
would represent a signed or unsigned i32
Upvotes: 1