Displaying 20 results from an estimated 75 matches for "getnullvalu".
Did you mean:
getnullvalue
2004 Dec 21
3
[LLVMdev] Help with code
...rtion failure. Any pointers to where I am wrong :
Code Dump :
Function *printFn=M.getNamedFunction(std::string("printf"));
Constant *str=ConstantArray::get("Value : %d\n");
std::vector<Value *> Args(2);
std::vector<Constant *> GEPIndices(2);
GEPIndices[0]=Constant::getNullValue(Type::LongTy);
GEPIndices[1]=Constant::getNullValue(Type::LongTy);
Args[0]=ConstantExpr::getGetElementPtr(strcon,GEPIndices);
Args[1]=ConstantInt::get(Type::IntTy, id);
Instruction * cI= new CallInst(printFn, Args, "retprintf",instr);
Thanks
2011 May 18
2
[LLVMdev] access array problem
...kind of C-style idiom. What are the declarations in
> LLVM IR?
const Type *IntTy = Type::getInt32Ty(M.getContext());
const Type *ATyC = ArrayType::get(Type::getInt64Ty(M.getContext()), 1);
GlobalVariable *CounterSize = new GlobalVariable(M, ATyC, false,
GlobalValue::InternalLinkage,
Constant::getNullValue(ATyC), "MemTraceCounterSize");
const Type *ATy = ArrayType::get(Type::getInt32Ty(M.getContext()), 3000);
GlobalVariable *Counters = new GlobalVariable(M, ATy, false,
GlobalValue::InternalLinkage,
Constant::getNullValue(ATy), "MemTraceCounters");
>> //increase the counte...
2012 Feb 22
1
[LLVMdev] Size of structs & arrays
Eli Friedman-2 wrote:
>
>
> Try llvm::Constant::getNullValue().
>
>
I'm trying this:
llvm::Constant* one =
llvm::Constant::getNullValue(llvm::IntegerType::get(mod->getContext(), 64));
llvm::ConstantInt* two = llvm::ConstantInt::get(mod->getContext(),
llvm::APInt(32, llvm::StringRef("1"), 10));
std::vector<llvm::Value*> i...
2012 Feb 22
0
[LLVMdev] Size of structs & arrays
...p seeing the following:
>
> %Size = getelementptr %T* null, int 1
> %SizeI = cast %T* %Size to uint
>
> But I'm unsure how I actually do this in the C++ API. Is the 'null' here a
> llvm::ConstantPointerNull? Any help here would be much appreciated.
Try llvm::Constant::getNullValue().
> Additionally, I was wondering whether I can use this method to find out the
> size of variable-length arrays, such as [0 x i32], for example? I've tried
> doing this and am obviously doing something wrong.
>
> %Size = getelementptr [0 x i32]* %1, i32* null, i32 1
> %Siz...
2011 May 18
3
[LLVMdev] access array problem
...ray 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] = Constant::get(Type::getInt32Ty(Context), 0);
Constant *ElementPtr = ConstantExpr::getGetElementPtr(counter,
&index[0], index.size());
Value *oldcounter = new LoadInst(ElementPtr, "oldcounter", InsertPos);
Value *newcounter = BinaryOperator::Creat...
2011 May 18
0
[LLVMdev] access array problem
...the declarations in
>> LLVM IR?
> const Type *IntTy = Type::getInt32Ty(M.getContext());
> const Type *ATyC = ArrayType::get(Type::getInt64Ty(M.getContext()), 1);
>
> GlobalVariable *CounterSize = new GlobalVariable(M, ATyC, false,
> GlobalValue::InternalLinkage,
> Constant::getNullValue(ATyC), "MemTraceCounterSize");
so CounterSize is an array of length 1, containing a single 64 bit integer.
Using an array seems rather pointless here.
>
> const Type *ATy = ArrayType::get(Type::getInt32Ty(M.getContext()), 3000);
> GlobalVariable *Counters = new GlobalVariable(...
2011 May 18
0
[LLVMdev] access array problem
...re addresses
strictly speaking these are not arrays, they are pointers. Also, you have
written them in some kind of C-style idiom. What are the declarations in
LLVM IR?
> //increase the counter if a load/store is performed
> std::vector<Constant *>index(2);
> index[0] = Constant::getNullvalue(Type:getInt32Ty(Context));
> index[1] = Constant::get(Type::getInt32Ty(Context), 0);
The above two lines both compute the same thing (an i32 constant equal to
zero) in two different ways.
> Constant *ElementPtr = ConstantExpr::getGetElementPtr(counter,
> &index[0], index.size());
&g...
2012 Feb 22
5
[LLVMdev] Size of structs & arrays
I'm trying to work out the size of a struct so that I can pass this to the
'llvm.memcpy' intrinsic. It's easy to find out how I'm supposed to do this,
as I keep seeing the following:
%Size = getelementptr %T* null, int 1
%SizeI = cast %T* %Size to uint
But I'm unsure how I actually do this in the C++ API. Is the 'null' here a
llvm::ConstantPointerNull? Any help
2009 Jun 18
3
[LLVMdev] Initialising global Array
...= ConstantInt::get(zero);
> APInt minusone(32,-1); Constant* minusonec = ConstantInt::get(minusone);
Create the global array, there is no initializer yet.
> GlobalVariable *Counters =
> new GlobalVariable(ATy, false, GlobalValue::InternalLinkage,
> Constant::getNullValue(ATy), "OptimalEdgeProfCounters", &M);
Then exactly "NumEdges" constants are pushed to the "Initializer":
> Initializer[i] = zeroc;
> ..
> Initializer[i] = minusonec;
> ..
And then I set the initializer for the array:
> Constant *init = llvm...
2011 May 18
2
[LLVMdev] access array problem
...variable
const Type *IntTy = Type::getInt32Ty(M.getContext());
const Type *ATyC = ArrayType::get(Type::getInt64Ty(M.getContext()), 1);
GlobalVariable *CounterSize = new GlobalVariable(M, ATyC, false,
GlobalValue::InternalLinkage,
Constant::getNullValue(ATyC), "MemTraceCounterSize");
const Type *ATy = ArrayType::get(Type::getInt32Ty(M.getContext()), 3000);
GlobalVariable *Counters = new GlobalVariable(M, ATy, false,
GlobalValue::InternalLinkage,
Constant::getNullValue(ATy), "MemTraceCounters");
//get the in...
2004 Dec 21
0
[LLVMdev] Help with code
...tFn=M.getNamedFunction(std::string("printf"));
std::string() is unnecessary here as it's implicit.
> Constant *str=ConstantArray::get("Value : %d\n");
> std::vector<Value *> Args(2);
> std::vector<Constant *> GEPIndices(2);
> GEPIndices[0]=Constant::getNullValue(Type::LongTy);
> GEPIndices[1]=Constant::getNullValue(Type::LongTy);
> Args[0]=ConstantExpr::getGetElementPtr(strcon,GEPIndices);
You are using 'strcon', but you defined 'str' above. Where is 'strcon'
coming from?
> Args[1]=ConstantInt::get(Type::IntTy, id);
>...
2005 May 13
0
[LLVMdev] LongTy in LowerInvoke.cpp
...werInvoke.cpp
> ===================================================================
> RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/LowerInvoke.cpp,v
> retrieving revision 1.23
> diff -r1.23 LowerInvoke.cpp
> 160c160
> < std::vector<Constant*> GEPIdx(2, Constant::getNullValue(Type::LongTy));
> ---
>> std::vector<Constant*> GEPIdx(2,
> Constant::getNullValue(XXX::IntPtrTy));
> 173c173
> < std::vector<Constant*> GEPIdx(2, Constant::getNullValue(Type::LongTy));
> ---
>> std::vector<Constant*> GEPIdx(2,
> Con...
2005 May 13
0
[LLVMdev] LongTy in LowerInvoke.cpp
...================================
>>> RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/LowerInvoke.cpp,v
>>> retrieving revision 1.23
>>> diff -r1.23 LowerInvoke.cpp
>>> 160c160
>>> < std::vector<Constant*> GEPIdx(2,
>>> Constant::getNullValue(Type::LongTy));
>>> ---
>>>
>>>> std::vector<Constant*> GEPIdx(2,
>>>
>>> Constant::getNullValue(XXX::IntPtrTy));
>>> 173c173
>>> < std::vector<Constant*> GEPIdx(2,
>>> Constant::getNullValue(Type...
2005 May 13
0
[LLVMdev] LongTy in LowerInvoke.cpp
...;> RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/LowerInvoke.cpp,v
>>>>> retrieving revision 1.23
>>>>> diff -r1.23 LowerInvoke.cpp
>>>>> 160c160
>>>>> < std::vector<Constant*> GEPIdx(2,
>>>>> Constant::getNullValue(Type::LongTy));
>>>>> ---
>>>>>
>>>>>> std::vector<Constant*> GEPIdx(2,
>>>>>
>>>>>
>>>>> Constant::getNullValue(XXX::IntPtrTy));
>>>>> 173c173
>>>>> < st...
2009 Jun 18
0
[LLVMdev] Initialising global Array
...t*> Initializer; Initializer.reserve(NumEdges);
APInt zero(32,0); Constant* zeroc = ConstantInt::get(zero);
APInt minusone(32,-1); Constant* minusonec = ConstantInt::get(minusone);
GlobalVariable *Counters = new GlobalVariable(ATy, false,
GlobalValue::InternalLinkage, Constant::getNullValue(ATy),
"OptimalEdgeProfCounters1", &M);
Initializer[0] = zeroc;
Initializer[1] = minusonec;
Initializer[2] = minusonec;
Initializer[3] = zeroc;
Constant *init = llvm::ConstantArray::get(ATy, Initializer);
Counters->setInitializer(init);
DOUT << "Ini...
2004 Dec 21
3
[LLVMdev] Help with code
...g("printf"));
>
> std::string() is unnecessary here as it's implicit.
>
> > Constant *str=ConstantArray::get("Value : %d\n");
> > std::vector<Value *> Args(2);
> > std::vector<Constant *> GEPIndices(2);
> > GEPIndices[0]=Constant::getNullValue(Type::LongTy);
> > GEPIndices[1]=Constant::getNullValue(Type::LongTy);
> > Args[0]=ConstantExpr::getGetElementPtr(strcon,GEPIndices);
>
> You are using 'strcon', but you defined 'str' above. Where is 'strcon'
> coming from?
>
> > Args[1]=Const...
2010 Feb 16
3
[LLVMdev] Creating a global variable in JIT context
...eturn
its value from a newly created function, in JIT context. I'm keeping
all types as i32 for the moment, and I only have the one module
object.
This is the code I have for creating the global variable:
const Type *type = Type::getInt32Ty(getGlobalContext());
// Constant *zerov = Constant::getNullValue(type);
Constant *zerov = Constant::getIntegerValue(type, APInt(32, 0));
V = new GlobalVariable(getGlobalContext(), type, 0,
GlobalValue::PrivateLinkage, zerov, name);
And these are the error messages given by verifyFunction:
Function return type does not match operand type of return inst!
re...
2008 Nov 08
0
[LLVMdev] non-pointer gcroot
...ll::get(cast<PointerType>(Ty)),
> *I, IP);
> } else {
> // todo; something here
> }
> MadeChange = true;
> }
> ...
Hi Scott,
Using the new support for first-class aggregate values, you should be
able to rewrite the above code to use Constant::getNullValue
regardless of the type of the alloca. There needn't be a special-case
for !isa<PointerType>((*I)->getType()->getElementType()).
However, I hesitate to recommend this route; I think it boxes in from
supporting escape analysis (where pointer fields within a stack-
allocated s...
2008 Nov 07
2
[LLVMdev] non-pointer gcroot
Hi
I'm getting an assert in LowerIntrinsics::InsertRootInitializers
because I'm gcroot'ing an alloca to a non-pointer.
I was hoping to modify InsertRootInitializers to memset the structure
in the case that it's not a pointer, but I'm not sure how to. Can
anyone suggest what should go at "todo; something here"?
...
for (AllocaInst **I = Roots, **E = Roots +
2011 Oct 06
0
[LLVMdev] How to create arguments CallInst
...ast (para, arg_iti->getType(),
"test", InsertPt)
... where InsertPt is an Instruction * specifying where to insert the
cast instruction.
Having said that, if all you're doing is inserting zero values of the
appropriate type, it might be easier to use:
Value * Val2 = Constant::getNullValue (arg_iti->getType());
-- John T.
>
>
> 2011/10/6 John Criswell <criswell at illinois.edu
> <mailto:criswell at illinois.edu>>
>
> On 10/6/11 11:48 AM, Rafael Baldiati Parizi wrote:
>> Hello,
>> I need create a CallInst to this function
&g...