[LLVMdev] Array Slicing?

Jon Sargeant delta17 at cox.net
Wed Oct 3 12:45:10 PDT 2007


I'm designing a language that supports array slicing.  Does LLVM allows 
conversions between array pointers?  For example, can I cast a 
pointer-to-array-of-5-ints to a pointer-to-array-of-3-ints?  Can I get 
the address of the third element of an array-of-5-ints and convert it to 
a pointer-to-array-of-3-ints?  Then again, I suppose a pointer-to-int 
would work just as well since LLVM supports pointer arithmetic.

On a related note, can I convert a pointer-to-int to a 
pointer-to-array-of-1-int and vice versa?

BTW, I sent another post to this e-mail address, but never received a reply:

----------------------------------
Subject: Shifting by too many bits
Body:
The documentation for SHL, LSHR, and ASHR is unclear.  What is the 
result of shifting by the number of bits in the left operand.  For example,

<result> = shl i32 1, 32
<result> = ashr i32 1, 32
<result> = lshr i32 1, 32
----------------------------------

Regards,
Jon



More information about the llvm-dev mailing list