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
On 10/3/07, Jon Sargeant <delta17 at cox.net> wrote:> 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.Arbitrary casts are supported. You can cast pointers around all you like. Andrew
On Wed, 3 Oct 2007, Jon Sargeant wrote:> 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, 32These are undefined, I'll update the doc to make that more clear. -Chris -- http://nondot.org/sabre/ http://llvm.org/