[LLVMdev] Porting to System z

Duncan Sands baldrick at free.fr
Wed Apr 8 00:50:47 PDT 2009

Hi Neale,

> Yes, that works much better. However, I fear the problem is more to do with
> trying to force enums to be a different size which appears not to be
> supported by most compilers. The IBM C++ compiler apparently has a #pragma
> which can be used to do it and gcc 4.3 seems to be happy with the hack
> described but as Duncan says trying to force this behavior in a union is
> probably less than desirable in the long term.

I don't know if the union is invoking undefined behaviour or not, but given
the number of compilers it breaks it clearly needs to be changed.  I'm not sure
the enum needs to be an enum, how about turning it into a uintptr_t instead?



> Another ugly hack that I tried:
>     union {
>       uintptr_t V;
> #ifdef _LP64
>       SimpleValueType SimpleTyU[2];
> # define SimpleTy SimpleTyU[1]
> #else
>       SimpleValueType SimpleTyU[1];
> # define SimpleTy SimpleTyU[0]
> #endif
>       const Type *LLVMTy;
>     };
> This works on my big endian 64-bit system but I've not seen what damage it
> may do on other platform types.
> On 4/7/09 4:09 PM, "Anton Korobeynikov" <anton at korobeynikov.info> wrote:
> > Hello,
> > 
> >> +static const uintptr_t minus_one = -1;
> > -1 here is of signed int type. What if you will use -1ULL ?
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list