[llvm-commits] [123688] Adjust to TargetData api changes.

clattner at apple.com clattner at apple.com
Sat Feb 10 14:30:38 PST 2007


Revision: 123688
Author:   clattner
Date:     2007-02-10 14:30:37 -0800 (Sat, 10 Feb 2007)

Log Message:
-----------
Adjust to TargetData api changes.

Modified Paths:
--------------
    apple-local/branches/llvm/gcc/llvm-convert.cpp

Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-convert.cpp	2007-02-10 10:57:44 UTC (rev 123687)
+++ apple-local/branches/llvm/gcc/llvm-convert.cpp	2007-02-10 22:30:37 UTC (rev 123688)
@@ -4217,8 +4217,7 @@
     // the offset from BitStart.
     if (MemberIndex) {
       const StructLayout *SL = TD.getStructLayout(cast<StructType>(StructTy));
-      assert(MemberIndex < SL->MemberOffsets.size() &&"Idx out of range!");
-      BitStart -= SL->MemberOffsets[MemberIndex] * 8;
+      BitStart -= SL->getElementOffset(MemberIndex) * 8;
     }
     
   } else {
@@ -4875,7 +4874,7 @@
   assert(FieldNo < ResultElts.size() && "Invalid struct field number!");
   
   // Get the offset and size of the LLVM field.
-  uint64_t STyFieldBitOffs = STyLayout->MemberOffsets[FieldNo]*8;
+  uint64_t STyFieldBitOffs = STyLayout->getElementOffset(FieldNo)*8;
   
   assert(BitfieldBitOffset >= STyFieldBitOffs &&
          "This bitfield doesn't start in this LLVM field!");
@@ -4884,7 +4883,7 @@
   // Loop over all of the fields this bitfield is part of.  This is usually just
   // one, but can be several in some cases.
   for (; BitfieldSize; ++FieldNo) {
-    assert(STyFieldBitOffs == STyLayout->MemberOffsets[FieldNo]*8 &&
+    assert(STyFieldBitOffs == STyLayout->getElementOffset(FieldNo)*8 &&
            "Bitfield LLVM fields are not exactly consecutive in memory!");
     
     // Compute overlap of this bitfield with this LLVM field, then call a
@@ -5249,8 +5248,7 @@
       // the offset from BitStart.
       if (MemberIndex) {
         const StructLayout *SL = TD.getStructLayout(cast<StructType>(StructTy));
-        assert(MemberIndex < SL->MemberOffsets.size() &&"Idx out of range!");
-        BitStart -= SL->MemberOffsets[MemberIndex] * 8;
+        BitStart -= SL->getElementOffset(MemberIndex) * 8;
       }
     } else {
       // We were unable to make a nice offset, emit an ugly one.





More information about the llvm-commits mailing list