Displaying 4 results from an estimated 4 matches for "struct_ptr".
2012 Feb 22
1
[LLVMdev] Size of structs & arrays
...erType::get(mod->getContext(), 64));
llvm::ConstantInt* two = llvm::ConstantInt::get(mod->getContext(),
llvm::APInt(32, llvm::StringRef("1"), 10));
std::vector<llvm::Value*> indices;
indices.push_back(one); indices.push_back(two);
llvm::Value* size = builder->CreateGEP(struct_ptr, indices);
llvm::Value* size_int = builder->CreatePtrToInt(size,
llvm::IntegerType::get(mod->getContext(), 64))
And I'm getting the assertion error "Invalid GetElementPtrInst indices for
type!"'. 'struct_ptr' is a pointer to the struct I'm trying to size. I'...
2012 Feb 22
0
[LLVMdev] Size of structs & arrays
On Wed, Feb 22, 2012 at 1:56 PM, Fraser Cormack <frasercrmck at gmail.com> wrote:
>
> 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
>
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
2010 Jul 14
2
[LLVMdev] Figuring out the parameters of the Call Instruction
...struction.
I had few questions based on that
I have the following C Code
1 #include <stdio.h>
2
3 struct my_struct
4 {
5 int a;
6 int b;
7 };
8
9 struct my_struct abc;
10 void p_ptr ( unsigned long j)
11 {
12 printf ( "%lx \n", j );
13 }
14
15 void struct_ptr ( struct my_struct * s_ptr )
16 {
17 printf ( "%p \n", s_ptr );
18 }
19
20 int
21 main ()
22 {
23 struct my_struct stack_abc;
24 p_ptr ((unsigned long) &abc);
25 struct_ptr ( &abc );
26 p_ptr ((unsigned long) &stack_abc);
27 struct_ptr ( &sta...