Simplify the bitfield codegen.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46230 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CodeGenTypes.h b/CodeGen/CodeGenTypes.h
index f10dc53..db3ba9c 100644
--- a/CodeGen/CodeGenTypes.h
+++ b/CodeGen/CodeGenTypes.h
@@ -78,18 +78,11 @@
 
   class BitFieldInfo {
   public:
-    explicit BitFieldInfo(unsigned N, unsigned B, unsigned E)
-      : No(N), Begin(B), End(E) {}
-  private:
-    // No -  llvm struct field number that is used to
-    // access this field. It may be not same as struct field number. 
-    // For example,
-    //   struct S { char a; short b:2; }
-    // Here field 'b' is second field however it is accessed as
-    // 9th and 10th bitfield of first field whose type is short.
-    unsigned No;
+    explicit BitFieldInfo(unsigned B, unsigned S)
+      : Begin(B), Size(S) {}
+
     unsigned Begin;
-    unsigned End;
+    unsigned Size;
   };
   llvm::DenseMap<const FieldDecl *, BitFieldInfo> BitFields;
 
@@ -140,8 +133,13 @@
                            std::vector<const llvm::Type*> &ArgTys);
 
   /// addFieldInfo - Assign field number to field FD.
-  void addFieldInfo(const FieldDecl *FD, unsigned No, unsigned Begin, 
-                    unsigned End);
+  void addFieldInfo(const FieldDecl *FD, unsigned No);
+
+  /// addBitFieldInfo - Assign a start bit and a size to field FD.
+  void addBitFieldInfo(const FieldDecl *FD, unsigned Begin, unsigned Size);
+
+  /// getBitFieldInfo - Return the BitFieldInfo  that corresponds to the field FD.
+  BitFieldInfo getBitFieldInfo(const FieldDecl *FD);
 };
 
 }  // end namespace CodeGen