[cfe-commits] r44833 - in /cfe/trunk/CodeGen: CodeGenTypes.cpp CodeGenTypes.h
Devang Patel
dpatel at apple.com
Mon Dec 10 17:23:34 PST 2007
Author: dpatel
Date: Mon Dec 10 19:23:33 2007
New Revision: 44833
URL: http://llvm.org/viewvc/llvm-project?rev=44833&view=rev
Log:
Separate access field number is not required.
Modified:
cfe/trunk/CodeGen/CodeGenTypes.cpp
cfe/trunk/CodeGen/CodeGenTypes.h
Modified: cfe/trunk/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenTypes.cpp?rev=44833&r1=44832&r2=44833&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/CodeGen/CodeGenTypes.cpp Mon Dec 10 19:23:33 2007
@@ -373,13 +373,12 @@
/// addFieldInfo - Assign field number to field FD.
void CodeGenTypes::addFieldInfo(const FieldDecl *FD, unsigned No,
- unsigned Begin, unsigned End,
- unsigned AccessNo) {
+ unsigned Begin, unsigned End) {
if (Begin == 0 && End == 0)
FieldInfo[FD] = No;
else
// FD is a bit field
- BitFields.insert(std::make_pair(FD, BitFieldInfo(No, Begin, End, AccessNo)));
+ BitFields.insert(std::make_pair(FD, BitFieldInfo(No, Begin, End)));
}
/// getCGRecordLayout - Return record layout info for the given llvm::Type.
@@ -457,7 +456,7 @@
unsigned FieldBegin = Cursor - (O % TySize);
unsigned FieldEnd = TySize - (FieldBegin + BitFieldSize);
Cursor += BitFieldSize;
- CGT.addFieldInfo(FD, FieldNo, FieldBegin, FieldEnd, i);
+ CGT.addFieldInfo(FD, i, FieldBegin, FieldEnd);
}
}
assert(FoundPrevField &&
@@ -467,8 +466,7 @@
} else if (ExtraBits >= BitFieldSize) {
// Reuse existing llvm field
ExtraBits = ExtraBits - BitFieldSize;
- CGT.addFieldInfo(FD, FieldNo, Cursor - CurrentFieldStart,
- ExtraBits, FieldNo);
+ CGT.addFieldInfo(FD, FieldNo, Cursor - CurrentFieldStart, ExtraBits);
Cursor = Cursor + BitFieldSize;
++FieldNo;
} else {
@@ -534,7 +532,7 @@
Cursor += Size;
LLVMFields.push_back(Ty);
if (FD)
- CGT.addFieldInfo(FD, FieldNo, Begin, End, FieldNo);
+ CGT.addFieldInfo(FD, FieldNo, Begin, End);
++FieldNo;
}
@@ -546,7 +544,7 @@
unsigned PrimaryEltNo = 0;
std::pair<uint64_t, unsigned> PrimaryElt =
CGT.getContext().getTypeInfo(FieldDecls[0]->getType(), SourceLocation());
- CGT.addFieldInfo(FieldDecls[0], 0, 0, 0, 0);
+ CGT.addFieldInfo(FieldDecls[0], 0, 0, 0);
unsigned Size = FieldDecls.size();
for(unsigned i = 1; i != Size; ++i) {
@@ -564,7 +562,7 @@
}
// In union, each field gets first slot.
- CGT.addFieldInfo(FD, 0, 0, 0, 0);
+ CGT.addFieldInfo(FD, 0, 0, 0);
}
std::vector<const llvm::Type*> Fields;
Modified: cfe/trunk/CodeGen/CodeGenTypes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenTypes.h?rev=44833&r1=44832&r2=44833&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CodeGenTypes.h (original)
+++ cfe/trunk/CodeGen/CodeGenTypes.h Mon Dec 10 19:23:33 2007
@@ -78,19 +78,18 @@
class BitFieldInfo {
public:
- explicit BitFieldInfo(unsigned N, unsigned B, unsigned E, unsigned A)
- : No(N), Begin(B), End(E), AccessFieldNo(A) {}
+ explicit BitFieldInfo(unsigned N, unsigned B, unsigned E)
+ : No(N), Begin(B), End(E) {}
private:
- // No - Field number in llvm struct.
+ // 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;
unsigned Begin;
unsigned End;
- // AccessFieldNo - llvm struct field number that is used to
- // access this field. It may be not same as No. 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 AccessFieldNo;
};
llvm::DenseMap<const FieldDecl *, BitFieldInfo> BitFields;
@@ -132,7 +131,7 @@
/// addFieldInfo - Assign field number to field FD.
void addFieldInfo(const FieldDecl *FD, unsigned No, unsigned Begin,
- unsigned End, unsigned AccessNo);
+ unsigned End);
};
} // end namespace CodeGen
More information about the cfe-commits
mailing list