Displaying 20 results from an estimated 71 matches for "createload".
2012 Apr 22
2
[LLVMdev] Problem about the type of Function's arguement in llvm
...amedValues[Name];
return V ? V : ErrorV("Unknown variable name");
}
It means that we can access value of arguement directly.
However, in llvm.org/demo and the chapter 6 of tutorial, it deals with
arguemnt:
1. allocate memory for arguement
2. then store the arguemnt into the memory.
3. CreateLoad() to load the arguement when accessing the value of arguement.
I have several problems:
Which way should I follow to get the vale of arguement?
When I tried to use CreateLoad(arguement), the program gives a segmentation
error.
Does this result from the wrong type of argument, unsuitable to be the...
2011 Sep 22
2
[LLVMdev] Need help in converting int to double
...s,
>
> First i converted the void * to int* and then did FPToSI...then did SHL...(
> because CreateShl only accepts integers... i pointer casted it to int64 type
> first)... Below is the code snippet....
>
>
> lhs = mBuilder.CreateStructGEP(firstArg, 0);
> lhs = mBuilder.CreateLoad(lhs);
> lhs = mBuilder.CreatePointerCast(lhs, PointerType::get(
> mBuilder.getInt64Ty(), 0));
> int typelhs = getValueType(lhs);
> rhs = mBuilder.CreateStructGEP(secondArg, 0);
> rhs = mBuilder.CreateLoad(rhs);
> rhs = mBuilder.CreatePointerCast(rhs...
2012 Apr 23
1
[LLVMdev] Problem about the type of Function's arguement in llvm
...st, false);
Function *fun= cast<Function> ( module->getOrInsertFunction("fun",
funType));
BasicBlock * block = BasicBlock::Create(Context, "mainBlock", fun);
IRBuilder<> builder(block);
Function::arg_iterator itr = fun->arg_begin();
builder.CreateLoad(itr);
Value *result = ConstantFP::get(Type::getDoubleTy(getGlobalContext()),
1.0);
builder.CreateRet(result);
vector<GenericValue> args;
ExecutionEngine *e = EngineBuilder(module).create();
outs()<<*module<<"\n";
outs().flush();
return 0;
}...
2009 May 05
4
[LLVMdev] A problem creating operands for a new IR instruction to the mailing list
....SetInsertPoint(LLVMBB, I);
// The following line looks to me like it would have a chance of loading either
// address 5, or else immediate value 5. Unfortunately, it does neither. It compiles
// but crashes at runtime, that the type of the operand is incompatible
Instruction *newI=Builder.CreateLoad(5,"");
// I also tested this, just to do a little sanity check. It also compiles then
// crashes, for the obvious reason that the operand is a register, but an address
// or an immediate value is expected.
//Instruction *newI=Builder.CreateLoad(I->getOperand(1),"");...
2011 Sep 22
0
[LLVMdev] Need help in converting int to double
...9 at gmail.com>> wrote:
Hi James,
First i converted the void * to int* and then did FPToSI...then did SHL...( because CreateShl only accepts integers... i pointer casted it to int64 type first)... Below is the code snippet....
lhs = mBuilder.CreateStructGEP(firstArg, 0);
lhs = mBuilder.CreateLoad(lhs);
lhs = mBuilder.CreatePointerCast(lhs, PointerType::get(
mBuilder.getInt64Ty(), 0));
int typelhs = getValueType(lhs);
rhs = mBuilder.CreateStructGEP(secondArg, 0);
rhs = mBuilder.CreateLoad(rhs);
rhs = mBuilder.CreatePointerCast(rhs, PointerType::get(...
2012 Apr 22
0
[LLVMdev] Problem about the type of Function's arguement in llvm
...sible to access the values (virtual registers) direclty,
but you may need to construct SSA form by yourself.
>
> However, in llvm.org/demo and the chapter 6 of tutorial, it deals with
> arguemnt:
> 1. allocate memory for arguement
> 2. then store the arguemnt into the memory.
> 3. CreateLoad() to load the arguement when accessing the value of arguement.
>
> I have several problems:
> Which way should I follow to get the vale of arguement?
If you do not want to construct SSA from by yourself, you probably
should follow this way. You can schedule the "mem2reg"[1] after...
2011 Sep 22
3
[LLVMdev] Need help in converting int to double
Hi,
I'm pursuing M.Tech course. As a part of the project work i'm using
LLVM as back-end. My project area is "Enhancing the performance of V8
javascript engine using LLVM as a back-end".
Now i'm writing code for shift left(SHL) operator. I had my own Value
Structure .. it's like this
Struct Value
{
void *val ;
char type;
}
The "char type" holds
2011 Sep 22
1
[LLVMdev] Need help in converting int to double
...s,
>
> First i converted the void * to int* and then did FPToSI...then did SHL...(
> because CreateShl only accepts integers... i pointer casted it to int64 type
> first)... Below is the code snippet....
>
>
> lhs = mBuilder.CreateStructGEP(firstArg, 0);
> lhs = mBuilder.CreateLoad(lhs);
> lhs = mBuilder.CreatePointerCast(lhs, PointerType::get(
> mBuilder.getInt64Ty(), 0));
> int typelhs = getValueType(lhs);
> rhs = mBuilder.CreateStructGEP(secondArg, 0);
> rhs = mBuilder.CreateLoad(rhs);
> rhs = mBuilder.CreatePointerCast(rhs...
2020 Jun 09
2
Implementing a VTable in LLVM
...>)
%5 = load %Foo*, %Foo** %_var_y0
%6 = getelementptr inbounds %Foo, %Foo* %5, i32 0, i32 0
%7 = load %_VtableFoo*, %_VtableFoo** %6
%8 = getelementptr inbounds %_VtableFoo, %_VtableFoo* %7, i32 0, i32 0
%9 = load void (%Foo*, i32)*, void (%Foo*, i32)** %8
However, the builder->CreateLoad instruction corresponding to the line with %9 returns null:
llvm::Function *calleeMethod = llvm::dyn_cast<llvm::Function>(builder->CreateLoad(calleeMethodPtr));
So if I then try to execute the following builder->CreateCall function I end up with a segmentation fault since calleeMe...
2009 May 05
0
[LLVMdev] A problem creating operands for a new IR instruction to the mailing list
...; // The following line looks to me like it would have a chance o! f loading
> either
> // address 5, or else immediate value 5. Unfortunately, it does neither. It
> compiles
> // but crashes at runtime, that the type of the operand is incompatible
> Instruction *newI=Builder.CreateLoad(5,"");
>
> // I also tested this, just to do a little sanity check. It also compiles
> then
> // crashes, for the obvious reason that the operand is a register, but an
> address
> // or an immediate value is expected.
> //Instruction *newI=Builder.CreateLoad(I...
2015 Nov 24
2
How to create a sprintf call in IR
...true);
Constant* sprintf = mod->getOrInsertFunction("sprintf", sprintfFT);
Now, I got stuck to create teh function call for sprintf.
I didn't it like the following:
Value* str = builder.CreateGlobalStringPtr("str", "");
Value* data = builder.CreateLoad(a); //load a, b, or c
Value* buf = builder.CreateLoad(buffer);
builder.CreateCall3((value*)sprintf, buf, str, data);
I want to test the sprintf function before adding the offset, but it didn't
work. The error information is "llvm.sys:PrintStackTrace(_IO_FILE)". Any
help will b...
2019 Jul 03
2
optimisation issue in an llvm IR pass
...d?
For me its the same result on LLVM 6.0 and 7.
Alternatively
add BYTE PTR [rsi+rdi*1],0x1
adc BYTE PTR [rsi+rdi*1],0x0
would work as well.
Thank you very much!
Regards,
Marc
-> Below now is the full llvm IR pass code
// vvv same code before both variants
LoadInst *PrevLoc = IRB.CreateLoad(AFLPrevLoc);
PrevLoc->setMetadata(M.getMDKindID("nosanitize"), MDNode::get(C, None));
Value *PrevLocCasted = IRB.CreateZExt(PrevLoc, IRB.getInt32Ty());
LoadInst *MapPtr = IRB.CreateLoad(AFLMapPtr);
MapPtr->setMetadata(M.getMDKindID("nosanitize"), MDNode::get(C, None));
V...
2009 May 06
1
[LLVMdev] A problem creating operands for a new IR instruction to the mailing list
Thank you for your answer. But there is still a problem.
You seem correct about how to define a constant operand. So I added it into my code, like so:
Builder.SetInsertPoint(LLVMBB, I);
Constant *C = ConstantInt::get(APInt(32, 5, false));
Instruction *newI=Builder.CreateLoad(C,"");
It compiles. But it still aborts at runtime with a complaint that the type is not right.
This leads me to think that immediate loads are not generated with the CreateLoad
instruction?
Another person's reply to my question indicated that a way to avoid inserting the
immedia...
2019 Jul 03
3
optimisation issue in an llvm IR pass
...],0x1
> adc BYTE PTR [rsi+rdi*1],0x0
> would work as well.
>
> Thank you very much!
>
> Regards,
> Marc
>
> -> Below now is the full llvm IR pass code
>
> // vvv same code before both variants
> LoadInst *PrevLoc = IRB.CreateLoad(AFLPrevLoc);
> PrevLoc->setMetadata(M.getMDKindID("nosanitize"), MDNode::get(C, None));
> Value *PrevLocCasted = IRB.CreateZExt(PrevLoc, IRB.getInt32Ty());
>
> LoadInst *MapPtr = IRB.CreateLoad(AFLMapPtr);
> MapPtr->setMetadata(M.getMDKindID("no...
2015 Mar 24
2
[LLVMdev] IR blocks for calling function pointers
...std::vector<Type*> FooArgs;
FooArgs.push_back(IRB.getInt64Ty());
Value *FooFunction = M.getOrInsertFunction(std::string("foo"),
FunctionType::get(IRB.getVoidTy(),
ArrayRef<Type*>(FooArgs), false));
IRB.CreateCall(FooFunction, IRB.CreateLoad(LenAlloca));
I want to create a similar call, but to the pointer of foo ("foo_ptr" is
defined as "(void) *foo_ptr (int)"). In C code, I would just call
"foo_ptr(var)", and it would just work. But, replacing the function name
with the name of the function pointer, in t...
2015 Nov 12
4
Fwd: asan for allocas on powerpc64
...ething like this (paraphrasing from
lib/Transfoms/Instrumentation/AddressSanitizer.cpp):
// call __asan_allocas_unpoison(uptr top, uptr bottom);
// NB "top" here means lowest address and "bottom" means highest!
IRB.CreateCall(
AsanAllocasUnpoisonFunc,
{
IRB.CreateLoad(DynamicAllocaLayout),
IRB.CreatePointerToInt(SaveRestoreInst->getOperand(0), IntptrTy)
}
);
I think the problem is that the operand to stackrestore is the new
native sp register value to restore, and this code is assuming that
that will be a higher address than all the allocas that...
2013 Dec 14
2
[LLVMdev] create load from a register in LLVM IR
Hi all,
I have recently encountered a problem when creating LLVM IRs. I am wondering if there is a standard or easy way to create a load from a certain register? For example, CreateLoad(rbp, NAME).
Thanks,
Chen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131213/ec277276/attachment.html>
2017 Jun 04
2
[newbie] trouble with global variables and CreateLoad/Store in JIT
...d (i32) slot being stored in the
first (i8*).
I've added ::dump() calls where the CreateStore is, and this is what I get:
{ i8*, i32 } { i8* @FixnumClass, i32 32 } ; for value
@foo = external global { i8*, i32 } ; for ptr
Even more bizarrely trying to replace the getGlobal call with
builder.CreateLoad(val)
results in what has been stored in the first (i8*) slot being loaded
correctly, but the second (i32) getting garbage out despite the correct
value being stored in memory. Dump call there reports the @foo pointer
identically.
This is using LLVM 4.0.0
Just so I'm not leaving anything out,...
2015 Nov 17
3
asan for allocas on powerpc64
...ion/AddressSanitizer.cpp):
>
> // call __asan_allocas_unpoison(uptr top, uptr bottom);
> // NB "top" here means lowest address and "bottom" means highest!
>
> IRB.CreateCall(
> AsanAllocasUnpoisonFunc,
> {
> IRB.CreateLoad(DynamicAllocaLayout),
> IRB.CreatePointerToInt(SaveRestoreInst->getOperand(0), IntptrTy)
> }
> );
>
> I think the problem is that the operand to stackrestore is the new
> native sp register value to restore, and this code is assuming that
> that...
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
...ents.
My code:
Instruction* InstructionVisitor::incrementGlobalKey(Instruction* I) {
IRBuilder<> Builder(I->getContext());
Builder.SetInsertPoint(I->getNextNode());
GlobalVariable* key = I->getModule()->getNamedGlobal("globalKey");
if (key) {
LoadInst* load = Builder.CreateLoad(key);
Value* inc = Builder.CreateAdd(load, Builder.getInt64(1));
StoreInst* store = Builder.CreateStore(inc, key);
return store;
}
return I;
}
Instruction* InstructionVisitor::print(Instruction* I, const char* text,
Value* arg1, Value* arg2, Value* arg3, Value* arg4) {
Function* printfFn = I->g...