[Fwd: [LLVMdev] GetElementPtr for packed types and VS build]

Reid Spencer reid at x10sys.com
Fri Dec 3 04:59:08 PST 2004


This needs to be applied as well.

Thanks,

Reid.

-----Forwarded Message-----
> From: Morten Ofstad <morten at hue.no>
> To: LLVM Developers Mailing List <llvmdev at cs.uiuc.edu>
> Subject: [LLVMdev] GetElementPtr for packed types and VS build
> Date: Wed, 01 Dec 2004 15:10:49 +0100
> 
> 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.
> 
> 
> ______________________________________________________________________
> Index: lib/Target/TargetData.cpp
> ===================================================================
> RCS file: /var/cvs/llvm/llvm/lib/Target/TargetData.cpp,v
> retrieving revision 1.53
> diff -u -r1.53 TargetData.cpp
> --- lib/Target/TargetData.cpp	2 Nov 2004 22:18:18 -0000	1.53
> +++ lib/Target/TargetData.cpp	26 Nov 2004 09:46:45 -0000
> @@ -175,6 +175,13 @@
>      Size = AlignedSize*ATy->getNumElements();
>      return;
>    }
> +  case Type::PackedTyID: {
> +    const PackedType *PTy = cast<PackedType>(Ty);
> +    getTypeInfo(PTy->getElementType(), TD, Size, Alignment);
> +    unsigned AlignedSize = (Size + Alignment - 1)/Alignment*Alignment;
> +    Size = AlignedSize*PTy->getNumElements();
> +    return;
> +  }
>    case Type::StructTyID: {
>      // Get the layout annotation... which is lazily created on demand.
>      const StructLayout *Layout = TD->getStructLayout(cast<StructType>(Ty));
> Index: lib/VMCore/Type.cpp
> ===================================================================
> RCS file: /var/cvs/llvm/llvm/lib/VMCore/Type.cpp,v
> retrieving revision 1.119
> diff -u -r1.119 Type.cpp
> --- lib/VMCore/Type.cpp	19 Nov 2004 16:39:44 -0000	1.119
> +++ lib/VMCore/Type.cpp	1 Dec 2004 11:33:46 -0000
> @@ -151,6 +151,9 @@
>    if (const ArrayType *ATy = dyn_cast<ArrayType>(this))
>      return ATy->getElementType()->isSized();
>  
> +  if (const PackedType *PTy = dyn_cast<PackedType>(this))
> +    return PTy->getElementType()->isSized();
> +
>    if (!isa<StructType>(this)) return false;
>  
>    // Okay, our struct is sized if all of the elements are...
> 
> ______________________________________________________________________
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20041203/b8704880/attachment.sig>


More information about the llvm-dev mailing list