[llvm-branch-commits] [cfe-branch] r134767 - in /cfe/branches/type-system-rewrite/lib/CodeGen: ABIInfo.h CGCall.cpp CGObjC.cpp CGRecordLayout.h CGRecordLayoutBuilder.cpp CodeGenModule.cpp CodeGenTypes.cpp CodeGenTypes.h ItaniumCXXABI.cpp TargetInfo.cpp
Chris Lattner
sabre at nondot.org
Fri Jul 8 16:06:55 PDT 2011
Author: lattner
Date: Fri Jul 8 18:06:55 2011
New Revision: 134767
URL: http://llvm.org/viewvc/llvm-project?rev=134767&view=rev
Log:
land Jay's work-in-progress patch with a bunch of aborts littered in places that
I need to revisit. The patch is a huge step forward but there are still some
more things that I'll work on changing.
Modified:
cfe/branches/type-system-rewrite/lib/CodeGen/ABIInfo.h
cfe/branches/type-system-rewrite/lib/CodeGen/CGCall.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CGObjC.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CGRecordLayout.h
cfe/branches/type-system-rewrite/lib/CodeGen/CGRecordLayoutBuilder.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenModule.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.h
cfe/branches/type-system-rewrite/lib/CodeGen/ItaniumCXXABI.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/TargetInfo.cpp
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/ABIInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/ABIInfo.h?rev=134767&r1=134766&r2=134767&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/ABIInfo.h (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/ABIInfo.h Fri Jul 8 18:06:55 2011
@@ -68,7 +68,7 @@
private:
Kind TheKind;
- llvm::PATypeHolder TypeData;
+ llvm::Type *TypeData;
unsigned UIntData;
bool BoolData0;
bool BoolData1;
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CGCall.cpp?rev=134767&r1=134766&r2=134767&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGCall.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGCall.cpp Fri Jul 8 18:06:55 2011
@@ -1,4 +1,4 @@
-//===----- CGCall.h - Encapsulate calling convention details ----*- C++ -*-===//
+//===--- CGCall.cpp - Encapsulate calling convention details ----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -67,31 +67,28 @@
}
const CGFunctionInfo &
-CodeGenTypes::getFunctionInfo(CanQual<FunctionNoProtoType> FTNP,
- bool IsRecursive) {
+CodeGenTypes::getFunctionInfo(CanQual<FunctionNoProtoType> FTNP) {
return getFunctionInfo(FTNP->getResultType().getUnqualifiedType(),
llvm::SmallVector<CanQualType, 16>(),
- FTNP->getExtInfo(), IsRecursive);
+ FTNP->getExtInfo());
}
/// \param Args - contains any initial parameters besides those
/// in the formal type
static const CGFunctionInfo &getFunctionInfo(CodeGenTypes &CGT,
llvm::SmallVectorImpl<CanQualType> &ArgTys,
- CanQual<FunctionProtoType> FTP,
- bool IsRecursive = false) {
+ CanQual<FunctionProtoType> FTP) {
// FIXME: Kill copy.
for (unsigned i = 0, e = FTP->getNumArgs(); i != e; ++i)
ArgTys.push_back(FTP->getArgType(i));
CanQualType ResTy = FTP->getResultType().getUnqualifiedType();
- return CGT.getFunctionInfo(ResTy, ArgTys, FTP->getExtInfo(), IsRecursive);
+ return CGT.getFunctionInfo(ResTy, ArgTys, FTP->getExtInfo());
}
const CGFunctionInfo &
-CodeGenTypes::getFunctionInfo(CanQual<FunctionProtoType> FTP,
- bool IsRecursive) {
+CodeGenTypes::getFunctionInfo(CanQual<FunctionProtoType> FTP) {
llvm::SmallVector<CanQualType, 16> ArgTys;
- return ::getFunctionInfo(*this, ArgTys, FTP, IsRecursive);
+ return ::getFunctionInfo(*this, ArgTys, FTP);
}
static CallingConv getCallingConventionForDecl(const Decl *D) {
@@ -244,8 +241,7 @@
const CGFunctionInfo &CodeGenTypes::getFunctionInfo(CanQualType ResTy,
const llvm::SmallVectorImpl<CanQualType> &ArgTys,
- const FunctionType::ExtInfo &Info,
- bool IsRecursive) {
+ const FunctionType::ExtInfo &Info) {
#ifndef NDEBUG
for (llvm::SmallVectorImpl<CanQualType>::const_iterator
I = ArgTys.begin(), E = ArgTys.end(); I != E; ++I)
@@ -278,18 +274,12 @@
// default now.
ABIArgInfo &RetInfo = FI->getReturnInfo();
if (RetInfo.canHaveCoerceToType() && RetInfo.getCoerceToType() == 0)
- RetInfo.setCoerceToType(ConvertTypeRecursive(FI->getReturnType()));
+ RetInfo.setCoerceToType(ConvertType(FI->getReturnType()));
for (CGFunctionInfo::arg_iterator I = FI->arg_begin(), E = FI->arg_end();
I != E; ++I)
if (I->info.canHaveCoerceToType() && I->info.getCoerceToType() == 0)
- I->info.setCoerceToType(ConvertTypeRecursive(I->type));
-
- // If this is a top-level call and ConvertTypeRecursive hit unresolved pointer
- // types, resolve them now. These pointers may point to this function, which
- // we *just* filled in the FunctionInfo for.
- if (!IsRecursive && !PointersToResolve.empty())
- HandleLateResolvedPointers();
+ I->info.setCoerceToType(ConvertType(I->type));
return *FI;
}
@@ -317,8 +307,7 @@
/***/
void CodeGenTypes::GetExpandedTypes(QualType type,
- llvm::SmallVectorImpl<const llvm::Type*> &expandedTypes,
- bool isRecursive) {
+ llvm::SmallVectorImpl<llvm::Type*> &expandedTypes) {
const RecordType *RT = type->getAsStructureType();
assert(RT && "Can only expand structure types.");
const RecordDecl *RD = RT->getDecl();
@@ -333,9 +322,9 @@
QualType fieldType = FD->getType();
if (fieldType->isRecordType())
- GetExpandedTypes(fieldType, expandedTypes, isRecursive);
+ GetExpandedTypes(fieldType, expandedTypes);
else
- expandedTypes.push_back(ConvertType(fieldType, isRecursive));
+ expandedTypes.push_back(ConvertType(fieldType));
}
}
@@ -629,7 +618,7 @@
return false;
}
-const llvm::FunctionType *CodeGenTypes::GetFunctionType(GlobalDecl GD) {
+llvm::FunctionType *CodeGenTypes::GetFunctionType(GlobalDecl GD) {
const CGFunctionInfo &FI = getFunctionInfo(GD);
// For definition purposes, don't consider a K&R function variadic.
@@ -638,13 +627,12 @@
cast<FunctionDecl>(GD.getDecl())->getType()->getAs<FunctionProtoType>())
Variadic = FPT->isVariadic();
- return GetFunctionType(FI, Variadic, false);
+ return GetFunctionType(FI, Variadic);
}
-const llvm::FunctionType *
-CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI, bool isVariadic,
- bool isRecursive) {
- llvm::SmallVector<const llvm::Type*, 8> argTypes;
+llvm::FunctionType *
+CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI, bool isVariadic) {
+ llvm::SmallVector<llvm::Type*, 8> argTypes;
const llvm::Type *resultType = 0;
const ABIArgInfo &retAI = FI.getReturnInfo();
@@ -662,7 +650,7 @@
resultType = llvm::Type::getVoidTy(getLLVMContext());
QualType ret = FI.getReturnType();
- const llvm::Type *ty = ConvertType(ret, isRecursive);
+ const llvm::Type *ty = ConvertType(ret);
unsigned addressSpace = Context.getTargetAddressSpace(ret);
argTypes.push_back(llvm::PointerType::get(ty, addressSpace));
break;
@@ -683,7 +671,7 @@
case ABIArgInfo::Indirect: {
// indirect arguments are always on the stack, which is addr space #0.
- const llvm::Type *LTy = ConvertTypeForMem(it->type, isRecursive);
+ const llvm::Type *LTy = ConvertTypeForMem(it->type);
argTypes.push_back(LTy->getPointerTo());
break;
}
@@ -693,7 +681,7 @@
// If the coerce-to type is a first class aggregate, flatten it. Either
// way is semantically identical, but fast-isel and the optimizer
// generally likes scalar values better than FCAs.
- const llvm::Type *argType = argAI.getCoerceToType();
+ llvm::Type *argType = argAI.getCoerceToType();
if (const llvm::StructType *st = dyn_cast<llvm::StructType>(argType)) {
for (unsigned i = 0, e = st->getNumElements(); i != e; ++i)
argTypes.push_back(st->getElementType(i));
@@ -704,7 +692,7 @@
}
case ABIArgInfo::Expand:
- GetExpandedTypes(it->type, argTypes, isRecursive);
+ GetExpandedTypes(it->type, argTypes);
break;
}
}
@@ -722,10 +710,10 @@
Info = &getFunctionInfo(cast<CXXDestructorDecl>(MD), GD.getDtorType());
else
Info = &getFunctionInfo(MD);
- return GetFunctionType(*Info, FPT->isVariadic(), false);
+ return GetFunctionType(*Info, FPT->isVariadic());
}
- return llvm::OpaqueType::get(getLLVMContext());
+ return llvm::Type::getVoidTy(getLLVMContext());
}
void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
@@ -852,11 +840,11 @@
continue;
case ABIArgInfo::Expand: {
- llvm::SmallVector<const llvm::Type*, 8> types;
+ llvm::SmallVector<llvm::Type*, 8> types;
// FIXME: This is rather inefficient. Do we ever actually need to do
// anything here? The result should be just reconstructed on the other
// side, so extension should be a non-issue.
- getTypes().GetExpandedTypes(ParamType, types, false);
+ getTypes().GetExpandedTypes(ParamType, types);
Index += types.size();
continue;
}
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CGObjC.cpp?rev=134767&r1=134766&r2=134767&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGObjC.cpp Fri Jul 8 18:06:55 2011
@@ -1041,6 +1041,15 @@
// Otherwise, initialize the loop.
EmitBlock(LoopInitBB);
+
+#if 1
+ abort();
+#else
+ // Make sure StateTy has been laid out.
+ CodeGenTypes &Types = CGM.getTypes();
+ Types.UpdateCompletedType(cast<RecordType>(StateTy.getTypePtr())->getDecl());
+#endif
+
// Save the initial mutations value. This is the value at an
// address that was written into the state object by
// countByEnumeratingWithState:objects:count:.
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CGRecordLayout.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CGRecordLayout.h?rev=134767&r1=134766&r2=134767&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGRecordLayout.h (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGRecordLayout.h Fri Jul 8 18:06:55 2011
@@ -176,11 +176,11 @@
private:
/// The LLVM type corresponding to this record layout; used when
/// laying it out as a complete object.
- llvm::PATypeHolder CompleteObjectType;
+ llvm::StructType *CompleteObjectType;
/// The LLVM type for the non-virtual part of this record layout;
/// used when laying it out as a base subobject.
- llvm::PATypeHolder BaseSubobjectType;
+ llvm::StructType *BaseSubobjectType;
/// Map from (non-bit-field) struct field to the corresponding llvm struct
/// type field no. This info is populated by record builder.
@@ -220,13 +220,13 @@
/// \brief Return the "complete object" LLVM type associated with
/// this record.
llvm::StructType *getLLVMType() const {
- return cast<llvm::StructType>(CompleteObjectType.get());
+ return CompleteObjectType;
}
/// \brief Return the "base subobject" LLVM type associated with
/// this record.
llvm::StructType *getBaseSubobjectLLVMType() const {
- return cast<llvm::StructType>(BaseSubobjectType.get());
+ return BaseSubobjectType;
}
/// \brief Check whether this struct can be C++ zero-initialized
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CGRecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CGRecordLayoutBuilder.cpp?rev=134767&r1=134766&r2=134767&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGRecordLayoutBuilder.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGRecordLayoutBuilder.cpp Fri Jul 8 18:06:55 2011
@@ -230,7 +230,7 @@
uint64_t FieldSize,
uint64_t ContainingTypeSizeInBits,
unsigned ContainingTypeAlign) {
- const llvm::Type *Ty = Types.ConvertTypeForMemRecursive(FD->getType());
+ const llvm::Type *Ty = Types.ConvertTypeForMem(FD->getType());
CharUnits TypeSizeInBytes =
CharUnits::fromQuantity(Types.getTargetData().getTypeAllocSize(Ty));
uint64_t TypeSizeInBits = Types.getContext().toBits(TypeSizeInBytes);
@@ -440,7 +440,7 @@
CharUnits fieldOffsetInBytes
= Types.getContext().toCharUnitsFromBits(fieldOffset);
- llvm::Type *Ty = Types.ConvertTypeForMemRecursive(D->getType());
+ llvm::Type *Ty = Types.ConvertTypeForMem(D->getType());
CharUnits typeAlignment = getTypeAlignment(Ty);
// If the type alignment is larger then the struct alignment, we must use
@@ -515,7 +515,7 @@
// This is a regular union field.
Fields[Field] = 0;
- return Types.ConvertTypeForMemRecursive(Field->getType());
+ return Types.ConvertTypeForMem(Field->getType());
}
void CGRecordLayoutBuilder::LayoutUnion(const RecordDecl *D) {
@@ -924,14 +924,13 @@
}
}
-CGRecordLayout *CodeGenTypes::ComputeRecordLayout(const RecordDecl *D) {
+CGRecordLayout *CodeGenTypes::ComputeRecordLayout(const RecordDecl *D,
+ llvm::StructType *Ty) {
CGRecordLayoutBuilder Builder(*this);
Builder.Layout(D);
- llvm::StructType *Ty = llvm::StructType::get(getLLVMContext(),
- Builder.FieldTypes,
- Builder.Packed);
+ Ty->setBody(Builder.FieldTypes, Builder.Packed);
// If we're in C++, compute the base subobject type.
llvm::StructType *BaseTy = 0;
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenModule.cpp?rev=134767&r1=134766&r2=134767&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenModule.cpp Fri Jul 8 18:06:55 2011
@@ -856,9 +856,15 @@
if (Entry->getType()->getElementType() == Ty)
return Entry;
+#if 0
// Make sure the result is of the correct type.
- const llvm::Type *PTy = llvm::PointerType::getUnqual(Ty);
+ const llvm::Type *PTy =
+ llvm::PointerType::getUnqual(Ty->isVoidTy() ? Int8Ty : Ty);
return llvm::ConstantExpr::getBitCast(Entry, PTy);
+#else
+ abort();
+ return Entry;
+#endif
}
// This function doesn't have a complete type (for example, the return
@@ -928,7 +934,7 @@
return F;
}
- const llvm::Type *PTy = llvm::PointerType::getUnqual(Ty);
+ llvm::Type *PTy = llvm::PointerType::getUnqual(Ty);
return llvm::ConstantExpr::getBitCast(F, PTy);
}
@@ -1442,7 +1448,7 @@
bool variadic = false;
if (const FunctionProtoType *fpt = D->getType()->getAs<FunctionProtoType>())
variadic = fpt->isVariadic();
- const llvm::FunctionType *Ty = getTypes().GetFunctionType(FI, variadic, false);
+ const llvm::FunctionType *Ty = getTypes().GetFunctionType(FI, variadic);
// Get or create the prototype for the function.
llvm::Constant *Entry = GetAddrOfFunction(GD, Ty);
@@ -1711,6 +1717,13 @@
QualType CFTy = getContext().getCFConstantStringType();
+#if 1
+ abort();
+#else
+ // Make sure the class has been laid out.
+ UpdateCompletedType(cast<RecordType>(CFTy.getTypePtr())->getDecl());
+#endif
+
const llvm::StructType *STy =
cast<llvm::StructType>(getTypes().ConvertType(CFTy));
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.cpp?rev=134767&r1=134766&r2=134767&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.cpp Fri Jul 8 18:06:55 2011
@@ -44,27 +44,6 @@
delete &*I++;
}
-/// HandleLateResolvedPointers - For top-level ConvertType calls, this handles
-/// pointers that are referenced but have not been converted yet. This is used
-/// to handle cyclic structures properly.
-void CodeGenTypes::HandleLateResolvedPointers() {
- assert(!PointersToResolve.empty() && "No pointers to resolve!");
-
- // Any pointers that were converted deferred evaluation of their pointee type,
- // creating an opaque type instead. This is in order to avoid problems with
- // circular types. Loop through all these defered pointees, if any, and
- // resolve them now.
- while (!PointersToResolve.empty()) {
- std::pair<QualType, llvm::OpaqueType*> P = PointersToResolve.pop_back_val();
-
- // We can handle bare pointers here because we know that the only pointers
- // to the Opaque type are P.second and from other types. Refining the
- // opqaue type away will invalidate P.second, but we don't mind :).
- const llvm::Type *NT = ConvertTypeForMemRecursive(P.first);
- P.second->refineAbstractTypeTo(NT);
- }
-}
-
void CodeGenTypes::addRecordTypeName(const RecordDecl *RD, const llvm::Type *Ty,
llvm::StringRef suffix) {
llvm::SmallString<256> TypeName;
@@ -93,38 +72,27 @@
if (!suffix.empty())
OS << suffix;
+ // FIXME!
+#if 1
+ abort();
+#else
TheModule.addTypeName(OS.str(), Ty);
+#endif
}
/// ConvertType - Convert the specified type to its LLVM form.
-llvm::Type *CodeGenTypes::ConvertType(QualType T, bool IsRecursive) {
- llvm::Type *Result = ConvertTypeRecursive(T);
-
- // If this is a top-level call to ConvertType and sub-conversions caused
- // pointers to get lazily built as opaque types, resolve the pointers, which
- // might cause Result to be merged away.
- if (!IsRecursive && !PointersToResolve.empty()) {
- llvm::PATypeHolder ResultHandle = Result;
- HandleLateResolvedPointers();
- Result = ResultHandle;
- }
- return Result;
-}
-
-llvm::Type *CodeGenTypes::ConvertTypeRecursive(QualType T) {
+llvm::Type *CodeGenTypes::ConvertType(QualType T) {
T = Context.getCanonicalType(T);
// See if type is already cached.
- llvm::DenseMap<const Type *, llvm::PATypeHolder>::iterator
+ llvm::DenseMap<const Type *, llvm::Type *>::iterator
I = TypeCache.find(T.getTypePtr());
- // If type is found in map and this is not a definition for a opaque
- // place holder type then use it. Otherwise, convert type T.
+ // If type is found in map then use it. Otherwise, convert type T.
if (I != TypeCache.end())
- return I->second.get();
+ return I->second;
llvm::Type *ResultType = ConvertNewType(T);
- TypeCache.insert(std::make_pair(T.getTypePtr(),
- llvm::PATypeHolder(ResultType)));
+ TypeCache.insert(std::make_pair(T.getTypePtr(), ResultType));
return ResultType;
}
@@ -132,8 +100,8 @@
/// ConvertType in that it is used to convert to the memory representation for
/// a type. For example, the scalar representation for _Bool is i1, but the
/// memory representation is usually i8 or i32, depending on the target.
-llvm::Type *CodeGenTypes::ConvertTypeForMem(QualType T, bool IsRecursive){
- llvm::Type *R = ConvertType(T, IsRecursive);
+llvm::Type *CodeGenTypes::ConvertTypeForMem(QualType T){
+ llvm::Type *R = ConvertType(T);
// If this is a non-bool type, don't map it.
if (!R->isIntegerTy(1))
@@ -153,8 +121,8 @@
if (!TT->getDecl()->isDefinition())
return TT;
if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(T))
- for (unsigned i = 0; i < FPT->getNumArgs(); i++)
- if (const TagType* TT = FPT->getArgType(i)->getAs<TagType>())
+ for (unsigned i = 0, e = FPT->getNumArgs(); i != e; i++)
+ if (const TagType *TT = FPT->getArgType(i)->getAs<TagType>())
if (!TT->getDecl()->isDefinition())
return TT;
return 0;
@@ -163,48 +131,21 @@
/// UpdateCompletedType - When we find the full definition for a TagDecl,
/// replace the 'opaque' type we previously made for it if applicable.
void CodeGenTypes::UpdateCompletedType(const TagDecl *TD) {
- const Type *Key = Context.getTagDeclType(TD).getTypePtr();
- llvm::DenseMap<const Type*, llvm::PATypeHolder>::iterator TDTI =
- TagDeclTypes.find(Key);
- if (TDTI == TagDeclTypes.end()) return;
-
- // Remember the opaque LLVM type for this tagdecl.
- llvm::PATypeHolder OpaqueHolder = TDTI->second;
- assert(isa<llvm::OpaqueType>(OpaqueHolder.get()) &&
- "Updating compilation of an already non-opaque type?");
-
- // Remove it from TagDeclTypes so that it will be regenerated.
- TagDeclTypes.erase(TDTI);
-
- // Generate the new type.
- const llvm::Type *NT = ConvertTagDeclType(TD);
-
- // Refine the old opaque type to its new definition.
- cast<llvm::OpaqueType>(OpaqueHolder.get())->refineAbstractTypeTo(NT);
-
- // Since we just completed a tag type, check to see if any function types
- // were completed along with the tag type.
- // FIXME: This is very inefficient; if we track which function types depend
- // on which tag types, though, it should be reasonably efficient.
- llvm::DenseMap<const Type*, llvm::PATypeHolder>::iterator i;
- for (i = FunctionTypes.begin(); i != FunctionTypes.end(); ++i) {
- if (const TagType* TT = VerifyFuncTypeComplete(i->first)) {
- // This function type still depends on an incomplete tag type; make sure
- // that tag type has an associated opaque type.
- ConvertTagDeclType(TT->getDecl());
- } else {
- // This function no longer depends on an incomplete tag type; create the
- // function type, and refine the opaque type to the new function type.
- llvm::PATypeHolder OpaqueHolder = i->second;
- const llvm::Type *NFT = ConvertNewType(QualType(i->first, 0));
- cast<llvm::OpaqueType>(OpaqueHolder.get())->refineAbstractTypeTo(NFT);
- FunctionTypes.erase(i);
- }
+ // If this is an enum being completed, then we flush all non-struct types from
+ // the cache. This allows function types and other things that may be derived
+ // from the enum to be recomputed.
+ if (isa<EnumDecl>(TD)) {
+ TypeCache.clear();
+ return;
}
+
+ const RecordDecl *RD = cast<RecordDecl>(TD);
+ if (!RD->isDependentType())
+ ConvertRecordDeclType(RD);
}
-static const llvm::Type* getTypeForFormat(llvm::LLVMContext &VMContext,
- const llvm::fltSemantics &format) {
+static llvm::Type *getTypeForFormat(llvm::LLVMContext &VMContext,
+ const llvm::fltSemantics &format) {
if (&format == &llvm::APFloat::IEEEsingle)
return llvm::Type::getFloatTy(VMContext);
if (&format == &llvm::APFloat::IEEEdouble)
@@ -219,7 +160,7 @@
return 0;
}
-const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
+llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
const clang::Type &Ty = *Context.getCanonicalType(T).getTypePtr();
switch (Ty.getTypeClass()) {
@@ -293,23 +234,23 @@
}
case Type::Complex: {
const llvm::Type *EltTy =
- ConvertTypeRecursive(cast<ComplexType>(Ty).getElementType());
+ ConvertType(cast<ComplexType>(Ty).getElementType());
return llvm::StructType::get(EltTy, EltTy, NULL);
}
case Type::LValueReference:
case Type::RValueReference: {
const ReferenceType &RTy = cast<ReferenceType>(Ty);
QualType ETy = RTy.getPointeeType();
- llvm::OpaqueType *PointeeType = llvm::OpaqueType::get(getLLVMContext());
- PointersToResolve.push_back(std::make_pair(ETy, PointeeType));
+ llvm::Type *PointeeType = ConvertTypeForMem(ETy);
unsigned AS = Context.getTargetAddressSpace(ETy);
return llvm::PointerType::get(PointeeType, AS);
}
case Type::Pointer: {
const PointerType &PTy = cast<PointerType>(Ty);
QualType ETy = PTy.getPointeeType();
- llvm::OpaqueType *PointeeType = llvm::OpaqueType::get(getLLVMContext());
- PointersToResolve.push_back(std::make_pair(ETy, PointeeType));
+ llvm::Type *PointeeType = ConvertTypeForMem(ETy);
+ if (PointeeType->isVoidTy())
+ PointeeType = llvm::Type::getInt8Ty(getLLVMContext());
unsigned AS = Context.getTargetAddressSpace(ETy);
return llvm::PointerType::get(PointeeType, AS);
}
@@ -320,74 +261,64 @@
"FIXME: We only handle trivial array types so far!");
// VLAs resolve to the innermost element type; this matches
// the return of alloca, and there isn't any obviously better choice.
- return ConvertTypeForMemRecursive(A.getElementType());
+ return ConvertTypeForMem(A.getElementType());
}
case Type::IncompleteArray: {
const IncompleteArrayType &A = cast<IncompleteArrayType>(Ty);
assert(A.getIndexTypeCVRQualifiers() == 0 &&
"FIXME: We only handle trivial array types so far!");
// int X[] -> [0 x int]
- return llvm::ArrayType::get(ConvertTypeForMemRecursive(A.getElementType()),
- 0);
+ return llvm::ArrayType::get(ConvertTypeForMem(A.getElementType()), 0);
}
case Type::ConstantArray: {
const ConstantArrayType &A = cast<ConstantArrayType>(Ty);
- const llvm::Type *EltTy = ConvertTypeForMemRecursive(A.getElementType());
+ const llvm::Type *EltTy = ConvertTypeForMem(A.getElementType());
return llvm::ArrayType::get(EltTy, A.getSize().getZExtValue());
}
case Type::ExtVector:
case Type::Vector: {
const VectorType &VT = cast<VectorType>(Ty);
- return llvm::VectorType::get(ConvertTypeRecursive(VT.getElementType()),
+ return llvm::VectorType::get(ConvertType(VT.getElementType()),
VT.getNumElements());
}
case Type::FunctionNoProto:
case Type::FunctionProto: {
// First, check whether we can build the full function type. If the
// function type depends on an incomplete type (e.g. a struct or enum), we
- // cannot lower the function type. Instead, turn it into an Opaque pointer
- // and have UpdateCompletedType revisit the function type when/if the opaque
- // argument type is defined.
- if (const TagType *TT = VerifyFuncTypeComplete(&Ty)) {
- // This function's type depends on an incomplete tag type; make sure
- // we have an opaque type corresponding to the tag type.
- ConvertTagDeclType(TT->getDecl());
- // Create an opaque type for this function type, save it, and return it.
- llvm::Type *ResultType = llvm::OpaqueType::get(getLLVMContext());
- FunctionTypes.insert(std::make_pair(&Ty, ResultType));
- return ResultType;
- }
-
+ // cannot lower the function type.
+ if (VerifyFuncTypeComplete(&Ty))
+ // This function's type depends on an incomplete tag type.
+ // Return a placeholder type.
+ return llvm::StructType::get(getLLVMContext());
+
// The function type can be built; call the appropriate routines to
// build it.
const CGFunctionInfo *FI;
bool isVariadic;
if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(&Ty)) {
FI = &getFunctionInfo(
- CanQual<FunctionProtoType>::CreateUnsafe(QualType(FPT, 0)),
- true /*Recursive*/);
+ CanQual<FunctionProtoType>::CreateUnsafe(QualType(FPT, 0)));
isVariadic = FPT->isVariadic();
} else {
const FunctionNoProtoType *FNPT = cast<FunctionNoProtoType>(&Ty);
FI = &getFunctionInfo(
- CanQual<FunctionNoProtoType>::CreateUnsafe(QualType(FNPT, 0)),
- true /*Recursive*/);
+ CanQual<FunctionNoProtoType>::CreateUnsafe(QualType(FNPT, 0)));
isVariadic = true;
}
- return GetFunctionType(*FI, isVariadic, true);
+ return GetFunctionType(*FI, isVariadic);
}
case Type::ObjCObject:
- return ConvertTypeRecursive(cast<ObjCObjectType>(Ty).getBaseType());
+ return ConvertType(cast<ObjCObjectType>(Ty).getBaseType());
case Type::ObjCInterface: {
// Objective-C interfaces are always opaque (outside of the
// runtime, which can do whatever it likes); we never refine
// these.
- const llvm::Type *&T = InterfaceTypes[cast<ObjCInterfaceType>(&Ty)];
+ llvm::Type *&T = InterfaceTypes[cast<ObjCInterfaceType>(&Ty)];
if (!T)
- T = llvm::OpaqueType::get(getLLVMContext());
+ T = llvm::StructType::get(getLLVMContext());
return T;
}
@@ -396,24 +327,24 @@
// pointer to the underlying interface type. We don't need to worry about
// recursive conversion.
const llvm::Type *T =
- ConvertTypeRecursive(cast<ObjCObjectPointerType>(Ty).getPointeeType());
+ ConvertType(cast<ObjCObjectPointerType>(Ty).getPointeeType());
return llvm::PointerType::getUnqual(T);
}
case Type::Record:
- case Type::Enum: {
- const TagDecl *TD = cast<TagType>(Ty).getDecl();
- const llvm::Type *Res = ConvertTagDeclType(TD);
+ return ConvertRecordDeclType(cast<RecordType>(Ty).getDecl());
- if (const RecordDecl *RD = dyn_cast<RecordDecl>(TD))
- addRecordTypeName(RD, Res, llvm::StringRef());
- return Res;
+ case Type::Enum: {
+ const EnumDecl *ED = cast<EnumType>(Ty).getDecl();
+ if (ED->isDefinition() || ED->isFixed())
+ return ConvertType(ED->getIntegerType());
+ // Return a placeholder type.
+ return llvm::Type::getVoidTy(getLLVMContext());
}
case Type::BlockPointer: {
const QualType FTy = cast<BlockPointerType>(Ty).getPointeeType();
- llvm::OpaqueType *PointeeType = llvm::OpaqueType::get(getLLVMContext());
- PointersToResolve.push_back(std::make_pair(FTy, PointeeType));
+ llvm::Type *PointeeType = ConvertTypeForMem(FTy);
unsigned AS = Context.getTargetAddressSpace(FTy);
return llvm::PointerType::get(PointeeType, AS);
}
@@ -424,75 +355,52 @@
}
// FIXME: implement.
- return llvm::OpaqueType::get(getLLVMContext());
+ return llvm::StructType::get(getLLVMContext());
}
-/// ConvertTagDeclType - Lay out a tagged decl type like struct or union or
-/// enum.
-const llvm::Type *CodeGenTypes::ConvertTagDeclType(const TagDecl *TD) {
+/// ConvertRecordDeclType - Lay out a tagged decl type like struct or union.
+llvm::Type *CodeGenTypes::ConvertRecordDeclType(const RecordDecl *RD) {
+
// TagDecl's are not necessarily unique, instead use the (clang)
// type connected to the decl.
- const Type *Key =
- Context.getTagDeclType(TD).getTypePtr();
- llvm::DenseMap<const Type*, llvm::PATypeHolder>::iterator TDTI =
- TagDeclTypes.find(Key);
-
- // If we've already compiled this tag type, use the previous definition.
- if (TDTI != TagDeclTypes.end())
- return TDTI->second;
-
- const EnumDecl *ED = dyn_cast<EnumDecl>(TD);
-
- // If this is still a forward declaration, just define an opaque
- // type to use for this tagged decl.
- // C++0x: If this is a enumeration type with fixed underlying type,
- // consider it complete.
- if (!TD->isDefinition() && !(ED && ED->isFixed())) {
- llvm::Type *ResultType = llvm::OpaqueType::get(getLLVMContext());
- TagDeclTypes.insert(std::make_pair(Key, ResultType));
- return ResultType;
- }
+ QualType T = Context.getTagDeclType(RD);
+ const Type *Key = T.getTypePtr();
- // Okay, this is a definition of a type. Compile the implementation now.
-
- if (ED) // Don't bother storing enums in TagDeclTypes.
- return ConvertTypeRecursive(ED->getIntegerType());
-
- // This decl could well be recursive. In this case, insert an opaque
- // definition of this type, which the recursive uses will get. We will then
- // refine this opaque version later.
-
- // Create new OpaqueType now for later use in case this is a recursive
- // type. This will later be refined to the actual type.
- llvm::PATypeHolder ResultHolder = llvm::OpaqueType::get(getLLVMContext());
- TagDeclTypes.insert(std::make_pair(Key, ResultHolder));
+#if 0
+ abort();
+#endif
+
+ //std::string Name =
+ //std::string(RD->getKindName()) + "." + RD->getQualifiedNameAsString();
+ //llvm::StructType::createNamed(getLLVMContext(), Name);
+
+ // Get the opaque LLVM type.
+ llvm::StructType *Ty = cast<llvm::StructType>(ConvertType(T));
+
+ // If this is still a forward declaration, or the LLVM type is already
+ // complete, there's nothing more to do.
+ if (!RD->isDefinition() || !Ty->isOpaque())
+ return Ty;
- const RecordDecl *RD = cast<const RecordDecl>(TD);
+ // Okay, this is a definition of a type. Compile the implementation now.
// Force conversion of non-virtual base classes recursively.
- if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(TD)) {
- for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
- e = RD->bases_end(); i != e; ++i) {
+ if (const CXXRecordDecl *CRD = dyn_cast<CXXRecordDecl>(RD)) {
+ for (CXXRecordDecl::base_class_const_iterator i = CRD->bases_begin(),
+ e = CRD->bases_end(); i != e; ++i) {
if (!i->isVirtual()) {
const CXXRecordDecl *Base =
cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
- ConvertTagDeclType(Base);
+ ConvertRecordDeclType(Base);
}
}
}
// Layout fields.
- CGRecordLayout *Layout = ComputeRecordLayout(RD);
-
+ CGRecordLayout *Layout = ComputeRecordLayout(RD, Ty);
CGRecordLayouts[Key] = Layout;
- const llvm::Type *ResultType = Layout->getLLVMType();
-
- // Refine our Opaque type to ResultType. This can invalidate ResultType, so
- // make sure to read the result out of the holder.
- cast<llvm::OpaqueType>(ResultHolder.get())
- ->refineAbstractTypeTo(ResultType);
- return ResultHolder.get();
+ return Ty;
}
/// getCGRecordLayout - Return record layout info for the given record decl.
@@ -503,7 +411,7 @@
const CGRecordLayout *Layout = CGRecordLayouts.lookup(Key);
if (!Layout) {
// Compute the type information.
- ConvertTagDeclType(RD);
+ ConvertRecordDeclType(RD);
// Now try again.
Layout = CGRecordLayouts.lookup(Key);
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.h?rev=134767&r1=134766&r2=134767&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.h (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.h Fri Jul 8 18:06:55 2011
@@ -23,11 +23,10 @@
namespace llvm {
class FunctionType;
class Module;
- class OpaqueType;
- class PATypeHolder;
class TargetData;
class Type;
class LLVMContext;
+ class StructType;
}
namespace clang {
@@ -65,18 +64,11 @@
CGCXXABI &TheCXXABI;
const CodeGenOptions &CodeGenOpts;
- llvm::SmallVector<std::pair<QualType,
- llvm::OpaqueType *>, 8> PointersToResolve;
-
- llvm::DenseMap<const Type*, llvm::PATypeHolder> TagDeclTypes;
-
- llvm::DenseMap<const Type*, llvm::PATypeHolder> FunctionTypes;
-
/// The opaque type map for Objective-C interfaces. All direct
/// manipulation is done by the runtime interfaces, which are
/// responsible for coercing to the appropriate type; these opaque
/// types are never refined.
- llvm::DenseMap<const ObjCInterfaceType*, const llvm::Type *> InterfaceTypes;
+ llvm::DenseMap<const ObjCInterfaceType*, llvm::Type *> InterfaceTypes;
/// CGRecordLayouts - This maps llvm struct type with corresponding
/// record layout info.
@@ -86,22 +78,15 @@
llvm::FoldingSet<CGFunctionInfo> FunctionInfos;
private:
- /// TypeCache - This map keeps cache of llvm::Types (through PATypeHolder)
- /// and maps llvm::Types to corresponding clang::Type. llvm::PATypeHolder is
- /// used instead of llvm::Type because it allows us to bypass potential
- /// dangling type pointers due to type refinement on llvm side.
- llvm::DenseMap<const Type *, llvm::PATypeHolder> TypeCache;
+ /// TypeCache - This map keeps cache of llvm::Types
+ /// and maps llvm::Types to corresponding clang::Type.
+ llvm::DenseMap<const Type *, llvm::Type *> TypeCache;
/// ConvertNewType - Convert type T into a llvm::Type. Do not use this
/// method directly because it does not do any type caching. This method
/// is available only for ConvertType(). CovertType() is preferred
/// interface to convert type T into a llvm::Type.
- const llvm::Type *ConvertNewType(QualType T);
-
- /// HandleLateResolvedPointers - For top-level ConvertType calls, this handles
- /// pointers that are referenced but have not been converted yet. This is
- /// used to handle cyclic structures properly.
- void HandleLateResolvedPointers();
+ llvm::Type *ConvertNewType(QualType T);
/// addRecordTypeName - Compute a name from the given record decl with an
/// optional suffix and name the given LLVM type using it.
@@ -123,24 +108,19 @@
llvm::LLVMContext &getLLVMContext() { return TheModule.getContext(); }
/// ConvertType - Convert type T into a llvm::Type.
- llvm::Type *ConvertType(QualType T, bool IsRecursive = false);
- llvm::Type *ConvertTypeRecursive(QualType T);
+ llvm::Type *ConvertType(QualType T);
/// ConvertTypeForMem - Convert type T into a llvm::Type. This differs from
/// ConvertType in that it is used to convert to the memory representation for
/// a type. For example, the scalar representation for _Bool is i1, but the
/// memory representation is usually i8 or i32, depending on the target.
- llvm::Type *ConvertTypeForMem(QualType T, bool IsRecursive = false);
- llvm::Type *ConvertTypeForMemRecursive(QualType T) {
- return ConvertTypeForMem(T, true);
- }
+ llvm::Type *ConvertTypeForMem(QualType T);
/// GetFunctionType - Get the LLVM function type for \arg Info.
- const llvm::FunctionType *GetFunctionType(const CGFunctionInfo &Info,
- bool IsVariadic,
- bool IsRecursive = false);
+ llvm::FunctionType *GetFunctionType(const CGFunctionInfo &Info,
+ bool IsVariadic);
- const llvm::FunctionType *GetFunctionType(GlobalDecl GD);
+ llvm::FunctionType *GetFunctionType(GlobalDecl GD);
/// VerifyFuncTypeComplete - Utility to check whether a function type can
/// be converted to an LLVM type (i.e. doesn't depend on an incomplete tag
@@ -184,10 +164,8 @@
Ty->getExtInfo());
}
- const CGFunctionInfo &getFunctionInfo(CanQual<FunctionProtoType> Ty,
- bool IsRecursive = false);
- const CGFunctionInfo &getFunctionInfo(CanQual<FunctionNoProtoType> Ty,
- bool IsRecursive = false);
+ const CGFunctionInfo &getFunctionInfo(CanQual<FunctionProtoType> Ty);
+ const CGFunctionInfo &getFunctionInfo(CanQual<FunctionNoProtoType> Ty);
/// getFunctionInfo - Get the function info for a member function of
/// the given type. This is used for calls through member function
@@ -210,23 +188,21 @@
/// \param ArgTys - must all actually be canonical as params
const CGFunctionInfo &getFunctionInfo(CanQualType RetTy,
const llvm::SmallVectorImpl<CanQualType> &ArgTys,
- const FunctionType::ExtInfo &Info,
- bool IsRecursive = false);
+ const FunctionType::ExtInfo &Info);
/// \brief Compute a new LLVM record layout object for the given record.
- CGRecordLayout *ComputeRecordLayout(const RecordDecl *D);
+ CGRecordLayout *ComputeRecordLayout(const RecordDecl *D,
+ llvm::StructType *Ty);
public: // These are internal details of CGT that shouldn't be used externally.
- /// ConvertTagDeclType - Lay out a tagged decl type like struct or union or
- /// enum.
- const llvm::Type *ConvertTagDeclType(const TagDecl *TD);
+ /// ConvertRecordDeclType - Lay out a tagged decl type like struct or union.
+ llvm::Type *ConvertRecordDeclType(const RecordDecl *TD);
/// GetExpandedTypes - Expand the type \arg Ty into the LLVM
/// argument types it would be passed as on the provided vector \arg
/// ArgTys. See ABIArgInfo::Expand.
void GetExpandedTypes(QualType type,
- llvm::SmallVectorImpl<const llvm::Type*> &expanded,
- bool isRecursive);
+ llvm::SmallVectorImpl<llvm::Type*> &expanded);
/// IsZeroInitializable - Return whether a type can be
/// zero-initialized (in the C++ sense) with an LLVM zeroinitializer.
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/ItaniumCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/ItaniumCXXABI.cpp?rev=134767&r1=134766&r2=134767&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/ItaniumCXXABI.cpp Fri Jul 8 18:06:55 2011
@@ -42,7 +42,7 @@
llvm::IntegerType *getPtrDiffTy() {
if (!PtrDiffTy) {
QualType T = getContext().getPointerDiffType();
- llvm::Type *Ty = CGM.getTypes().ConvertTypeRecursive(T);
+ llvm::Type *Ty = CGM.getTypes().ConvertType(T);
PtrDiffTy = cast<llvm::IntegerType>(Ty);
}
return PtrDiffTy;
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/TargetInfo.cpp?rev=134767&r1=134766&r2=134767&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/TargetInfo.cpp Fri Jul 8 18:06:55 2011
@@ -699,7 +699,7 @@
Size));
}
- llvm::Type *IRType = CGT.ConvertTypeRecursive(Ty);
+ llvm::Type *IRType = CGT.ConvertType(Ty);
if (UseX86_MMXType(IRType)) {
ABIArgInfo AAI = ABIArgInfo::getDirect(IRType);
AAI.setCoerceToType(llvm::Type::getX86_MMXTy(getVMContext()));
@@ -1325,7 +1325,7 @@
/// full vector XMM register. Pick an LLVM IR type that will be passed as a
/// vector register.
llvm::Type *X86_64ABIInfo::Get16ByteVectorType(QualType Ty) const {
- llvm::Type *IRType = CGT.ConvertTypeRecursive(Ty);
+ llvm::Type *IRType = CGT.ConvertType(Ty);
// Wrapper structs that just contain vectors are passed just like vectors,
// strip them off if present.
@@ -1637,8 +1637,7 @@
// AMD64-ABI 3.2.3p4: Rule 3. If the class is INTEGER, the next
// available register of the sequence %rax, %rdx is used.
case Integer:
- ResType = GetINTEGERTypeAtOffset(CGT.ConvertTypeRecursive(RetTy), 0,
- RetTy, 0);
+ ResType = GetINTEGERTypeAtOffset(CGT.ConvertType(RetTy), 0, RetTy, 0);
// If we have a sign or zero extended integer, make sure to return Extend
// so that the parameter gets the right LLVM IR attributes.
@@ -1656,7 +1655,7 @@
// AMD64-ABI 3.2.3p4: Rule 4. If the class is SSE, the next
// available SSE register of the sequence %xmm0, %xmm1 is used.
case SSE:
- ResType = GetSSETypeAtOffset(CGT.ConvertTypeRecursive(RetTy), 0, RetTy, 0);
+ ResType = GetSSETypeAtOffset(CGT.ConvertType(RetTy), 0, RetTy, 0);
break;
// AMD64-ABI 3.2.3p4: Rule 6. If the class is X87, the value is
@@ -1689,13 +1688,12 @@
break;
case Integer:
- HighPart = GetINTEGERTypeAtOffset(CGT.ConvertTypeRecursive(RetTy),
- 8, RetTy, 8);
+ HighPart = GetINTEGERTypeAtOffset(CGT.ConvertType(RetTy), 8, RetTy, 8);
if (Lo == NoClass) // Return HighPart at offset 8 in memory.
return ABIArgInfo::getDirect(HighPart, 8);
break;
case SSE:
- HighPart = GetSSETypeAtOffset(CGT.ConvertTypeRecursive(RetTy), 8, RetTy, 8);
+ HighPart = GetSSETypeAtOffset(CGT.ConvertType(RetTy), 8, RetTy, 8);
if (Lo == NoClass) // Return HighPart at offset 8 in memory.
return ABIArgInfo::getDirect(HighPart, 8);
break;
@@ -1717,8 +1715,7 @@
// preceded by X87. In such situations we follow gcc and pass the
// extra bits in an SSE reg.
if (Lo != X87) {
- HighPart = GetSSETypeAtOffset(CGT.ConvertTypeRecursive(RetTy),
- 8, RetTy, 8);
+ HighPart = GetSSETypeAtOffset(CGT.ConvertType(RetTy), 8, RetTy, 8);
if (Lo == NoClass) // Return HighPart at offset 8 in memory.
return ABIArgInfo::getDirect(HighPart, 8);
}
@@ -1780,7 +1777,7 @@
++neededInt;
// Pick an 8-byte type based on the preferred type.
- ResType = GetINTEGERTypeAtOffset(CGT.ConvertTypeRecursive(Ty), 0, Ty, 0);
+ ResType = GetINTEGERTypeAtOffset(CGT.ConvertType(Ty), 0, Ty, 0);
// If we have a sign or zero extended integer, make sure to return Extend
// so that the parameter gets the right LLVM IR attributes.
@@ -1800,7 +1797,7 @@
// available SSE register is used, the registers are taken in the
// order from %xmm0 to %xmm7.
case SSE: {
- llvm::Type *IRType = CGT.ConvertTypeRecursive(Ty);
+ llvm::Type *IRType = CGT.ConvertType(Ty);
ResType = GetSSETypeAtOffset(IRType, 0, Ty, 0);
++neededSSE;
break;
@@ -1823,7 +1820,7 @@
case Integer:
++neededInt;
// Pick an 8-byte type based on the preferred type.
- HighPart = GetINTEGERTypeAtOffset(CGT.ConvertTypeRecursive(Ty), 8, Ty, 8);
+ HighPart = GetINTEGERTypeAtOffset(CGT.ConvertType(Ty), 8, Ty, 8);
if (Lo == NoClass) // Pass HighPart at offset 8 in memory.
return ABIArgInfo::getDirect(HighPart, 8);
@@ -1833,7 +1830,7 @@
// memory), except in situations involving unions.
case X87Up:
case SSE:
- HighPart = GetSSETypeAtOffset(CGT.ConvertTypeRecursive(Ty), 8, Ty, 8);
+ HighPart = GetSSETypeAtOffset(CGT.ConvertType(Ty), 8, Ty, 8);
if (Lo == NoClass) // Pass HighPart at offset 8 in memory.
return ABIArgInfo::getDirect(HighPart, 8);
More information about the llvm-branch-commits
mailing list