search for: sizeu

Displaying 3 results from an estimated 3 matches for "sizeu".

Did you mean: size
2005 Jun 24
0
[LLVMdev] variable sized structs in LLVM
...ways good), you should do something like this: %array = type { int, int, [0 x int] } implementation %array *%NewArray(int %Length) { ;; Get the offset of the 'Length' element of the array from the null ;; pointer. %Size = getelementptr %array* null, int 0, uint 2, int %Length %SizeU = cast int* %Size to uint %Ptr = malloc sbyte, uint %SizeU %Result = cast sbyte* %Ptr to %array* ret %array* %Result } > I can think of workarounds (like using the struct module of the Python > standard library to calculate the sizes) but I have the feeling that I'm > missi...
2005 Jun 20
4
[LLVMdev] variable sized structs in LLVM
Hi LLVM-dev! I'm having problems figuring out how to do variable sized structs in LLVM (which are neccessary for PyPy's LLVM backend, on which I'm working). I'm trying to do the equivalent of struct array { long refcount; long length; long items[1]; }; in LLVM, where the items array can be arbitrarily long. I guess that the struct definition should
2005 Jun 24
2
[LLVMdev] variable sized structs in LLVM
...g like this: > > %array = type { int, int, [0 x int] } > implementation > %array *%NewArray(int %Length) { > ;; Get the offset of the 'Length' element of the array from the null > ;; pointer. > %Size = getelementptr %array* null, int 0, uint 2, int %Length > %SizeU = cast int* %Size to uint > %Ptr = malloc sbyte, uint %SizeU > %Result = cast sbyte* %Ptr to %array* > ret %array* %Result > } Chris you should maybe add this example to the getelementptr documentation. Aaron