GetElementPtr for packed types and VS build

As I was working with packed types it became apparent that I sometimes need to access individual elements - I fixed this by implementing GEP for packed types with just 2 small patches.

When I updated from the CVS today after about 2 weeks, I got a lot of problems with the VS build. I will send the updated project files directly to Reid so he can check them in as they are rather large. There is also one more issue which prevents the CVS version from compiling - in lib/ExecutionEngine/JIT/JITEmitter.cpp line 266 there is:

if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
     GlobalVariable *GV = cast<GlobalVariable>(V);
     .

This is obviously nonsense and is an error with the VS compiler since GV is being defined twice in the same scope using it's non-standard scoping rules. Just delete the line with the cast and it's fine...

m.

packedGEP.patch (1.48 KB)

As I was working with packed types it became apparent that I sometimes
need to access individual elements - I fixed this by implementing GEP
for packed types with just 2 small patches.

Yup, makes sense.

When I updated from the CVS today after about 2 weeks, I got a lot of
problems with the VS build. I will send the updated project files

Ok

directly to Reid so he can check them in as they are rather large. There
is also one more issue which prevents the CVS version from compiling -
in lib/ExecutionEngine/JIT/JITEmitter.cpp line 266 there is:

if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
     GlobalVariable *GV = cast<GlobalVariable>(V);

Fixed.

I've applied both of your patches:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20041129/021529.html
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20041129/021531.html

However, I don't think the second one is correct. In particular, packed
types often have greater alignment requirements than the underlying type.
With SSE-enabled X86, for example, float requires 32-bit alignment and <4
x float> requires 128-bit alignment. Your patch is clearly better than
what we had before, but I think the right solution is to add a new
instance variable to TargetData to indicate the alignment of the target
packed types. In general a target can have multiple SIMD sizes and
alignment restrictions, but just allowing them to specify one for now
should be fine.

-Chris