Displaying 4 results from an estimated 4 matches for "globalexprast".
2011 Feb 08
1
[LLVMdev] Question about linker error
Hello all,
When extending the tutorial to support global variables I'm getting
the following linker error:
glob.o:glob.cpp:(.text+0x12241): undefined reference to `vtable for
GlobalExprAST'
collect2: ld returned 1 exit status
GlobalExprAST class is:
/// GlobalExprAST - Expression class for globals
class GlobalExprAST : public ExprAST {
std::string Name;
ExprAST *Init;
public:
GlobalExprAST(const std::string &name, ExprAST *init)
: Name(name), Init(init) {}
virtua...
2011 Feb 13
0
[LLVMdev] conversion from 'const llvm::Value*' to 'llvm::Constant*'
Hi Anton,
> But there are still some details I must be missing. I'm getting an assertion
> when I try the following assignment in my script:
> global c = cos(1);
> Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!",
I think this is telling you that cos(1) is not a constant.
Ciao, Duncan.
2011 Feb 13
2
[LLVMdev] conversion from 'const llvm::Value*' to 'llvm::Constant*'
Hi Duncan
Many many thanks, it works now!
But there are still some details I must be missing. I'm getting an assertion
when I try the following assignment in my script:
global c = cos(1);
Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible
type!", file c:/llvm-source-2.7/include/llvm/Support/Casting.h, line 200
However, running for example
2011 Feb 13
3
[LLVMdev] conversion from 'const llvm::Value*' to 'llvm::Constant*'
...itVal =
cast<Constant>(Init->Codegen()); ?
I made some changes and now my code basically works, except in
assigments like the one above. It is a little bit frustrating because
is the main thing preventing me finishing my little silly scripting
language for monte carlo simulations.
Value *GlobalExprAST::Codegen() {
for (unsigned i = 0, e = GlobalNames.size(); i != e; ++i) {
const std::string &GlobalName = GlobalNames[i].first;
ExprAST *Init = GlobalNames[i].second;
Constant *InitVal;
InitVal = cast<Constant>(Init->Codegen());
if (InitVal == 0) return 0;
GlobalVariable * gl...