On May 27, 2012, at 9:15 PM, Santos Merino wrote:> I have found that the problem is the endianness of Values. For example a 1 it's > stored as 00000001 00000000 00000000 0000000 instead of 0000000 00000000 0000000 > 00000000 so how can I change how the values are stored and/or load (because I > suppose that the problem is when I store it or load from memory)Are you setting up the module's TargetData string correctly? -Chris
In my main function after generate the code and before start the execution via JIT I do this: ExecutionEngine *EE = EngineBuilder(M).create(); string str = EE->getTargetData()->getStringRepresentation(); str[0] = 'e'; M->setDataLayout(str); if (verifyModule(*M)) { errs() << argv[0] << ": Error building the function!\n"; return 1; } vector<GenericValue> noargs; GenericValue GV = EE->runFunction(Main, noargs); outs() << "Result: " << GV.IntVal << "\n"; return 0;
Why are you changing the data layout to be little-endian? Joey On 28 May 2012 10:13, Santos Merino <santitox at hotmail.es> wrote:> In my main function after generate the code and before start the execution > via > JIT I do this: > > ExecutionEngine *EE = EngineBuilder(M).create(); > string str > EE->getTargetData()->getStringRepresentation(); > str[0] = 'e'; > M->setDataLayout(str); > > if (verifyModule(*M)) { > errs() << argv[0] << ": Error building the function!\n"; > return 1; > } > > vector<GenericValue> noargs; > GenericValue GV = EE->runFunction(Main, noargs); > > outs() << "Result: " << GV.IntVal << "\n"; > return 0; > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120528/267ed447/attachment.html>