/// 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.
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 &&
} 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 {
Cursor += Size;
LLVMFields.push_back(Ty);
if (FD)
- CGT.addFieldInfo(FD, FieldNo, Begin, End, FieldNo);
+ CGT.addFieldInfo(FD, FieldNo, Begin, End);
++FieldNo;
}
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) {
}
// 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;
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;
/// 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