Displaying 8 results from an estimated 8 matches for "mystructtype".
2008 Apr 21
0
[LLVMdev] newbie question for type comparison
...what you want if you're looking specifically for type {i32, i32}.
To search specifically for that type, do the following:
1) Create a "new" structure type representing {i32. i32} using the
static StructType::get() method. I think the code would look something
like this:
Type * MyStructType = StructType::get (Type::Int32Ty, Type::Int32Ty, 0);
2) Compare the pointer of MyStructType to the pointer for the alloca's
allocation type:
if (ai->getOperand(0)->getType() == MyStructType)
The above works because LLVM will only create one instance of each type
(i.e. if there's...
2008 Apr 21
2
[LLVMdev] newbie question for type comparison
Hi,
I want to extract all instruction of the form "alloca %struct.S", where
$struct.S is defined as a struct
%struct.S = type { i32, i32 }
I'm using the following loop:
for(inst_iterator i = inst_begin(F), e = inst_end(F); i!= e; i++)
{
AllocaInst* ai;
if( (ai = dyn_cast<AllocaInst>(&*i))){
if(ai->getOperand(0)->getType()->getTypeID() ==
2008 Apr 21
3
[LLVMdev] newbie question for type comparison
...pecifically for type {i32, i32}.
>
> To search specifically for that type, do the following:
>
> 1) Create a "new" structure type representing {i32. i32} using the
> static StructType::get() method. I think the code would look
> something like this:
>
> Type * MyStructType = StructType::get (Type::Int32Ty, Type::Int32Ty,
> 0);
>
> 2) Compare the pointer of MyStructType to the pointer for the
> alloca's allocation type:
>
> if (ai->getOperand(0)->getType() == MyStructType)
>
> The above works because LLVM will only create one insta...
2012 Sep 19
0
[LLVMdev] newbie question on getelementptr
...32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128");
module->setTargetTriple("x86_64-unknown-linux-gnu");
Function *func_add = CreateAddFunction(module);
// create a StructType to contain func_add
StructType *myStructType = StructType::create(module->getContext(),
"myStruct");
std::vector<Type*> fields;
fields.push_back(func_add->getType());
if (myStructType->isOpaque()) {
myStructType->setBody(fields, /*isPacked=*/false);
}
string myGVName = "myGV"...
2012 Sep 19
3
[LLVMdev] newbie question on getelementptr
Hi All,
I'm new to LLVM and I'm having a coding problem.
I'm creating a GlobalVariable that contains a StructType that contains a
Function. The function returns i32 and takes two i32's.
Here is my code:
GlobalVariable* retrieved = module->getGlobalVariable("myGV");
...
Constant* result = ConstantExpr::getGetElementPtr(retrieved, indices);
How do I get my Function
2008 Apr 21
0
[LLVMdev] newbie question for type comparison
...32}.
>>
>> To search specifically for that type, do the following:
>>
>> 1) Create a "new" structure type representing {i32. i32} using the
>> static StructType::get() method. I think the code would look
>> something like this:
>>
>> Type * MyStructType = StructType::get (Type::Int32Ty, Type::Int32Ty,
>> 0);
>>
>> 2) Compare the pointer of MyStructType to the pointer for the
>> alloca's allocation type:
>>
>> if (ai->getOperand(0)->getType() == MyStructType)
>>
>> The above works because LL...
2013 Jan 20
0
[LLVMdev] Sizeof a type?
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
> On Behalf Of Rick Mann
> Subject: [LLVMdev] Sizeof a type?
> Is there a way to get the sizeof a type?
Look at the methods of the DataLayout class.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you
2013 Jan 20
5
[LLVMdev] Sizeof a type?
Is there a way to get the sizeof a type? Say I've created a struct type without any explicit attribtues, and I want to call malloc() to allocate space for it. Can I get the size as an llvm::Constant* (or other llvm::Value*) given an llvm::StructType* or other llvm::Type*?
TIA,
--
Rick