similar to: How to create a 64 bit ConstInt having a value of -1?

Displaying 20 results from an estimated 800 matches similar to: "How to create a 64 bit ConstInt having a value of -1?"

2017 Oct 11
2
How to create an alloca variable of type i64 in LLVM IR?
To create a stack based (local) 64 bit integer in LLVM IR, I used: Value *var = builder.CreateAlloca(Type::getInt64Ty(Ctx)); I wish to pass this variable to a function "void foo(unsigned long)". I created the signature of function foo() as follows: Constant *func = M->getOrInsertFunction("foo", Type::getVoidTy(Ctx),Type::getInt64Ty(Ctx), NULL); To pass the newly created
2015 Jan 22
2
[LLVMdev] access IntegerType::getSignBit from Type *
Hi, I have a Type * which may come from an IntegerType as shown below: Type.getIntegerBitWidth() tells me numBits. But how to extract the IntegerType.getSignBit? If pType isIntegerType, I need to know if it is signed or unsigned... How to achieve this? Thx Alex llvm::Type * getRandomValid_IntegerType(llvm::LLVMContext &C) { using namespace llvm; //--- determine num of bits
2007 Dec 15
2
[LLVMdev] fix warning with newer g++ compilers
Ok, here is the patch again... I also included fixes for the bits that originally gave my mailer fits... Two votes for orange, so I went with orange... Doing diffs in .: --- ./lib/AsmParser/LLLexer.cpp.~1~ 2007-12-14 22:09:06.000000000 -0800 +++ ./lib/AsmParser/LLLexer.cpp 2007-12-15 13:02:47.000000000 -0800 @@ -54,7 +54,7 @@ static uint64_t HexIntToVal(const char * Result +=
2017 Jun 11
2
Force casting a Value*
On 11 June 2017 at 07:53, David Blaikie <dblaikie at gmail.com> wrote: > Sounds like you're looking for reinterpret_cast: http://en. > cppreference.com/w/cpp/language/reinterpret_cast > I tried cast<ConstInt>(vo), but that failed at run-time. > > On Sun, Jun 11, 2017 at 3:06 AM Dipanjan Das via llvm-dev < > llvm-dev at lists.llvm.org> wrote: >
2013 May 03
2
[LLVMdev] set of integers to metadata
Hello everyone, I want to pass a set of integers using metadata but I don't know how. I have tried: the integers are in array[] *1. * LLVMContext& C = is->getContext(); Value* values[size]; for(int gy=0;gy<size;gy++){ values[gy]=ConstantInt::getSigned(Type::getInt64Ty(C),array[gy]); } *is->setMetadata("path",MDNode::get(C,values));* failes when setMetadata(),
2013 May 03
0
[LLVMdev] set of integers to metadata
I also tried the following, with no compilation errors, but segfault, core dumped: *LLVMContext& C = is->getContext(); Value* values[size]; for(int gy=0;gy<size;gy++){ values[gy]=ConstantInt::getSigned(Type::getInt64Ty(C),array[gy]); } llvm::ArrayRef<Value*> bla = values[size]; is->setMetadata("path",MDNode::get(C,bla));* On Fri, May 3, 2013
2017 Jun 11
2
Force casting a Value*
I am trying to cast a Value* irrespective of its underlying subclass to uint64 and pass it on to a method as an argument. if (StoreInst *store_inst = dyn_cast<StoreInst>(&I)) { Value* vo = store_inst->getValueOperand(); uint64 value = /* cast vo to unsigned int 64 bit */ func(value); } How can I force
2016 Mar 29
2
JIT compiler and calls to existing functions
That seems to work, thanks! The specific code I ended up with to call int64_t print(int64_t) looks like: auto f = builder.CreateIntToPtr( ConstantInt::get(builder.getInt64Ty(), uintptr_t(print)), PointerType::getUnqual(FunctionType::get( builder.getInt64Ty(), {builder.getInt64Ty()}, false))); return builder.CreateCall(f, args); On Mon, Mar
2016 Mar 29
0
JIT compiler and calls to existing functions
The option we use is to have a custom memory manager, override the getPointerToNamedFunction function, and provide the pointer to the external function at link time. The inttoptr scheme works fairly well, but it does make for some pretty ugly and sometimes hard to analyze IR. I recommend leaving everything symbolic until link time if you can. Philip On 03/28/2016 06:33 PM, Russell Wallace
2016 Mar 29
2
JIT compiler and calls to existing functions
Right, but when you say link time, the JIT compiler I'm writing works the way openJDK or v8 do, it reads a script, JIT compiles it into memory and runs the code in memory without ever writing anything to disk (an option for ahead of time compilation may come later, but that will be a while down the road), so we might be doing different things? On Tue, Mar 29, 2016 at 2:59 AM, Philip Reames
2017 Jun 11
2
Force casting a Value*
On 11 June 2017 at 11:32, Nikodemus Siivola <nikodemus at random-state.net> wrote: > On Sun, Jun 11, 2017 at 7:49 PM, Dipanjan Das via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> >> >> On 11 June 2017 at 07:53, David Blaikie <dblaikie at gmail.com> wrote: >> >>> Sounds like you're looking for reinterpret_cast: http://en.cp
2009 Sep 07
0
[LLVMdev] PR4882
Hi Jakub, looks good. > + LLVMContext *Context = &SI->getContext(); I guess this could be LLVMContext &Context = SI->getContext(); which means you can use Context rather than *Context below. > - const Type *Ty = Type::getInt64Ty(SI->getContext()); > - MemSetF = Intrinsic::getDeclaration(M, Intrinsic::memset, &Ty, 1); > + const Type *Tys[] =
2009 Sep 07
1
[LLVMdev] PR4882
On Sep 7, 2009, at 5:02 PM, Duncan Sands wrote: > Hi Jakub, looks good. > >> + LLVMContext *Context = &SI->getContext(); > > I guess this could be > LLVMContext &Context = SI->getContext(); > which means you can use Context rather than *Context below. Right, C bad habit ;) Fixed. >> - const Type *Ty = Type::getInt64Ty(SI->getContext());
2016 Mar 29
0
JIT compiler and calls to existing functions
I think our use cases are actually quite similar. Part of generating the in memory executable code is resolving all the symbolic symbols and relocations. The details of this are mostly hidden from you by the MCJIT interface, but it's this step I was referring to as "link time". The way to think of MCJIT: generate object file, incrementally link, run dynamic loader, but do it all
2016 Mar 29
3
JIT compiler and calls to existing functions
Ah! Okay then, so you are saying something substantive that I think I disagree with, but that could be because there are relevant issues I don't understand. My reasoning is, I've already got a pointer to the function I want the generated code to call, so I just supply that pointer, it looks ugly on a microscopic scale because there are a couple of lines of casts to shepherd it through the
2017 Oct 14
2
Bug in replaceUsesOfWith: does not keep addrspace consistent in GEP
Hello, Calling `replaceUsesOfWith` with a value in a different addrspace does not keep the addrspace of a GEP consistent. Is this known? Is this a bug or expected behaviour? Minimal counterexample link <https://gist.github.com/bollu/152ba5e1c20c03c7fc6d8c7b23ba828f> Reproduced here: #include <iostream> #include "llvm/ADT/APFloat.h" #include
2011 May 18
2
[LLVMdev] access array problem
于 2011/5/18 14:29, Duncan Sands 写道: > Hi Tan Guangming, > >> I want to access an array in my instrumentation code. For example: >> >> GlobalVariable: >> int *counter; //counter the number of load/store operations in run-time >> int *counterArray; //record the load/store addresses > strictly speaking these are not arrays, they are pointers. Also, you have
2014 Aug 04
3
[LLVMdev] LLVM AllocaInst and StoreInst
Hi, I am trying to write a simple interpreter. I am trying to generate LLVM IR for assignment operation. The code for the generation part looks like this llvm::Value* codeGenSymTab(llvm::LLVMContext& context) { > printf("\n CodeGen SymTab \n"); > Value *num = ConstantInt::get(Type::getInt64Ty(context), aTable.value, > true); > Value *alloc = new
2016 Mar 29
0
JIT compiler and calls to existing functions
Other advantages of keeping things symbolic: 1) You can use function attributes to provide optimization or semantic information. 2) Linking modules works as expected when one of them contains the definition. 3) You can get better code generation (i.e. pc relative addressing for local symbols, etc..) If the inttoptr scheme makes you happy, go for it. I'm not telling you its wrong, merely
2011 May 18
3
[LLVMdev] access array problem
Hi, I want to access an array in my instrumentation code. For example: GlobalVariable: int *counter; //counter the number of load/store operations in run-time int *counterArray; //record the load/store addresses //increase the counter if a load/store is performed std::vector<Constant *>index(2); index[0] = Constant::getNullvalue(Type:getInt32Ty(Context)); index[1] =