[cfe-commits] r128842 - in /cfe/trunk/lib/CodeGen: CGClass.cpp CGDebugInfo.cpp CGRTTI.cpp CGVTables.cpp CGVTables.h
Devang Patel
dpatel at apple.com
Mon Apr 4 13:36:06 PDT 2011
Author: dpatel
Date: Mon Apr 4 15:36:06 2011
New Revision: 128842
URL: http://llvm.org/viewvc/llvm-project?rev=128842&view=rev
Log:
Revert r128770, r128771, r128773 and r128776 for now. It breaks debug info.
Modified:
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGRTTI.cpp
cfe/trunk/lib/CodeGen/CGVTables.cpp
cfe/trunk/lib/CodeGen/CGVTables.h
Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=128842&r1=128841&r2=128842&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Mon Apr 4 15:36:06 2011
@@ -1317,12 +1317,11 @@
const CXXRecordDecl *ClassDecl,
const CXXRecordDecl *BaseClassDecl) {
llvm::Value *VTablePtr = GetVTablePtr(This, Int8PtrTy);
- CharUnits VBaseOffsetOffset =
+ int64_t VBaseOffsetOffset =
CGM.getVTables().getVirtualBaseOffsetOffset(ClassDecl, BaseClassDecl);
llvm::Value *VBaseOffsetPtr =
- Builder.CreateConstGEP1_64(VTablePtr, VBaseOffsetOffset.getQuantity(),
- "vbase.offset.ptr");
+ Builder.CreateConstGEP1_64(VTablePtr, VBaseOffsetOffset, "vbase.offset.ptr");
const llvm::Type *PtrDiffTy =
ConvertType(getContext().getPointerDiffType());
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=128842&r1=128841&r2=128842&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Apr 4 15:36:06 2011
@@ -808,7 +808,7 @@
for (CXXRecordDecl::base_class_const_iterator BI = RD->bases_begin(),
BE = RD->bases_end(); BI != BE; ++BI) {
unsigned BFlags = 0;
- CharUnits BaseOffset;
+ uint64_t BaseOffset;
const CXXRecordDecl *Base =
cast<CXXRecordDecl>(BI->getType()->getAs<RecordType>()->getDecl());
@@ -816,11 +816,10 @@
if (BI->isVirtual()) {
// virtual base offset offset is -ve. The code generator emits dwarf
// expression where it expects +ve number.
- BaseOffset = CharUnits::Zero() -
- CGM.getVTables().getVirtualBaseOffsetOffset(RD, Base);
+ BaseOffset = 0 - CGM.getVTables().getVirtualBaseOffsetOffset(RD, Base);
BFlags = llvm::DIDescriptor::FlagVirtual;
} else
- BaseOffset = RL.getBaseClassOffset(Base);
+ BaseOffset = RL.getBaseClassOffsetInBits(Base);
AccessSpecifier Access = BI->getAccessSpecifier();
if (Access == clang::AS_private)
@@ -831,7 +830,7 @@
llvm::DIType DTy =
DBuilder.createInheritance(RecordTy,
getOrCreateType(BI->getType(), Unit),
- BaseOffset.getQuantity(), BFlags);
+ BaseOffset, BFlags);
EltTys.push_back(DTy);
}
}
Modified: cfe/trunk/lib/CodeGen/CGRTTI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRTTI.cpp?rev=128842&r1=128841&r2=128842&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRTTI.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRTTI.cpp Mon Apr 4 15:36:06 2011
@@ -877,8 +877,7 @@
// subobject. For a virtual base, this is the offset in the virtual table of
// the virtual base offset for the virtual base referenced (negative).
if (Base->isVirtual())
- OffsetFlags =
- CGM.getVTables().getVirtualBaseOffsetOffset(RD, BaseDecl).getQuantity();
+ OffsetFlags = CGM.getVTables().getVirtualBaseOffsetOffset(RD, BaseDecl);
else {
const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
OffsetFlags = Layout.getBaseClassOffsetInBits(BaseDecl) / 8;
Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=128842&r1=128841&r2=128842&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp Mon Apr 4 15:36:06 2011
@@ -706,7 +706,7 @@
/// VCallAndVBaseOffsetBuilder - Class for building vcall and vbase offsets.
class VCallAndVBaseOffsetBuilder {
public:
- typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits>
+ typedef llvm::DenseMap<const CXXRecordDecl *, int64_t>
VBaseOffsetOffsetsMapTy;
private:
@@ -937,7 +937,7 @@
CharUnits VBaseOffsetOffset = getCurrentOffsetOffset();
VBaseOffsetOffsets.insert(
- std::make_pair(BaseDecl, VBaseOffsetOffset));
+ std::make_pair(BaseDecl, VBaseOffsetOffset.getQuantity()));
Components.push_back(
VTableComponent::MakeVBaseOffset(Offset));
@@ -956,7 +956,7 @@
typedef llvm::SmallSetVector<const CXXRecordDecl *, 8>
PrimaryBasesSetVectorTy;
- typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits>
+ typedef llvm::DenseMap<const CXXRecordDecl *, int64_t>
VBaseOffsetOffsetsMapTy;
typedef llvm::DenseMap<BaseSubobject, uint64_t>
@@ -1335,11 +1335,11 @@
if (Offset.DerivedClass == MostDerivedClass) {
// We can get the offset offset directly from our map.
Adjustment.VBaseOffsetOffset =
- VBaseOffsetOffsets.lookup(Offset.VirtualBase).getQuantity();
+ VBaseOffsetOffsets.lookup(Offset.VirtualBase);
} else {
Adjustment.VBaseOffsetOffset =
VTables.getVirtualBaseOffsetOffset(Offset.DerivedClass,
- Offset.VirtualBase).getQuantity();
+ Offset.VirtualBase);
}
}
@@ -2173,13 +2173,12 @@
// We store the virtual base class names and their offsets in a map to get
// a stable order.
- std::map<std::string, CharUnits> ClassNamesAndOffsets;
+ std::map<std::string, int64_t> ClassNamesAndOffsets;
for (VBaseOffsetOffsetsMapTy::const_iterator I = VBaseOffsetOffsets.begin(),
E = VBaseOffsetOffsets.end(); I != E; ++I) {
std::string ClassName = I->first->getQualifiedNameAsString();
- CharUnits OffsetOffset = I->second;
- ClassNamesAndOffsets.insert(
- std::make_pair(ClassName, OffsetOffset));
+ int64_t OffsetOffset = I->second;
+ ClassNamesAndOffsets.insert(std::make_pair(ClassName, OffsetOffset));
}
Out << "Virtual base offset offsets for '";
@@ -2187,10 +2186,10 @@
Out << ClassNamesAndOffsets.size();
Out << (ClassNamesAndOffsets.size() == 1 ? " entry" : " entries") << ").\n";
- for (std::map<std::string, CharUnits>::const_iterator I =
+ for (std::map<std::string, int64_t>::const_iterator I =
ClassNamesAndOffsets.begin(), E = ClassNamesAndOffsets.end();
I != E; ++I)
- Out << " " << I->first << " | " << I->second.getQuantity() << '\n';
+ Out << " " << I->first << " | " << I->second << '\n';
Out << "\n";
}
@@ -2431,9 +2430,8 @@
return I->second;
}
-CharUnits
-CodeGenVTables::getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
- const CXXRecordDecl *VBase) {
+int64_t CodeGenVTables::getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
+ const CXXRecordDecl *VBase) {
ClassPairTy ClassPair(RD, VBase);
VirtualBaseClassOffsetOffsetsMapTy::iterator I =
@@ -2452,8 +2450,7 @@
// Insert all types.
ClassPairTy ClassPair(RD, I->first);
- VirtualBaseClassOffsetOffsets.insert(
- std::make_pair(ClassPair, I->second));
+ VirtualBaseClassOffsetOffsets.insert(std::make_pair(ClassPair, I->second));
}
I = VirtualBaseClassOffsetOffsets.find(ClassPair);
@@ -2910,8 +2907,7 @@
// Insert all types.
ClassPairTy ClassPair(RD, I->first);
- VirtualBaseClassOffsetOffsets.insert(
- std::make_pair(ClassPair, I->second));
+ VirtualBaseClassOffsetOffsets.insert(std::make_pair(ClassPair, I->second));
}
}
Modified: cfe/trunk/lib/CodeGen/CGVTables.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.h?rev=128842&r1=128841&r2=128842&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.h (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.h Mon Apr 4 15:36:06 2011
@@ -103,9 +103,9 @@
const CXXRecordDecl *> ClassPairTy;
/// VirtualBaseClassOffsetOffsets - Contains the vtable offset (relative to
- /// the address point) in chars where the offsets for virtual bases of a class
+ /// the address point) in bytes where the offsets for virtual bases of a class
/// are stored.
- typedef llvm::DenseMap<ClassPairTy, CharUnits>
+ typedef llvm::DenseMap<ClassPairTy, int64_t>
VirtualBaseClassOffsetOffsetsMapTy;
VirtualBaseClassOffsetOffsetsMapTy VirtualBaseClassOffsetOffsets;
@@ -235,13 +235,13 @@
/// stored.
uint64_t getMethodVTableIndex(GlobalDecl GD);
- /// getVirtualBaseOffsetOffset - Return the offset in chars (relative to the
+ /// getVirtualBaseOffsetOffset - Return the offset in bytes (relative to the
/// vtable address point) where the offset of the virtual base that contains
/// the given base is stored, otherwise, if no virtual base contains the given
/// class, return 0. Base must be a virtual base class or an unambigious
/// base.
- CharUnits getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
- const CXXRecordDecl *VBase);
+ int64_t getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
+ const CXXRecordDecl *VBase);
/// getAddressPoint - Get the address point of the given subobject in the
/// class decl.
More information about the cfe-commits
mailing list