[llvm-branch-commits] [cfe-branch] r134694 - in /cfe/branches/type-system-rewrite/lib/CodeGen: ABIInfo.h CGBlocks.cpp CGBuiltin.cpp CGCXXABI.cpp CGCXXABI.h CGDeclCXX.cpp CGException.cpp CGExpr.cpp CGExprCXX.cpp CGExprScalar.cpp CGObjC.cpp CGObjCGNU.cpp CGObjCMac.cpp CGRecordLayout.h CGRecordLayoutBuilder.cpp CGStmt.cpp CodeGenFunction.cpp CodeGenFunction.h CodeGenModule.cpp CodeGenModule.h CodeGenTypes.cpp CodeGenTypes.h ItaniumCXXABI.cpp TargetInfo.cpp
Jay Foad
jay.foad at gmail.com
Fri Jul 8 01:40:05 PDT 2011
Author: foad
Date: Fri Jul 8 03:40:05 2011
New Revision: 134694
URL: http://llvm.org/viewvc/llvm-project?rev=134694&view=rev
Log:
Mechanical changes: de-constify llvm::Type and use new APIs for creating
named llvm::StructTypes.
Modified:
cfe/branches/type-system-rewrite/lib/CodeGen/ABIInfo.h
cfe/branches/type-system-rewrite/lib/CodeGen/CGBlocks.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CGBuiltin.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CGCXXABI.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CGCXXABI.h
cfe/branches/type-system-rewrite/lib/CodeGen/CGDeclCXX.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CGException.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CGExpr.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CGExprCXX.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CGExprScalar.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CGObjC.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CGObjCGNU.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CGObjCMac.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/CGStmt.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenFunction.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenFunction.h
cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenModule.cpp
cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenModule.h
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=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/ABIInfo.h (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/ABIInfo.h Fri Jul 8 03:40:05 2011
@@ -73,17 +73,17 @@
bool BoolData0;
bool BoolData1;
- ABIArgInfo(Kind K, const llvm::Type *TD=0,
+ ABIArgInfo(Kind K, llvm::Type *TD=0,
unsigned UI=0, bool B0 = false, bool B1 = false)
: TheKind(K), TypeData(TD), UIntData(UI), BoolData0(B0), BoolData1(B1) {}
public:
ABIArgInfo() : TheKind(Direct), TypeData(0), UIntData(0) {}
- static ABIArgInfo getDirect(const llvm::Type *T = 0, unsigned Offset = 0) {
+ static ABIArgInfo getDirect(llvm::Type *T = 0, unsigned Offset = 0) {
return ABIArgInfo(Direct, T, Offset);
}
- static ABIArgInfo getExtend(const llvm::Type *T = 0) {
+ static ABIArgInfo getExtend(llvm::Type *T = 0) {
return ABIArgInfo(Extend, T, 0);
}
static ABIArgInfo getIgnore() {
@@ -113,12 +113,12 @@
assert((isDirect() || isExtend()) && "Not a direct or extend kind");
return UIntData;
}
- const llvm::Type *getCoerceToType() const {
+ llvm::Type *getCoerceToType() const {
assert(canHaveCoerceToType() && "Invalid kind!");
return TypeData;
}
- void setCoerceToType(const llvm::Type *T) {
+ void setCoerceToType(llvm::Type *T) {
assert(canHaveCoerceToType() && "Invalid kind!");
TypeData = T;
}
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CGBlocks.cpp?rev=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGBlocks.cpp Fri Jul 8 03:40:05 2011
@@ -654,11 +654,11 @@
}
-const llvm::Type *CodeGenModule::getBlockDescriptorType() {
+llvm::Type *CodeGenModule::getBlockDescriptorType() {
if (BlockDescriptorType)
return BlockDescriptorType;
- const llvm::Type *UnsignedLongTy =
+ llvm::Type *UnsignedLongTy =
getTypes().ConvertType(getContext().UnsignedLongTy);
// struct __block_descriptor {
@@ -676,21 +676,19 @@
// const char *layout; // reserved
// };
BlockDescriptorType =
- llvm::StructType::get(UnsignedLongTy, UnsignedLongTy, NULL);
-
- getModule().addTypeName("struct.__block_descriptor",
- BlockDescriptorType);
+ llvm::StructType::createNamed("struct.__block_descriptor",
+ UnsignedLongTy, UnsignedLongTy, NULL);
// Now form a pointer to that.
BlockDescriptorType = llvm::PointerType::getUnqual(BlockDescriptorType);
return BlockDescriptorType;
}
-const llvm::Type *CodeGenModule::getGenericBlockLiteralType() {
+llvm::Type *CodeGenModule::getGenericBlockLiteralType() {
if (GenericBlockLiteralType)
return GenericBlockLiteralType;
- const llvm::Type *BlockDescPtrTy = getBlockDescriptorType();
+ llvm::Type *BlockDescPtrTy = getBlockDescriptorType();
// struct __block_literal_generic {
// void *__isa;
@@ -699,15 +697,14 @@
// void (*__invoke)(void *);
// struct __block_descriptor *__descriptor;
// };
- GenericBlockLiteralType = llvm::StructType::get(VoidPtrTy,
- IntTy,
- IntTy,
- VoidPtrTy,
- BlockDescPtrTy,
- NULL);
-
- getModule().addTypeName("struct.__block_literal_generic",
- GenericBlockLiteralType);
+ GenericBlockLiteralType =
+ llvm::StructType::createNamed("struct.__block_literal_generic",
+ VoidPtrTy,
+ IntTy,
+ IntTy,
+ VoidPtrTy,
+ BlockDescPtrTy,
+ NULL);
return GenericBlockLiteralType;
}
@@ -1663,15 +1660,17 @@
QualType Ty = D->getType();
- llvm::SmallVector<const llvm::Type *, 8> types;
+ llvm::SmallVector<llvm::Type *, 8> types;
- llvm::PATypeHolder ByRefTypeHolder = llvm::OpaqueType::get(getLLVMContext());
+ llvm::StructType *ByRefType =
+ llvm::StructType::createNamed(getLLVMContext(),
+ "struct.__block_byref_" + D->getNameAsString());
// void *__isa;
types.push_back(Int8PtrTy);
// void *__forwarding;
- types.push_back(llvm::PointerType::getUnqual(ByRefTypeHolder));
+ types.push_back(llvm::PointerType::getUnqual(ByRefType));
// int32_t __flags;
types.push_back(Int32Ty);
@@ -1706,7 +1705,7 @@
unsigned NumPaddingBytes = AlignedOffsetInBytes - CurrentOffsetInBytes;
if (NumPaddingBytes > 0) {
- const llvm::Type *Ty = llvm::Type::getInt8Ty(getLLVMContext());
+ llvm::Type *Ty = llvm::Type::getInt8Ty(getLLVMContext());
// FIXME: We need a sema error for alignment larger than the minimum of
// the maximal stack alignment and the alignment of malloc on the system.
if (NumPaddingBytes > 1)
@@ -1722,13 +1721,9 @@
// T x;
types.push_back(ConvertTypeForMem(Ty));
- const llvm::Type *T = llvm::StructType::get(getLLVMContext(), types, Packed);
-
- cast<llvm::OpaqueType>(ByRefTypeHolder.get())->refineAbstractTypeTo(T);
- CGM.getModule().addTypeName("struct.__block_byref_" + D->getNameAsString(),
- ByRefTypeHolder.get());
+ ByRefType->setBody(types, Packed);
- Info.first = ByRefTypeHolder.get();
+ Info.first = ByRefType;
Info.second = types.size() - 1;
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CGBuiltin.cpp?rev=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGBuiltin.cpp Fri Jul 8 03:40:05 2011
@@ -94,12 +94,12 @@
unsigned AddrSpace =
cast<llvm::PointerType>(DestPtr->getType())->getAddressSpace();
- const llvm::IntegerType *IntType =
+ llvm::IntegerType *IntType =
llvm::IntegerType::get(CGF.getLLVMContext(),
CGF.getContext().getTypeSize(T));
- const llvm::Type *IntPtrType = IntType->getPointerTo(AddrSpace);
+ llvm::Type *IntPtrType = IntType->getPointerTo(AddrSpace);
- const llvm::Type *IntrinsicTypes[2] = { IntType, IntPtrType };
+ llvm::Type *IntrinsicTypes[2] = { IntType, IntPtrType };
llvm::Value *AtomF = CGF.CGM.getIntrinsic(Id, IntrinsicTypes, 2);
llvm::Value *Args[2];
@@ -129,12 +129,12 @@
unsigned AddrSpace =
cast<llvm::PointerType>(DestPtr->getType())->getAddressSpace();
- const llvm::IntegerType *IntType =
+ llvm::IntegerType *IntType =
llvm::IntegerType::get(CGF.getLLVMContext(),
CGF.getContext().getTypeSize(T));
- const llvm::Type *IntPtrType = IntType->getPointerTo(AddrSpace);
+ llvm::Type *IntPtrType = IntType->getPointerTo(AddrSpace);
- const llvm::Type *IntrinsicTypes[2] = { IntType, IntPtrType };
+ llvm::Type *IntrinsicTypes[2] = { IntType, IntPtrType };
llvm::Value *AtomF = CGF.CGM.getIntrinsic(Id, IntrinsicTypes, 2);
llvm::Value *Args[2];
@@ -164,7 +164,8 @@
}
// The prototype is something that takes and returns whatever V's type is.
- llvm::FunctionType *FT = llvm::FunctionType::get(V->getType(), V->getType(),
+ llvm::Type *ArgTys[] = { V->getType() };
+ llvm::FunctionType *FT = llvm::FunctionType::get(V->getType(), ArgTys,
false);
llvm::Value *Fn = CGF.CGM.CreateRuntimeFunction(FT, FnName);
@@ -232,7 +233,7 @@
case Builtin::BI__builtin_ctzll: {
Value *ArgValue = EmitScalarExpr(E->getArg(0));
- const llvm::Type *ArgType = ArgValue->getType();
+ llvm::Type *ArgType = ArgValue->getType();
Value *F = CGM.getIntrinsic(Intrinsic::cttz, &ArgType, 1);
const llvm::Type *ResultType = ConvertType(E->getType());
@@ -247,7 +248,7 @@
case Builtin::BI__builtin_clzll: {
Value *ArgValue = EmitScalarExpr(E->getArg(0));
- const llvm::Type *ArgType = ArgValue->getType();
+ llvm::Type *ArgType = ArgValue->getType();
Value *F = CGM.getIntrinsic(Intrinsic::ctlz, &ArgType, 1);
const llvm::Type *ResultType = ConvertType(E->getType());
@@ -263,7 +264,7 @@
// ffs(x) -> x ? cttz(x) + 1 : 0
Value *ArgValue = EmitScalarExpr(E->getArg(0));
- const llvm::Type *ArgType = ArgValue->getType();
+ llvm::Type *ArgType = ArgValue->getType();
Value *F = CGM.getIntrinsic(Intrinsic::cttz, &ArgType, 1);
const llvm::Type *ResultType = ConvertType(E->getType());
@@ -283,7 +284,7 @@
// parity(x) -> ctpop(x) & 1
Value *ArgValue = EmitScalarExpr(E->getArg(0));
- const llvm::Type *ArgType = ArgValue->getType();
+ llvm::Type *ArgType = ArgValue->getType();
Value *F = CGM.getIntrinsic(Intrinsic::ctpop, &ArgType, 1);
const llvm::Type *ResultType = ConvertType(E->getType());
@@ -300,7 +301,7 @@
case Builtin::BI__builtin_popcountll: {
Value *ArgValue = EmitScalarExpr(E->getArg(0));
- const llvm::Type *ArgType = ArgValue->getType();
+ llvm::Type *ArgType = ArgValue->getType();
Value *F = CGM.getIntrinsic(Intrinsic::ctpop, &ArgType, 1);
const llvm::Type *ResultType = ConvertType(E->getType());
@@ -320,14 +321,14 @@
case Builtin::BI__builtin_bswap32:
case Builtin::BI__builtin_bswap64: {
Value *ArgValue = EmitScalarExpr(E->getArg(0));
- const llvm::Type *ArgType = ArgValue->getType();
+ llvm::Type *ArgType = ArgValue->getType();
Value *F = CGM.getIntrinsic(Intrinsic::bswap, &ArgType, 1);
return RValue::get(Builder.CreateCall(F, ArgValue, "tmp"));
}
case Builtin::BI__builtin_object_size: {
// We pass this builtin onto the optimizer so that it can
// figure out the object size in more complex cases.
- const llvm::Type *ResType[] = {
+ llvm::Type *ResType[] = {
ConvertType(E->getType())
};
@@ -376,7 +377,7 @@
case Builtin::BI__builtin_powil: {
Value *Base = EmitScalarExpr(E->getArg(0));
Value *Exponent = EmitScalarExpr(E->getArg(1));
- const llvm::Type *ArgType = Base->getType();
+ llvm::Type *ArgType = Base->getType();
Value *F = CGM.getIntrinsic(Intrinsic::powi, &ArgType, 1);
return RValue::get(Builder.CreateCall2(F, Base, Exponent, "tmp"));
}
@@ -861,11 +862,11 @@
unsigned AddrSpace =
cast<llvm::PointerType>(DestPtr->getType())->getAddressSpace();
- const llvm::IntegerType *IntType =
+ llvm::IntegerType *IntType =
llvm::IntegerType::get(getLLVMContext(),
getContext().getTypeSize(T));
- const llvm::Type *IntPtrType = IntType->getPointerTo(AddrSpace);
- const llvm::Type *IntrinsicTypes[2] = { IntType, IntPtrType };
+ llvm::Type *IntPtrType = IntType->getPointerTo(AddrSpace);
+ llvm::Type *IntrinsicTypes[2] = { IntType, IntPtrType };
Value *AtomF = CGM.getIntrinsic(Intrinsic::atomic_cmp_swap,
IntrinsicTypes, 2);
@@ -891,11 +892,11 @@
unsigned AddrSpace =
cast<llvm::PointerType>(DestPtr->getType())->getAddressSpace();
- const llvm::IntegerType *IntType =
+ llvm::IntegerType *IntType =
llvm::IntegerType::get(getLLVMContext(),
getContext().getTypeSize(T));
- const llvm::Type *IntPtrType = IntType->getPointerTo(AddrSpace);
- const llvm::Type *IntrinsicTypes[2] = { IntType, IntPtrType };
+ llvm::Type *IntPtrType = IntType->getPointerTo(AddrSpace);
+ llvm::Type *IntrinsicTypes[2] = { IntType, IntPtrType };
Value *AtomF = CGM.getIntrinsic(Intrinsic::atomic_cmp_swap,
IntrinsicTypes, 2);
@@ -978,7 +979,7 @@
break;
Value *Base = EmitScalarExpr(E->getArg(0));
Value *Exponent = EmitScalarExpr(E->getArg(1));
- const llvm::Type *ArgType = Base->getType();
+ llvm::Type *ArgType = Base->getType();
Value *F = CGM.getIntrinsic(Intrinsic::pow, &ArgType, 1);
return RValue::get(Builder.CreateCall2(F, Base, Exponent, "tmp"));
}
@@ -1100,8 +1101,7 @@
}
}
-static const llvm::VectorType *GetNeonType(LLVMContext &C, unsigned type,
- bool q) {
+static llvm::VectorType *GetNeonType(LLVMContext &C, unsigned type, bool q) {
switch (type) {
default: break;
case 0:
@@ -1232,7 +1232,7 @@
if (BuiltinID == ARM::BI__builtin_arm_vcvtr_f ||
BuiltinID == ARM::BI__builtin_arm_vcvtr_d) {
// Determine the overloaded type of this builtin.
- const llvm::Type *Ty;
+ llvm::Type *Ty;
if (BuiltinID == ARM::BI__builtin_arm_vcvtr_f)
Ty = llvm::Type::getFloatTy(getLLVMContext());
else
@@ -1255,8 +1255,8 @@
(void)poly; // Only used in assert()s.
bool rightShift = false;
- const llvm::VectorType *VTy = GetNeonType(getLLVMContext(), type & 0x7, quad);
- const llvm::Type *Ty = VTy;
+ llvm::VectorType *VTy = GetNeonType(getLLVMContext(), type & 0x7, quad);
+ llvm::Type *Ty = VTy;
if (!Ty)
return 0;
@@ -1340,7 +1340,7 @@
}
case ARM::BI__builtin_neon_vcvt_n_f32_v:
case ARM::BI__builtin_neon_vcvtq_n_f32_v: {
- const llvm::Type *Tys[2] = { GetNeonType(getLLVMContext(), 4, quad), Ty };
+ llvm::Type *Tys[2] = { GetNeonType(getLLVMContext(), 4, quad), Ty };
Int = usgn ? Intrinsic::arm_neon_vcvtfxu2fp : Intrinsic::arm_neon_vcvtfxs2fp;
Function *F = CGM.getIntrinsic(Int, Tys, 2);
return EmitNeonCall(F, Ops, "vcvt_n");
@@ -1349,7 +1349,7 @@
case ARM::BI__builtin_neon_vcvt_n_u32_v:
case ARM::BI__builtin_neon_vcvtq_n_s32_v:
case ARM::BI__builtin_neon_vcvtq_n_u32_v: {
- const llvm::Type *Tys[2] = { Ty, GetNeonType(getLLVMContext(), 4, quad) };
+ llvm::Type *Tys[2] = { Ty, GetNeonType(getLLVMContext(), 4, quad) };
Int = usgn ? Intrinsic::arm_neon_vcvtfp2fxu : Intrinsic::arm_neon_vcvtfp2fxs;
Function *F = CGM.getIntrinsic(Int, Tys, 2);
return EmitNeonCall(F, Ops, "vcvt_n");
@@ -1567,9 +1567,9 @@
unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
const llvm::Type *EltTy =
llvm::IntegerType::get(getLLVMContext(), EltBits / 2);
- const llvm::Type *NarrowTy =
+ llvm::Type *NarrowTy =
llvm::VectorType::get(EltTy, VTy->getNumElements() * 2);
- const llvm::Type *Tys[2] = { Ty, NarrowTy };
+ llvm::Type *Tys[2] = { Ty, NarrowTy };
return EmitNeonCall(CGM.getIntrinsic(Int, Tys, 2), Ops, "vpadal");
}
case ARM::BI__builtin_neon_vpadd_v:
@@ -1581,9 +1581,9 @@
// The source operand type has twice as many elements of half the size.
unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
const llvm::Type *EltTy = llvm::IntegerType::get(getLLVMContext(), EltBits / 2);
- const llvm::Type *NarrowTy =
+ llvm::Type *NarrowTy =
llvm::VectorType::get(EltTy, VTy->getNumElements() * 2);
- const llvm::Type *Tys[2] = { Ty, NarrowTy };
+ llvm::Type *Tys[2] = { Ty, NarrowTy };
return EmitNeonCall(CGM.getIntrinsic(Int, Tys, 2), Ops, "vpaddl");
}
case ARM::BI__builtin_neon_vpmax_v:
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CGCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CGCXXABI.cpp?rev=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGCXXABI.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGCXXABI.cpp Fri Jul 8 03:40:05 2011
@@ -34,7 +34,7 @@
return llvm::Constant::getNullValue(CGM.getTypes().ConvertType(T));
}
-const llvm::Type *
+llvm::Type *
CGCXXABI::ConvertMemberPointerType(const MemberPointerType *MPT) {
return CGM.getTypes().ConvertType(CGM.getContext().getPointerDiffType());
}
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CGCXXABI.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CGCXXABI.h?rev=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGCXXABI.h (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGCXXABI.h Fri Jul 8 03:40:05 2011
@@ -82,7 +82,7 @@
/// Find the LLVM type used to represent the given member pointer
/// type.
- virtual const llvm::Type *
+ virtual llvm::Type *
ConvertMemberPointerType(const MemberPointerType *MPT);
/// Load a member function from an object and a member function
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CGDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CGDeclCXX.cpp?rev=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGDeclCXX.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGDeclCXX.cpp Fri Jul 8 03:40:05 2011
@@ -117,12 +117,13 @@
}
// Get the destructor function type
- const llvm::Type *DtorFnTy =
+ llvm::Type *ArgTys[] = { Int8PtrTy };
+ llvm::Type *DtorFnTy =
llvm::FunctionType::get(llvm::Type::getVoidTy(getLLVMContext()),
- Int8PtrTy, false);
+ ArgTys, false);
DtorFnTy = llvm::PointerType::getUnqual(DtorFnTy);
- const llvm::Type *Params[] = { DtorFnTy, Int8PtrTy, Int8PtrTy };
+ llvm::Type *Params[] = { DtorFnTy, Int8PtrTy, Int8PtrTy };
// Get the __cxa_atexit function type
// extern "C" int __cxa_atexit ( void (*f)(void *), void *p, void *d );
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CGException.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CGException.cpp?rev=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGException.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGException.cpp Fri Jul 8 03:40:05 2011
@@ -29,10 +29,11 @@
static llvm::Constant *getAllocateExceptionFn(CodeGenFunction &CGF) {
// void *__cxa_allocate_exception(size_t thrown_size);
- const llvm::Type *SizeTy = CGF.ConvertType(CGF.getContext().getSizeType());
+ llvm::Type *SizeTy = CGF.ConvertType(CGF.getContext().getSizeType());
+ llvm::Type *ArgTys[] = { SizeTy };
const llvm::FunctionType *FTy =
llvm::FunctionType::get(llvm::Type::getInt8PtrTy(CGF.getLLVMContext()),
- SizeTy, /*IsVarArgs=*/false);
+ ArgTys, /*IsVarArgs=*/false);
return CGF.CGM.CreateRuntimeFunction(FTy, "__cxa_allocate_exception");
}
@@ -40,10 +41,11 @@
static llvm::Constant *getFreeExceptionFn(CodeGenFunction &CGF) {
// void __cxa_free_exception(void *thrown_exception);
- const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGF.getLLVMContext());
+ llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGF.getLLVMContext());
+ llvm::Type *ArgTys[] = { Int8PtrTy };
const llvm::FunctionType *FTy =
llvm::FunctionType::get(llvm::Type::getVoidTy(CGF.getLLVMContext()),
- Int8PtrTy, /*IsVarArgs=*/false);
+ ArgTys, /*IsVarArgs=*/false);
return CGF.CGM.CreateRuntimeFunction(FTy, "__cxa_free_exception");
}
@@ -52,8 +54,8 @@
// void __cxa_throw(void *thrown_exception, std::type_info *tinfo,
// void (*dest) (void *));
- const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGF.getLLVMContext());
- const llvm::Type *Args[3] = { Int8PtrTy, Int8PtrTy, Int8PtrTy };
+ llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGF.getLLVMContext());
+ llvm::Type *Args[3] = { Int8PtrTy, Int8PtrTy, Int8PtrTy };
const llvm::FunctionType *FTy =
llvm::FunctionType::get(llvm::Type::getVoidTy(CGF.getLLVMContext()),
Args, /*IsVarArgs=*/false);
@@ -74,9 +76,10 @@
static llvm::Constant *getGetExceptionPtrFn(CodeGenFunction &CGF) {
// void *__cxa_get_exception_ptr(void*);
- const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGF.getLLVMContext());
+ llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGF.getLLVMContext());
+ llvm::Type *ArgTys[] = { Int8PtrTy };
const llvm::FunctionType *FTy =
- llvm::FunctionType::get(Int8PtrTy, Int8PtrTy, /*IsVarArgs=*/false);
+ llvm::FunctionType::get(Int8PtrTy, ArgTys, /*IsVarArgs=*/false);
return CGF.CGM.CreateRuntimeFunction(FTy, "__cxa_get_exception_ptr");
}
@@ -84,9 +87,10 @@
static llvm::Constant *getBeginCatchFn(CodeGenFunction &CGF) {
// void *__cxa_begin_catch(void*);
- const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGF.getLLVMContext());
+ llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGF.getLLVMContext());
+ llvm::Type *ArgTys[] = { Int8PtrTy };
const llvm::FunctionType *FTy =
- llvm::FunctionType::get(Int8PtrTy, Int8PtrTy, /*IsVarArgs=*/false);
+ llvm::FunctionType::get(Int8PtrTy, ArgTys, /*IsVarArgs=*/false);
return CGF.CGM.CreateRuntimeFunction(FTy, "__cxa_begin_catch");
}
@@ -104,17 +108,19 @@
static llvm::Constant *getUnexpectedFn(CodeGenFunction &CGF) {
// void __cxa_call_unexepcted(void *thrown_exception);
- const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGF.getLLVMContext());
+ llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGF.getLLVMContext());
+ llvm::Type *ArgTys[] = { Int8PtrTy };
const llvm::FunctionType *FTy =
llvm::FunctionType::get(llvm::Type::getVoidTy(CGF.getLLVMContext()),
- Int8PtrTy, /*IsVarArgs=*/false);
+ ArgTys, /*IsVarArgs=*/false);
return CGF.CGM.CreateRuntimeFunction(FTy, "__cxa_call_unexpected");
}
llvm::Constant *CodeGenFunction::getUnwindResumeFn() {
+ llvm::Type *ArgTys[] = { Int8PtrTy };
const llvm::FunctionType *FTy =
- llvm::FunctionType::get(VoidTy, Int8PtrTy, /*IsVarArgs=*/false);
+ llvm::FunctionType::get(VoidTy, ArgTys, /*IsVarArgs=*/false);
if (CGM.getLangOptions().SjLjExceptions)
return CGM.CreateRuntimeFunction(FTy, "_Unwind_SjLj_Resume");
@@ -122,8 +128,9 @@
}
llvm::Constant *CodeGenFunction::getUnwindResumeOrRethrowFn() {
+ llvm::Type *ArgTys[] = { Int8PtrTy };
const llvm::FunctionType *FTy =
- llvm::FunctionType::get(VoidTy, Int8PtrTy, /*IsVarArgs=*/false);
+ llvm::FunctionType::get(VoidTy, ArgTys, /*IsVarArgs=*/false);
if (CGM.getLangOptions().SjLjExceptions)
return CGM.CreateRuntimeFunction(FTy, "_Unwind_SjLj_Resume_or_Rethrow");
@@ -152,10 +159,11 @@
static llvm::Constant *getCatchallRethrowFn(CodeGenFunction &CGF,
llvm::StringRef Name) {
- const llvm::Type *Int8PtrTy =
+ llvm::Type *Int8PtrTy =
llvm::Type::getInt8PtrTy(CGF.getLLVMContext());
const llvm::Type *VoidTy = llvm::Type::getVoidTy(CGF.getLLVMContext());
- const llvm::FunctionType *FTy = llvm::FunctionType::get(VoidTy, Int8PtrTy,
+ llvm::Type *ArgTys[] = { Int8PtrTy };
+ const llvm::FunctionType *FTy = llvm::FunctionType::get(VoidTy, ArgTys,
/*IsVarArgs=*/false);
return CGF.CGM.CreateRuntimeFunction(FTy, Name);
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CGExpr.cpp?rev=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGExpr.cpp Fri Jul 8 03:40:05 2011
@@ -505,7 +505,7 @@
// This needs to be to the standard address space.
Address = Builder.CreateBitCast(Address, Int8PtrTy);
- const llvm::Type *IntPtrT = IntPtrTy;
+ llvm::Type *IntPtrT = IntPtrTy;
llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::objectsize, &IntPtrT, 1);
// In time, people may want to control this and use a 1 here.
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CGExprCXX.cpp?rev=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGExprCXX.cpp Fri Jul 8 03:40:05 2011
@@ -619,7 +619,7 @@
// can be ignored because the result shouldn't be used if
// allocation fails.
if (typeSizeMultiplier != 1) {
- const llvm::Type *intrinsicTypes[] = { CGF.SizeTy };
+ llvm::Type *intrinsicTypes[] = { CGF.SizeTy };
llvm::Value *umul_with_overflow
= CGF.CGM.getIntrinsic(llvm::Intrinsic::umul_with_overflow,
intrinsicTypes, 1);
@@ -661,7 +661,7 @@
if (cookieSize != 0) {
sizeWithoutCookie = size;
- const llvm::Type *intrinsicTypes[] = { CGF.SizeTy };
+ llvm::Type *intrinsicTypes[] = { CGF.SizeTy };
llvm::Value *uadd_with_overflow
= CGF.CGM.getIntrinsic(llvm::Intrinsic::uadd_with_overflow,
intrinsicTypes, 1);
@@ -1569,11 +1569,11 @@
// const abi::__class_type_info *dst,
// std::ptrdiff_t src2dst_offset);
- const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGF.getLLVMContext());
- const llvm::Type *PtrDiffTy =
+ llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGF.getLLVMContext());
+ llvm::Type *PtrDiffTy =
CGF.ConvertType(CGF.getContext().getPointerDiffType());
- const llvm::Type *Args[4] = { Int8PtrTy, Int8PtrTy, Int8PtrTy, PtrDiffTy };
+ llvm::Type *Args[4] = { Int8PtrTy, Int8PtrTy, Int8PtrTy, PtrDiffTy };
const llvm::FunctionType *FTy =
llvm::FunctionType::get(Int8PtrTy, Args, false);
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CGExprScalar.cpp?rev=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGExprScalar.cpp Fri Jul 8 03:40:05 2011
@@ -1772,7 +1772,7 @@
OpID <<= 1;
OpID |= 1;
- const llvm::Type *opTy = CGF.CGM.getTypes().ConvertType(Ops.Ty);
+ llvm::Type *opTy = CGF.CGM.getTypes().ConvertType(Ops.Ty);
llvm::Function *intrinsic = CGF.CGM.getIntrinsic(IID, &opTy, 1);
@@ -1803,8 +1803,8 @@
Builder.SetInsertPoint(overflowBB);
// Get the overflow handler.
- const llvm::Type *Int8Ty = llvm::Type::getInt8Ty(VMContext);
- const llvm::Type *argTypes[] = { CGF.Int64Ty, CGF.Int64Ty, Int8Ty, Int8Ty };
+ llvm::Type *Int8Ty = llvm::Type::getInt8Ty(VMContext);
+ llvm::Type *argTypes[] = { CGF.Int64Ty, CGF.Int64Ty, Int8Ty, Int8Ty };
llvm::FunctionType *handlerTy =
llvm::FunctionType::get(CGF.Int64Ty, argTypes, true);
llvm::Value *handler = CGF.CGM.CreateRuntimeFunction(handlerTy, *handlerName);
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=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGObjC.cpp Fri Jul 8 03:40:05 2011
@@ -1328,7 +1328,7 @@
if (isa<llvm::ConstantPointerNull>(value)) return value;
if (!fn) {
- std::vector<const llvm::Type*> args(1, CGF.Int8PtrTy);
+ std::vector<llvm::Type*> args(1, CGF.Int8PtrTy);
const llvm::FunctionType *fnType =
llvm::FunctionType::get(CGF.Int8PtrTy, args, false);
fn = createARCRuntimeFunction(CGF.CGM, fnType, fnName);
@@ -1353,7 +1353,7 @@
llvm::Constant *&fn,
llvm::StringRef fnName) {
if (!fn) {
- std::vector<const llvm::Type*> args(1, CGF.Int8PtrPtrTy);
+ std::vector<llvm::Type*> args(1, CGF.Int8PtrPtrTy);
const llvm::FunctionType *fnType =
llvm::FunctionType::get(CGF.Int8PtrTy, args, false);
fn = createARCRuntimeFunction(CGF.CGM, fnType, fnName);
@@ -1388,7 +1388,7 @@
== value->getType());
if (!fn) {
- std::vector<const llvm::Type*> argTypes(2);
+ std::vector<llvm::Type*> argTypes(2);
argTypes[0] = CGF.Int8PtrPtrTy;
argTypes[1] = CGF.Int8PtrTy;
@@ -1420,7 +1420,7 @@
assert(dst->getType() == src->getType());
if (!fn) {
- std::vector<const llvm::Type*> argTypes(2, CGF.Int8PtrPtrTy);
+ std::vector<llvm::Type*> argTypes(2, CGF.Int8PtrPtrTy);
const llvm::FunctionType *fnType
= llvm::FunctionType::get(CGF.Builder.getVoidTy(), argTypes, false);
fn = createARCRuntimeFunction(CGF.CGM, fnType, fnName);
@@ -1518,7 +1518,7 @@
llvm::Constant *&fn = CGM.getARCEntrypoints().objc_release;
if (!fn) {
- std::vector<const llvm::Type*> args(1, Int8PtrTy);
+ std::vector<llvm::Type*> args(1, Int8PtrTy);
const llvm::FunctionType *fnType =
llvm::FunctionType::get(Builder.getVoidTy(), args, false);
fn = createARCRuntimeFunction(CGM, fnType, "objc_release");
@@ -1548,7 +1548,7 @@
llvm::Constant *&fn = CGM.getARCEntrypoints().objc_storeStrong;
if (!fn) {
- const llvm::Type *argTypes[] = { Int8PtrPtrTy, Int8PtrTy };
+ llvm::Type *argTypes[] = { Int8PtrPtrTy, Int8PtrTy };
const llvm::FunctionType *fnType
= llvm::FunctionType::get(Builder.getVoidTy(), argTypes, false);
fn = createARCRuntimeFunction(CGM, fnType, "objc_storeStrong");
@@ -1702,7 +1702,7 @@
void CodeGenFunction::EmitARCDestroyWeak(llvm::Value *addr) {
llvm::Constant *&fn = CGM.getARCEntrypoints().objc_destroyWeak;
if (!fn) {
- std::vector<const llvm::Type*> args(1, Int8PtrPtrTy);
+ std::vector<llvm::Type*> args(1, Int8PtrPtrTy);
const llvm::FunctionType *fnType =
llvm::FunctionType::get(Builder.getVoidTy(), args, false);
fn = createARCRuntimeFunction(CGM, fnType, "objc_destroyWeak");
@@ -1756,7 +1756,7 @@
llvm::Constant *&fn = CGM.getRREntrypoints().objc_autoreleasePoolPop;
if (!fn) {
- std::vector<const llvm::Type*> args(1, Int8PtrTy);
+ std::vector<llvm::Type*> args(1, Int8PtrTy);
const llvm::FunctionType *fnType =
llvm::FunctionType::get(Builder.getVoidTy(), args, false);
@@ -2487,7 +2487,7 @@
/// make sure it survives garbage collection until this point.
void CodeGenFunction::EmitExtendGCLifetime(llvm::Value *object) {
// We just use an inline assembly.
- const llvm::Type *paramTypes[] = { VoidPtrTy };
+ llvm::Type *paramTypes[] = { VoidPtrTy };
llvm::FunctionType *extenderType
= llvm::FunctionType::get(VoidTy, paramTypes, /*variadic*/ false);
llvm::Value *extender
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CGObjCGNU.cpp?rev=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGObjCGNU.cpp Fri Jul 8 03:40:05 2011
@@ -50,7 +50,7 @@
/// avoids constructing the type more than once if it's used more than once.
class LazyRuntimeFunction {
CodeGenModule *CGM;
- std::vector<const llvm::Type*> ArgTys;
+ std::vector<llvm::Type*> ArgTys;
const char *FunctionName;
llvm::Constant *Function;
public:
@@ -63,14 +63,14 @@
/// of the arguments.
END_WITH_NULL
void init(CodeGenModule *Mod, const char *name,
- const llvm::Type *RetTy, ...) {
+ llvm::Type *RetTy, ...) {
CGM =Mod;
FunctionName = name;
Function = 0;
ArgTys.clear();
va_list Args;
va_start(Args, RetTy);
- while (const llvm::Type *ArgTy = va_arg(Args, const llvm::Type*))
+ while (llvm::Type *ArgTy = va_arg(Args, llvm::Type*))
ArgTys.push_back(ArgTy);
va_end(Args);
// Push the return type on at the end so we can pop it off easily
@@ -118,24 +118,24 @@
/// LLVM type for selectors. Opaque pointer (i8*) unless a header declaring
/// SEL is included in a header somewhere, in which case it will be whatever
/// type is declared in that header, most likely {i8*, i8*}.
- const llvm::PointerType *SelectorTy;
+ llvm::PointerType *SelectorTy;
/// LLVM i8 type. Cached here to avoid repeatedly getting it in all of the
/// places where it's used
const llvm::IntegerType *Int8Ty;
/// Pointer to i8 - LLVM type of char*, for all of the places where the
/// runtime needs to deal with C strings.
- const llvm::PointerType *PtrToInt8Ty;
+ llvm::PointerType *PtrToInt8Ty;
/// Instance Method Pointer type. This is a pointer to a function that takes,
/// at a minimum, an object and a selector, and is the generic type for
/// Objective-C methods. Due to differences between variadic / non-variadic
/// calling conventions, it must always be cast to the correct type before
/// actually being used.
- const llvm::PointerType *IMPTy;
+ llvm::PointerType *IMPTy;
/// Type of an untyped Objective-C object. Clang treats id as a built-in type
/// when compiling Objective-C code, so this may be an opaque pointer (i8*),
/// but if the runtime header declaring it is included then it may be a
/// pointer to a structure.
- const llvm::PointerType *IdTy;
+ llvm::PointerType *IdTy;
/// Pointer to a pointer to an Objective-C object. Used in the new ABI
/// message lookup function and some GC-related functions.
const llvm::PointerType *PtrToIdTy;
@@ -143,11 +143,11 @@
/// call Objective-C methods.
CanQualType ASTIdTy;
/// LLVM type for C int type.
- const llvm::IntegerType *IntTy;
+ llvm::IntegerType *IntTy;
/// LLVM type for an opaque pointer. This is identical to PtrToInt8Ty, but is
/// used in the code to document the difference between i8* meaning a pointer
/// to a C string and i8* meaning a pointer to some opaque type.
- const llvm::PointerType *PtrTy;
+ llvm::PointerType *PtrTy;
/// LLVM type for C long type. The runtime uses this in a lot of places where
/// it should be using intptr_t, but we can't fix this without breaking
/// compatibility with GCC...
@@ -619,7 +619,7 @@
PtrToObjCSuperTy, SelectorTy, NULL);
// If we're in ObjC++ mode, then we want to make
if (CGM.getLangOptions().CPlusPlus) {
- const llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext);
+ llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext);
// void *__cxa_begin_catch(void *e)
EnterCatchFn.init(&CGM, "__cxa_begin_catch", PtrTy, PtrTy, NULL);
// void __cxa_end_catch(void)
@@ -712,7 +712,7 @@
ObjCSuperTy = llvm::StructType::get(IdTy, IdTy, NULL);
PtrToObjCSuperTy = llvm::PointerType::getUnqual(ObjCSuperTy);
- const llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext);
+ llvm::Type *VoidTy = llvm::Type::getVoidTy(VMContext);
// void objc_exception_throw(id);
ExceptionThrowFn.init(&CGM, "objc_exception_throw", VoidTy, IdTy, NULL);
@@ -740,7 +740,7 @@
PtrDiffTy, BoolTy, BoolTy, NULL);
// IMP type
- const llvm::Type *IMPArgs[] = { IdTy, SelectorTy };
+ llvm::Type *IMPArgs[] = { IdTy, SelectorTy };
IMPTy = llvm::PointerType::getUnqual(llvm::FunctionType::get(IdTy, IMPArgs,
true));
@@ -794,8 +794,9 @@
EmitClassRef(Name);
ClassName = Builder.CreateStructGEP(ClassName, 0);
+ llvm::Type *ArgTys[] = { PtrToInt8Ty };
llvm::Constant *ClassLookupFn =
- CGM.CreateRuntimeFunction(llvm::FunctionType::get(IdTy, PtrToInt8Ty, true),
+ CGM.CreateRuntimeFunction(llvm::FunctionType::get(IdTy, ArgTys, true),
"objc_lookup_class");
return Builder.CreateCall(ClassLookupFn, ClassName);
}
@@ -999,11 +1000,13 @@
if (isCategoryImpl) {
llvm::Constant *classLookupFunction = 0;
if (IsClassMessage) {
+ llvm::Type *ArgTys[] = { PtrTy };
classLookupFunction = CGM.CreateRuntimeFunction(llvm::FunctionType::get(
- IdTy, PtrTy, true), "objc_get_meta_class");
+ IdTy, ArgTys, true), "objc_get_meta_class");
} else {
+ llvm::Type *ArgTys[] = { PtrTy };
classLookupFunction = CGM.CreateRuntimeFunction(llvm::FunctionType::get(
- IdTy, PtrTy, true), "objc_get_class");
+ IdTy, ArgTys, true), "objc_get_class");
}
ReceiverClass = Builder.CreateCall(classLookupFunction,
MakeConstantString(Class->getNameAsString()));
@@ -1237,18 +1240,14 @@
Methods);
// Structure containing list pointer, array and array count
- llvm::SmallVector<const llvm::Type*, 16> ObjCMethodListFields;
- llvm::PATypeHolder OpaqueNextTy = llvm::OpaqueType::get(VMContext);
- llvm::Type *NextPtrTy = llvm::PointerType::getUnqual(OpaqueNextTy);
- llvm::StructType *ObjCMethodListTy = llvm::StructType::get(
+ llvm::StructType *ObjCMethodListTy =
+ llvm::StructType::createNamed(VMContext, "");
+ llvm::Type *NextPtrTy = llvm::PointerType::getUnqual(ObjCMethodListTy);
+ ObjCMethodListTy->setBody(
NextPtrTy,
IntTy,
ObjCMethodArrayTy,
NULL);
- // Refine next pointer type to concrete type
- llvm::cast<llvm::OpaqueType>(
- OpaqueNextTy.get())->refineAbstractTypeTo(ObjCMethodListTy);
- ObjCMethodListTy = llvm::cast<llvm::StructType>(OpaqueNextTy.get());
Methods.clear();
Methods.push_back(llvm::ConstantPointerNull::get(
@@ -2043,11 +2042,6 @@
SelStructPtrTy = llvm::PointerType::getUnqual(SelStructTy);
}
- // Name the ObjC types to make the IR a bit easier to read
- TheModule.addTypeName(".objc_selector", SelStructPtrTy);
- TheModule.addTypeName(".objc_id", IdTy);
- TheModule.addTypeName(".objc_imp", IMPTy);
-
std::vector<llvm::Constant*> Elements;
llvm::Constant *Statics = NULLPtr;
// Generate statics list:
@@ -2212,9 +2206,9 @@
CGBuilderTy Builder(VMContext);
Builder.SetInsertPoint(EntryBB);
+ llvm::Type *ArgTys[] = { llvm::PointerType::getUnqual(ModuleTy) };
llvm::FunctionType *FT =
- llvm::FunctionType::get(Builder.getVoidTy(),
- llvm::PointerType::getUnqual(ModuleTy), true);
+ llvm::FunctionType::get(Builder.getVoidTy(), ArgTys, true);
llvm::Value *Register = CGM.CreateRuntimeFunction(FT, "__objc_exec_class");
Builder.CreateCall(Register, Module);
Builder.CreateRetVoid();
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CGObjCMac.cpp?rev=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGObjCMac.cpp Fri Jul 8 03:40:05 2011
@@ -65,7 +65,7 @@
llvm::Constant *getMessageSendFn() const {
// Add the non-lazy-bind attribute, since objc_msgSend is likely to
// be called a lot.
- const llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
+ llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
params, true),
"objc_msgSend",
@@ -78,7 +78,7 @@
/// by indirect reference in the first argument, and therefore the
/// self and selector parameters are shifted over by one.
llvm::Constant *getMessageSendStretFn() const {
- const llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
+ llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
return CGM.CreateRuntimeFunction(llvm::FunctionType::get(CGM.VoidTy,
params, true),
"objc_msgSend_stret");
@@ -91,7 +91,7 @@
/// floating-point stack; without a special entrypoint, the nil case
/// would be unbalanced.
llvm::Constant *getMessageSendFpretFn() const {
- const llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
+ llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
return CGM.CreateRuntimeFunction(llvm::FunctionType::get(
llvm::Type::getDoubleTy(VMContext),
params, true),
@@ -105,7 +105,7 @@
/// semantics. The class passed is the superclass of the current
/// class.
llvm::Constant *getMessageSendSuperFn() const {
- const llvm::Type *params[] = { SuperPtrTy, SelectorPtrTy };
+ llvm::Type *params[] = { SuperPtrTy, SelectorPtrTy };
return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
params, true),
"objc_msgSendSuper");
@@ -116,7 +116,7 @@
/// A slightly different messenger used for super calls. The class
/// passed is the current class.
llvm::Constant *getMessageSendSuperFn2() const {
- const llvm::Type *params[] = { SuperPtrTy, SelectorPtrTy };
+ llvm::Type *params[] = { SuperPtrTy, SelectorPtrTy };
return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
params, true),
"objc_msgSendSuper2");
@@ -127,7 +127,7 @@
///
/// The messenger used for super calls which return an aggregate indirectly.
llvm::Constant *getMessageSendSuperStretFn() const {
- const llvm::Type *params[] = { Int8PtrTy, SuperPtrTy, SelectorPtrTy };
+ llvm::Type *params[] = { Int8PtrTy, SuperPtrTy, SelectorPtrTy };
return CGM.CreateRuntimeFunction(
llvm::FunctionType::get(CGM.VoidTy, params, true),
"objc_msgSendSuper_stret");
@@ -138,7 +138,7 @@
///
/// objc_msgSendSuper_stret with the super2 semantics.
llvm::Constant *getMessageSendSuperStretFn2() const {
- const llvm::Type *params[] = { Int8PtrTy, SuperPtrTy, SelectorPtrTy };
+ llvm::Type *params[] = { Int8PtrTy, SuperPtrTy, SelectorPtrTy };
return CGM.CreateRuntimeFunction(
llvm::FunctionType::get(CGM.VoidTy, params, true),
"objc_msgSendSuper2_stret");
@@ -158,20 +158,20 @@
CodeGen::CodeGenModule &CGM;
public:
- const llvm::Type *ShortTy, *IntTy, *LongTy, *LongLongTy;
- const llvm::Type *Int8PtrTy;
+ llvm::Type *ShortTy, *IntTy, *LongTy, *LongLongTy;
+ llvm::Type *Int8PtrTy;
/// ObjectPtrTy - LLVM type for object handles (typeof(id))
- const llvm::Type *ObjectPtrTy;
+ llvm::Type *ObjectPtrTy;
/// PtrObjectPtrTy - LLVM type for id *
- const llvm::Type *PtrObjectPtrTy;
+ llvm::Type *PtrObjectPtrTy;
/// SelectorPtrTy - LLVM type for selector handles (typeof(SEL))
- const llvm::Type *SelectorPtrTy;
+ llvm::Type *SelectorPtrTy;
/// ProtocolPtrTy - LLVM type for external protocol handles
/// (typeof(Protocol))
- const llvm::Type *ExternalProtocolPtrTy;
+ llvm::Type *ExternalProtocolPtrTy;
// SuperCTy - clang type for struct objc_super.
QualType SuperCTy;
@@ -179,27 +179,27 @@
QualType SuperPtrCTy;
/// SuperTy - LLVM type for struct objc_super.
- const llvm::StructType *SuperTy;
+ llvm::StructType *SuperTy;
/// SuperPtrTy - LLVM type for struct objc_super *.
- const llvm::Type *SuperPtrTy;
+ llvm::Type *SuperPtrTy;
/// PropertyTy - LLVM type for struct objc_property (struct _prop_t
/// in GCC parlance).
- const llvm::StructType *PropertyTy;
+ llvm::StructType *PropertyTy;
/// PropertyListTy - LLVM type for struct objc_property_list
/// (_prop_list_t in GCC parlance).
- const llvm::StructType *PropertyListTy;
+ llvm::StructType *PropertyListTy;
/// PropertyListPtrTy - LLVM type for struct objc_property_list*.
- const llvm::Type *PropertyListPtrTy;
+ llvm::Type *PropertyListPtrTy;
// MethodTy - LLVM type for struct objc_method.
- const llvm::StructType *MethodTy;
+ llvm::StructType *MethodTy;
/// CacheTy - LLVM type for struct objc_cache.
- const llvm::Type *CacheTy;
+ llvm::Type *CacheTy;
/// CachePtrTy - LLVM type for struct objc_cache *.
- const llvm::Type *CachePtrTy;
+ llvm::Type *CachePtrTy;
llvm::Constant *getGetPropertyFn() {
CodeGen::CodeGenTypes &Types = CGM.getTypes();
@@ -273,7 +273,7 @@
/// GcReadWeakFn -- LLVM objc_read_weak (id *src) function.
llvm::Constant *getGcReadWeakFn() {
// id objc_read_weak (id *)
- const llvm::Type *args[] = { ObjectPtrTy->getPointerTo() };
+ llvm::Type *args[] = { ObjectPtrTy->getPointerTo() };
llvm::FunctionType *FTy =
llvm::FunctionType::get(ObjectPtrTy, args, false);
return CGM.CreateRuntimeFunction(FTy, "objc_read_weak");
@@ -282,7 +282,7 @@
/// GcAssignWeakFn -- LLVM objc_assign_weak function.
llvm::Constant *getGcAssignWeakFn() {
// id objc_assign_weak (id, id *)
- const llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() };
+ llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() };
llvm::FunctionType *FTy =
llvm::FunctionType::get(ObjectPtrTy, args, false);
return CGM.CreateRuntimeFunction(FTy, "objc_assign_weak");
@@ -291,7 +291,7 @@
/// GcAssignGlobalFn -- LLVM objc_assign_global function.
llvm::Constant *getGcAssignGlobalFn() {
// id objc_assign_global(id, id *)
- const llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() };
+ llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() };
llvm::FunctionType *FTy =
llvm::FunctionType::get(ObjectPtrTy, args, false);
return CGM.CreateRuntimeFunction(FTy, "objc_assign_global");
@@ -300,7 +300,7 @@
/// GcAssignThreadLocalFn -- LLVM objc_assign_threadlocal function.
llvm::Constant *getGcAssignThreadLocalFn() {
// id objc_assign_threadlocal(id src, id * dest)
- const llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() };
+ llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() };
llvm::FunctionType *FTy =
llvm::FunctionType::get(ObjectPtrTy, args, false);
return CGM.CreateRuntimeFunction(FTy, "objc_assign_threadlocal");
@@ -309,8 +309,8 @@
/// GcAssignIvarFn -- LLVM objc_assign_ivar function.
llvm::Constant *getGcAssignIvarFn() {
// id objc_assign_ivar(id, id *, ptrdiff_t)
- const llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo(),
- CGM.PtrDiffTy };
+ llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo(),
+ CGM.PtrDiffTy };
llvm::FunctionType *FTy =
llvm::FunctionType::get(ObjectPtrTy, args, false);
return CGM.CreateRuntimeFunction(FTy, "objc_assign_ivar");
@@ -319,7 +319,7 @@
/// GcMemmoveCollectableFn -- LLVM objc_memmove_collectable function.
llvm::Constant *GcMemmoveCollectableFn() {
// void *objc_memmove_collectable(void *dst, const void *src, size_t size)
- const llvm::Type *args[] = { Int8PtrTy, Int8PtrTy, LongTy };
+ llvm::Type *args[] = { Int8PtrTy, Int8PtrTy, LongTy };
llvm::FunctionType *FTy = llvm::FunctionType::get(Int8PtrTy, args, false);
return CGM.CreateRuntimeFunction(FTy, "objc_memmove_collectable");
}
@@ -327,7 +327,7 @@
/// GcAssignStrongCastFn -- LLVM objc_assign_strongCast function.
llvm::Constant *getGcAssignStrongCastFn() {
// id objc_assign_strongCast(id, id *)
- const llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() };
+ llvm::Type *args[] = { ObjectPtrTy, ObjectPtrTy->getPointerTo() };
llvm::FunctionType *FTy =
llvm::FunctionType::get(ObjectPtrTy, args, false);
return CGM.CreateRuntimeFunction(FTy, "objc_assign_strongCast");
@@ -336,7 +336,7 @@
/// ExceptionThrowFn - LLVM objc_exception_throw function.
llvm::Constant *getExceptionThrowFn() {
// void objc_exception_throw(id)
- const llvm::Type *args[] = { ObjectPtrTy };
+ llvm::Type *args[] = { ObjectPtrTy };
llvm::FunctionType *FTy =
llvm::FunctionType::get(CGM.VoidTy, args, false);
return CGM.CreateRuntimeFunction(FTy, "objc_exception_throw");
@@ -352,7 +352,7 @@
/// SyncEnterFn - LLVM object_sync_enter function.
llvm::Constant *getSyncEnterFn() {
// void objc_sync_enter (id)
- const llvm::Type *args[] = { ObjectPtrTy };
+ llvm::Type *args[] = { ObjectPtrTy };
llvm::FunctionType *FTy =
llvm::FunctionType::get(CGM.VoidTy, args, false);
return CGM.CreateRuntimeFunction(FTy, "objc_sync_enter");
@@ -361,7 +361,7 @@
/// SyncExitFn - LLVM object_sync_exit function.
llvm::Constant *getSyncExitFn() {
// void objc_sync_exit (id)
- const llvm::Type *args[] = { ObjectPtrTy };
+ llvm::Type *args[] = { ObjectPtrTy };
llvm::FunctionType *FTy =
llvm::FunctionType::get(CGM.VoidTy, args, false);
return CGM.CreateRuntimeFunction(FTy, "objc_sync_exit");
@@ -400,62 +400,62 @@
class ObjCTypesHelper : public ObjCCommonTypesHelper {
public:
/// SymtabTy - LLVM type for struct objc_symtab.
- const llvm::StructType *SymtabTy;
+ llvm::StructType *SymtabTy;
/// SymtabPtrTy - LLVM type for struct objc_symtab *.
- const llvm::Type *SymtabPtrTy;
+ llvm::Type *SymtabPtrTy;
/// ModuleTy - LLVM type for struct objc_module.
- const llvm::StructType *ModuleTy;
+ llvm::StructType *ModuleTy;
/// ProtocolTy - LLVM type for struct objc_protocol.
- const llvm::StructType *ProtocolTy;
+ llvm::StructType *ProtocolTy;
/// ProtocolPtrTy - LLVM type for struct objc_protocol *.
- const llvm::Type *ProtocolPtrTy;
+ llvm::Type *ProtocolPtrTy;
/// ProtocolExtensionTy - LLVM type for struct
/// objc_protocol_extension.
- const llvm::StructType *ProtocolExtensionTy;
+ llvm::StructType *ProtocolExtensionTy;
/// ProtocolExtensionTy - LLVM type for struct
/// objc_protocol_extension *.
- const llvm::Type *ProtocolExtensionPtrTy;
+ llvm::Type *ProtocolExtensionPtrTy;
/// MethodDescriptionTy - LLVM type for struct
/// objc_method_description.
- const llvm::StructType *MethodDescriptionTy;
+ llvm::StructType *MethodDescriptionTy;
/// MethodDescriptionListTy - LLVM type for struct
/// objc_method_description_list.
- const llvm::StructType *MethodDescriptionListTy;
+ llvm::StructType *MethodDescriptionListTy;
/// MethodDescriptionListPtrTy - LLVM type for struct
/// objc_method_description_list *.
- const llvm::Type *MethodDescriptionListPtrTy;
+ llvm::Type *MethodDescriptionListPtrTy;
/// ProtocolListTy - LLVM type for struct objc_property_list.
- const llvm::Type *ProtocolListTy;
+ llvm::StructType *ProtocolListTy;
/// ProtocolListPtrTy - LLVM type for struct objc_property_list*.
- const llvm::Type *ProtocolListPtrTy;
+ llvm::Type *ProtocolListPtrTy;
/// CategoryTy - LLVM type for struct objc_category.
- const llvm::StructType *CategoryTy;
+ llvm::StructType *CategoryTy;
/// ClassTy - LLVM type for struct objc_class.
- const llvm::StructType *ClassTy;
+ llvm::StructType *ClassTy;
/// ClassPtrTy - LLVM type for struct objc_class *.
- const llvm::Type *ClassPtrTy;
+ llvm::Type *ClassPtrTy;
/// ClassExtensionTy - LLVM type for struct objc_class_ext.
- const llvm::StructType *ClassExtensionTy;
+ llvm::StructType *ClassExtensionTy;
/// ClassExtensionPtrTy - LLVM type for struct objc_class_ext *.
- const llvm::Type *ClassExtensionPtrTy;
+ llvm::Type *ClassExtensionPtrTy;
// IvarTy - LLVM type for struct objc_ivar.
- const llvm::StructType *IvarTy;
+ llvm::StructType *IvarTy;
/// IvarListTy - LLVM type for struct objc_ivar_list.
- const llvm::Type *IvarListTy;
+ llvm::Type *IvarListTy;
/// IvarListPtrTy - LLVM type for struct objc_ivar_list *.
- const llvm::Type *IvarListPtrTy;
+ llvm::Type *IvarListPtrTy;
/// MethodListTy - LLVM type for struct objc_method_list.
- const llvm::Type *MethodListTy;
+ llvm::Type *MethodListTy;
/// MethodListPtrTy - LLVM type for struct objc_method_list *.
- const llvm::Type *MethodListPtrTy;
+ llvm::Type *MethodListPtrTy;
/// ExceptionDataTy - LLVM type for struct _objc_exception_data.
- const llvm::Type *ExceptionDataTy;
+ llvm::Type *ExceptionDataTy;
/// ExceptionTryEnterFn - LLVM objc_exception_try_enter function.
llvm::Constant *getExceptionTryEnterFn() {
- const llvm::Type *params[] = { ExceptionDataTy->getPointerTo() };
+ llvm::Type *params[] = { ExceptionDataTy->getPointerTo() };
return CGM.CreateRuntimeFunction(
llvm::FunctionType::get(CGM.VoidTy, params, false),
"objc_exception_try_enter");
@@ -463,7 +463,7 @@
/// ExceptionTryExitFn - LLVM objc_exception_try_exit function.
llvm::Constant *getExceptionTryExitFn() {
- const llvm::Type *params[] = { ExceptionDataTy->getPointerTo() };
+ llvm::Type *params[] = { ExceptionDataTy->getPointerTo() };
return CGM.CreateRuntimeFunction(
llvm::FunctionType::get(CGM.VoidTy, params, false),
"objc_exception_try_exit");
@@ -471,7 +471,7 @@
/// ExceptionExtractFn - LLVM objc_exception_extract function.
llvm::Constant *getExceptionExtractFn() {
- const llvm::Type *params[] = { ExceptionDataTy->getPointerTo() };
+ llvm::Type *params[] = { ExceptionDataTy->getPointerTo() };
return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
params, false),
"objc_exception_extract");
@@ -479,7 +479,7 @@
/// ExceptionMatchFn - LLVM objc_exception_match function.
llvm::Constant *getExceptionMatchFn() {
- const llvm::Type *params[] = { ClassPtrTy, ObjectPtrTy };
+ llvm::Type *params[] = { ClassPtrTy, ObjectPtrTy };
return CGM.CreateRuntimeFunction(
llvm::FunctionType::get(CGM.Int32Ty, params, false),
"objc_exception_match");
@@ -489,7 +489,7 @@
/// SetJmpFn - LLVM _setjmp function.
llvm::Constant *getSetJmpFn() {
// This is specifically the prototype for x86.
- const llvm::Type *params[] = { CGM.Int32Ty->getPointerTo() };
+ llvm::Type *params[] = { CGM.Int32Ty->getPointerTo() };
return CGM.CreateRuntimeFunction(llvm::FunctionType::get(CGM.Int32Ty,
params, false),
"_setjmp");
@@ -506,46 +506,46 @@
public:
// MethodListnfABITy - LLVM for struct _method_list_t
- const llvm::StructType *MethodListnfABITy;
+ llvm::StructType *MethodListnfABITy;
// MethodListnfABIPtrTy - LLVM for struct _method_list_t*
- const llvm::Type *MethodListnfABIPtrTy;
+ llvm::Type *MethodListnfABIPtrTy;
// ProtocolnfABITy = LLVM for struct _protocol_t
- const llvm::StructType *ProtocolnfABITy;
+ llvm::StructType *ProtocolnfABITy;
// ProtocolnfABIPtrTy = LLVM for struct _protocol_t*
- const llvm::Type *ProtocolnfABIPtrTy;
+ llvm::Type *ProtocolnfABIPtrTy;
// ProtocolListnfABITy - LLVM for struct _objc_protocol_list
- const llvm::StructType *ProtocolListnfABITy;
+ llvm::StructType *ProtocolListnfABITy;
// ProtocolListnfABIPtrTy - LLVM for struct _objc_protocol_list*
- const llvm::Type *ProtocolListnfABIPtrTy;
+ llvm::Type *ProtocolListnfABIPtrTy;
// ClassnfABITy - LLVM for struct _class_t
- const llvm::StructType *ClassnfABITy;
+ llvm::StructType *ClassnfABITy;
// ClassnfABIPtrTy - LLVM for struct _class_t*
- const llvm::Type *ClassnfABIPtrTy;
+ llvm::Type *ClassnfABIPtrTy;
// IvarnfABITy - LLVM for struct _ivar_t
- const llvm::StructType *IvarnfABITy;
+ llvm::StructType *IvarnfABITy;
// IvarListnfABITy - LLVM for struct _ivar_list_t
- const llvm::StructType *IvarListnfABITy;
+ llvm::StructType *IvarListnfABITy;
// IvarListnfABIPtrTy = LLVM for struct _ivar_list_t*
- const llvm::Type *IvarListnfABIPtrTy;
+ llvm::Type *IvarListnfABIPtrTy;
// ClassRonfABITy - LLVM for struct _class_ro_t
- const llvm::StructType *ClassRonfABITy;
+ llvm::StructType *ClassRonfABITy;
// ImpnfABITy - LLVM for id (*)(id, SEL, ...)
- const llvm::Type *ImpnfABITy;
+ llvm::Type *ImpnfABITy;
// CategorynfABITy - LLVM for struct _category_t
- const llvm::StructType *CategorynfABITy;
+ llvm::StructType *CategorynfABITy;
// New types for nonfragile abi messaging.
@@ -554,31 +554,31 @@
// IMP messenger;
// SEL name;
// };
- const llvm::StructType *MessageRefTy;
+ llvm::StructType *MessageRefTy;
// MessageRefCTy - clang type for struct _message_ref_t
QualType MessageRefCTy;
// MessageRefPtrTy - LLVM for struct _message_ref_t*
- const llvm::Type *MessageRefPtrTy;
+ llvm::Type *MessageRefPtrTy;
// MessageRefCPtrTy - clang type for struct _message_ref_t*
QualType MessageRefCPtrTy;
// MessengerTy - Type of the messenger (shown as IMP above)
- const llvm::FunctionType *MessengerTy;
+ llvm::FunctionType *MessengerTy;
// SuperMessageRefTy - LLVM for:
// struct _super_message_ref_t {
// SUPER_IMP messenger;
// SEL name;
// };
- const llvm::StructType *SuperMessageRefTy;
+ llvm::StructType *SuperMessageRefTy;
// SuperMessageRefPtrTy - LLVM for struct _super_message_ref_t*
- const llvm::Type *SuperMessageRefPtrTy;
+ llvm::Type *SuperMessageRefPtrTy;
llvm::Constant *getMessageSendFixupFn() {
// id objc_msgSend_fixup(id, struct message_ref_t*, ...)
- const llvm::Type *params[] = { ObjectPtrTy, MessageRefPtrTy };
+ llvm::Type *params[] = { ObjectPtrTy, MessageRefPtrTy };
return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
params, true),
"objc_msgSend_fixup");
@@ -586,7 +586,7 @@
llvm::Constant *getMessageSendFpretFixupFn() {
// id objc_msgSend_fpret_fixup(id, struct message_ref_t*, ...)
- const llvm::Type *params[] = { ObjectPtrTy, MessageRefPtrTy };
+ llvm::Type *params[] = { ObjectPtrTy, MessageRefPtrTy };
return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
params, true),
"objc_msgSend_fpret_fixup");
@@ -594,7 +594,7 @@
llvm::Constant *getMessageSendStretFixupFn() {
// id objc_msgSend_stret_fixup(id, struct message_ref_t*, ...)
- const llvm::Type *params[] = { ObjectPtrTy, MessageRefPtrTy };
+ llvm::Type *params[] = { ObjectPtrTy, MessageRefPtrTy };
return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
params, true),
"objc_msgSend_stret_fixup");
@@ -603,7 +603,7 @@
llvm::Constant *getMessageSendSuper2FixupFn() {
// id objc_msgSendSuper2_fixup (struct objc_super *,
// struct _super_message_ref_t*, ...)
- const llvm::Type *params[] = { SuperPtrTy, SuperMessageRefPtrTy };
+ llvm::Type *params[] = { SuperPtrTy, SuperMessageRefPtrTy };
return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
params, true),
"objc_msgSendSuper2_fixup");
@@ -612,7 +612,7 @@
llvm::Constant *getMessageSendSuper2StretFixupFn() {
// id objc_msgSendSuper2_stret_fixup(struct objc_super *,
// struct _super_message_ref_t*, ...)
- const llvm::Type *params[] = { SuperPtrTy, SuperMessageRefPtrTy };
+ llvm::Type *params[] = { SuperPtrTy, SuperMessageRefPtrTy };
return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
params, true),
"objc_msgSendSuper2_stret_fixup");
@@ -625,14 +625,14 @@
}
llvm::Constant *getObjCBeginCatchFn() {
- const llvm::Type *params[] = { Int8PtrTy };
+ llvm::Type *params[] = { Int8PtrTy };
return CGM.CreateRuntimeFunction(llvm::FunctionType::get(Int8PtrTy,
params, false),
"objc_begin_catch");
}
- const llvm::StructType *EHTypeTy;
- const llvm::Type *EHTypePtrTy;
+ llvm::StructType *EHTypeTy;
+ llvm::Type *EHTypePtrTy;
ObjCNonFragileABITypesHelper(CodeGen::CodeGenModule &cgm);
~ObjCNonFragileABITypesHelper(){}
@@ -2768,7 +2768,7 @@
}
llvm::FunctionType *FragileHazards::GetAsmFnType() {
- llvm::SmallVector<const llvm::Type *, 16> tys(Locals.size());
+ llvm::SmallVector<llvm::Type *, 16> tys(Locals.size());
for (unsigned i = 0, e = Locals.size(); i != e; ++i)
tys[i] = Locals[i]->getType();
return llvm::FunctionType::get(CGF.VoidTy, tys, false);
@@ -4162,20 +4162,19 @@
// char *name;
// char *attributes;
// }
- PropertyTy = llvm::StructType::get(Int8PtrTy, Int8PtrTy, NULL);
- CGM.getModule().addTypeName("struct._prop_t",
- PropertyTy);
+ PropertyTy = llvm::StructType::createNamed("struct._prop_t",
+ Int8PtrTy, Int8PtrTy, NULL);
// struct _prop_list_t {
// uint32_t entsize; // sizeof(struct _prop_t)
// uint32_t count_of_properties;
// struct _prop_t prop_list[count_of_properties];
// }
- PropertyListTy = llvm::StructType::get(IntTy, IntTy,
- llvm::ArrayType::get(PropertyTy, 0),
- NULL);
- CGM.getModule().addTypeName("struct._prop_list_t",
- PropertyListTy);
+ PropertyListTy =
+ llvm::StructType::createNamed("struct._prop_list_t",
+ IntTy, IntTy,
+ llvm::ArrayType::get(PropertyTy, 0),
+ NULL);
// struct _prop_list_t *
PropertyListPtrTy = llvm::PointerType::getUnqual(PropertyListTy);
@@ -4184,12 +4183,12 @@
// char *method_type;
// char *_imp;
// }
- MethodTy = llvm::StructType::get(SelectorPtrTy, Int8PtrTy, Int8PtrTy, NULL);
- CGM.getModule().addTypeName("struct._objc_method", MethodTy);
+ MethodTy = llvm::StructType::createNamed("struct._objc_method",
+ SelectorPtrTy, Int8PtrTy, Int8PtrTy,
+ NULL);
// struct _objc_cache *
- CacheTy = llvm::OpaqueType::get(VMContext);
- CGM.getModule().addTypeName("struct._objc_cache", CacheTy);
+ CacheTy = llvm::StructType::createNamed(VMContext, "struct._objc_cache");
CachePtrTy = llvm::PointerType::getUnqual(CacheTy);
}
@@ -4201,19 +4200,18 @@
// char *types;
// }
MethodDescriptionTy =
- llvm::StructType::get(SelectorPtrTy, Int8PtrTy, NULL);
- CGM.getModule().addTypeName("struct._objc_method_description",
- MethodDescriptionTy);
+ llvm::StructType::createNamed("struct._objc_method_description",
+ SelectorPtrTy, Int8PtrTy, NULL);
// struct _objc_method_description_list {
// int count;
// struct _objc_method_description[1];
// }
MethodDescriptionListTy =
- llvm::StructType::get(IntTy, llvm::ArrayType::get(MethodDescriptionTy, 0),
- NULL);
- CGM.getModule().addTypeName("struct._objc_method_description_list",
- MethodDescriptionListTy);
+ llvm::StructType::createNamed("struct._objc_method_description_list",
+ IntTy,
+ llvm::ArrayType::get(MethodDescriptionTy, 0),
+ NULL);
// struct _objc_method_description_list *
MethodDescriptionListPtrTy =
@@ -4228,28 +4226,27 @@
// struct _objc_property_list *instance_properties;
// }
ProtocolExtensionTy =
- llvm::StructType::get(IntTy,
- MethodDescriptionListPtrTy,
- MethodDescriptionListPtrTy,
- PropertyListPtrTy,
- NULL);
- CGM.getModule().addTypeName("struct._objc_protocol_extension",
- ProtocolExtensionTy);
+ llvm::StructType::createNamed("struct._objc_protocol_extension",
+ IntTy,
+ MethodDescriptionListPtrTy,
+ MethodDescriptionListPtrTy,
+ PropertyListPtrTy,
+ NULL);
// struct _objc_protocol_extension *
ProtocolExtensionPtrTy = llvm::PointerType::getUnqual(ProtocolExtensionTy);
// Handle recursive construction of Protocol and ProtocolList types
- llvm::PATypeHolder ProtocolTyHolder = llvm::OpaqueType::get(VMContext);
- llvm::PATypeHolder ProtocolListTyHolder = llvm::OpaqueType::get(VMContext);
+ ProtocolTy =
+ llvm::StructType::createNamed(VMContext, "struct._objc_protocol");
- const llvm::Type *T =
- llvm::StructType::get(llvm::PointerType::getUnqual(ProtocolListTyHolder),
+ ProtocolListTy =
+ llvm::StructType::createNamed(VMContext, "struct._objc_protocol_list");
+ ProtocolListTy->setBody(llvm::PointerType::getUnqual(ProtocolListTy),
LongTy,
- llvm::ArrayType::get(ProtocolTyHolder, 0),
+ llvm::ArrayType::get(ProtocolTy, 0),
NULL);
- cast<llvm::OpaqueType>(ProtocolListTyHolder.get())->refineAbstractTypeTo(T);
// struct _objc_protocol {
// struct _objc_protocol_extension *isa;
@@ -4258,21 +4255,15 @@
// struct _objc_method_description_list *instance_methods;
// struct _objc_method_description_list *class_methods;
// }
- T = llvm::StructType::get(ProtocolExtensionPtrTy, Int8PtrTy,
- llvm::PointerType::getUnqual(ProtocolListTyHolder),
- MethodDescriptionListPtrTy,
- MethodDescriptionListPtrTy,
- NULL);
- cast<llvm::OpaqueType>(ProtocolTyHolder.get())->refineAbstractTypeTo(T);
-
- ProtocolListTy = cast<llvm::StructType>(ProtocolListTyHolder.get());
- CGM.getModule().addTypeName("struct._objc_protocol_list",
- ProtocolListTy);
+ ProtocolTy->setBody(ProtocolExtensionPtrTy, Int8PtrTy,
+ llvm::PointerType::getUnqual(ProtocolListTy),
+ MethodDescriptionListPtrTy,
+ MethodDescriptionListPtrTy,
+ NULL);
+
// struct _objc_protocol_list *
ProtocolListPtrTy = llvm::PointerType::getUnqual(ProtocolListTy);
- ProtocolTy = cast<llvm::StructType>(ProtocolTyHolder.get());
- CGM.getModule().addTypeName("struct._objc_protocol", ProtocolTy);
ProtocolPtrTy = llvm::PointerType::getUnqual(ProtocolTy);
// Class description structures
@@ -4282,26 +4273,26 @@
// char *ivar_type;
// int ivar_offset;
// }
- IvarTy = llvm::StructType::get(Int8PtrTy, Int8PtrTy, IntTy, NULL);
- CGM.getModule().addTypeName("struct._objc_ivar", IvarTy);
+ IvarTy = llvm::StructType::createNamed("struct._objc_ivar",
+ Int8PtrTy, Int8PtrTy, IntTy, NULL);
// struct _objc_ivar_list *
- IvarListTy = llvm::OpaqueType::get(VMContext);
- CGM.getModule().addTypeName("struct._objc_ivar_list", IvarListTy);
+ IvarListTy =
+ llvm::StructType::createNamed(VMContext, "struct._objc_ivar_list");
IvarListPtrTy = llvm::PointerType::getUnqual(IvarListTy);
// struct _objc_method_list *
- MethodListTy = llvm::OpaqueType::get(VMContext);
- CGM.getModule().addTypeName("struct._objc_method_list", MethodListTy);
+ MethodListTy =
+ llvm::StructType::createNamed(VMContext, "struct._objc_method_list");
MethodListPtrTy = llvm::PointerType::getUnqual(MethodListTy);
// struct _objc_class_extension *
ClassExtensionTy =
- llvm::StructType::get(IntTy, Int8PtrTy, PropertyListPtrTy, NULL);
- CGM.getModule().addTypeName("struct._objc_class_extension", ClassExtensionTy);
+ llvm::StructType::createNamed("struct._objc_class_extension",
+ IntTy, Int8PtrTy, PropertyListPtrTy, NULL);
ClassExtensionPtrTy = llvm::PointerType::getUnqual(ClassExtensionTy);
- llvm::PATypeHolder ClassTyHolder = llvm::OpaqueType::get(VMContext);
+ ClassTy = llvm::StructType::createNamed(VMContext, "struct._objc_class");
// struct _objc_class {
// Class isa;
@@ -4317,23 +4308,20 @@
// char *ivar_layout;
// struct _objc_class_ext *ext;
// };
- T = llvm::StructType::get(llvm::PointerType::getUnqual(ClassTyHolder),
- llvm::PointerType::getUnqual(ClassTyHolder),
- Int8PtrTy,
- LongTy,
- LongTy,
- LongTy,
- IvarListPtrTy,
- MethodListPtrTy,
- CachePtrTy,
- ProtocolListPtrTy,
- Int8PtrTy,
- ClassExtensionPtrTy,
- NULL);
- cast<llvm::OpaqueType>(ClassTyHolder.get())->refineAbstractTypeTo(T);
+ ClassTy->setBody(llvm::PointerType::getUnqual(ClassTy),
+ llvm::PointerType::getUnqual(ClassTy),
+ Int8PtrTy,
+ LongTy,
+ LongTy,
+ LongTy,
+ IvarListPtrTy,
+ MethodListPtrTy,
+ CachePtrTy,
+ ProtocolListPtrTy,
+ Int8PtrTy,
+ ClassExtensionPtrTy,
+ NULL);
- ClassTy = cast<llvm::StructType>(ClassTyHolder.get());
- CGM.getModule().addTypeName("struct._objc_class", ClassTy);
ClassPtrTy = llvm::PointerType::getUnqual(ClassTy);
// struct _objc_category {
@@ -4344,10 +4332,11 @@
// uint32_t size; // sizeof(struct _objc_category)
// struct _objc_property_list *instance_properties;// category's @property
// }
- CategoryTy = llvm::StructType::get(Int8PtrTy, Int8PtrTy, MethodListPtrTy,
- MethodListPtrTy, ProtocolListPtrTy,
- IntTy, PropertyListPtrTy, NULL);
- CGM.getModule().addTypeName("struct._objc_category", CategoryTy);
+ CategoryTy =
+ llvm::StructType::createNamed("struct._objc_category",
+ Int8PtrTy, Int8PtrTy, MethodListPtrTy,
+ MethodListPtrTy, ProtocolListPtrTy,
+ IntTy, PropertyListPtrTy, NULL);
// Global metadata structures
@@ -4358,9 +4347,10 @@
// short cat_def_cnt;
// char *defs[cls_def_cnt + cat_def_cnt];
// }
- SymtabTy = llvm::StructType::get(LongTy, SelectorPtrTy, ShortTy, ShortTy,
- llvm::ArrayType::get(Int8PtrTy, 0), NULL);
- CGM.getModule().addTypeName("struct._objc_symtab", SymtabTy);
+ SymtabTy =
+ llvm::StructType::createNamed("struct._objc_symtab",
+ LongTy, SelectorPtrTy, ShortTy, ShortTy,
+ llvm::ArrayType::get(Int8PtrTy, 0), NULL);
SymtabPtrTy = llvm::PointerType::getUnqual(SymtabTy);
// struct _objc_module {
@@ -4370,8 +4360,8 @@
// struct _objc_symtab* symtab;
// }
ModuleTy =
- llvm::StructType::get(LongTy, LongTy, Int8PtrTy, SymtabPtrTy, NULL);
- CGM.getModule().addTypeName("struct._objc_module", ModuleTy);
+ llvm::StructType::createNamed("struct._objc_module",
+ LongTy, LongTy, Int8PtrTy, SymtabPtrTy, NULL);
// FIXME: This is the size of the setjmp buffer and should be target
@@ -4379,16 +4369,14 @@
uint64_t SetJmpBufferSize = 18;
// Exceptions
- const llvm::Type *StackPtrTy = llvm::ArrayType::get(
+ llvm::Type *StackPtrTy = llvm::ArrayType::get(
llvm::Type::getInt8PtrTy(VMContext), 4);
ExceptionDataTy =
- llvm::StructType::get(
- llvm::ArrayType::get(llvm::Type::getInt32Ty(VMContext),
- SetJmpBufferSize),
- StackPtrTy, NULL);
- CGM.getModule().addTypeName("struct._objc_exception_data",
- ExceptionDataTy);
+ llvm::StructType::createNamed("struct._objc_exception_data",
+ llvm::ArrayType::get(llvm::Type::getInt32Ty(VMContext),
+ SetJmpBufferSize),
+ StackPtrTy, NULL);
}
@@ -4399,11 +4387,11 @@
// uint32_t method_count;
// struct _objc_method method_list[method_count];
// }
- MethodListnfABITy = llvm::StructType::get(IntTy, IntTy,
- llvm::ArrayType::get(MethodTy, 0),
- NULL);
- CGM.getModule().addTypeName("struct.__method_list_t",
- MethodListnfABITy);
+ MethodListnfABITy =
+ llvm::StructType::createNamed("struct.__method_list_t",
+ IntTy, IntTy,
+ llvm::ArrayType::get(MethodTy, 0),
+ NULL);
// struct method_list_t *
MethodListnfABIPtrTy = llvm::PointerType::getUnqual(MethodListnfABITy);
@@ -4421,20 +4409,21 @@
// }
// Holder for struct _protocol_list_t *
- llvm::PATypeHolder ProtocolListTyHolder = llvm::OpaqueType::get(VMContext);
+ ProtocolListnfABITy =
+ llvm::StructType::createNamed(VMContext, "struct._objc_protocol_list");
- ProtocolnfABITy = llvm::StructType::get(ObjectPtrTy, Int8PtrTy,
- ProtocolListTyHolder->getPointerTo(),
- MethodListnfABIPtrTy,
- MethodListnfABIPtrTy,
- MethodListnfABIPtrTy,
- MethodListnfABIPtrTy,
- PropertyListPtrTy,
- IntTy,
- IntTy,
- NULL);
- CGM.getModule().addTypeName("struct._protocol_t",
- ProtocolnfABITy);
+ ProtocolnfABITy =
+ llvm::StructType::createNamed("struct._protocol_t",
+ ObjectPtrTy, Int8PtrTy,
+ llvm::PointerType::getUnqual(ProtocolListnfABITy),
+ MethodListnfABIPtrTy,
+ MethodListnfABIPtrTy,
+ MethodListnfABIPtrTy,
+ MethodListnfABIPtrTy,
+ PropertyListPtrTy,
+ IntTy,
+ IntTy,
+ NULL);
// struct _protocol_t*
ProtocolnfABIPtrTy = llvm::PointerType::getUnqual(ProtocolnfABITy);
@@ -4443,14 +4432,9 @@
// long protocol_count; // Note, this is 32/64 bit
// struct _protocol_t *[protocol_count];
// }
- ProtocolListnfABITy = llvm::StructType::get(LongTy,
- llvm::ArrayType::get(
- ProtocolnfABIPtrTy, 0),
- NULL);
- CGM.getModule().addTypeName("struct._objc_protocol_list",
- ProtocolListnfABITy);
- cast<llvm::OpaqueType>(ProtocolListTyHolder.get())->refineAbstractTypeTo(
- ProtocolListnfABITy);
+ ProtocolListnfABITy->setBody(LongTy,
+ llvm::ArrayType::get(ProtocolnfABIPtrTy, 0),
+ NULL);
// struct _objc_protocol_list*
ProtocolListnfABIPtrTy = llvm::PointerType::getUnqual(ProtocolListnfABITy);
@@ -4462,24 +4446,25 @@
// uint32_t alignment;
// uint32_t size;
// }
- IvarnfABITy = llvm::StructType::get(llvm::PointerType::getUnqual(LongTy),
- Int8PtrTy,
- Int8PtrTy,
- IntTy,
- IntTy,
- NULL);
- CGM.getModule().addTypeName("struct._ivar_t", IvarnfABITy);
+ IvarnfABITy =
+ llvm::StructType::createNamed("struct._ivar_t",
+ llvm::PointerType::getUnqual(LongTy),
+ Int8PtrTy,
+ Int8PtrTy,
+ IntTy,
+ IntTy,
+ NULL);
// struct _ivar_list_t {
// uint32 entsize; // sizeof(struct _ivar_t)
// uint32 count;
// struct _iver_t list[count];
// }
- IvarListnfABITy = llvm::StructType::get(IntTy, IntTy,
- llvm::ArrayType::get(
- IvarnfABITy, 0),
- NULL);
- CGM.getModule().addTypeName("struct._ivar_list_t", IvarListnfABITy);
+ IvarListnfABITy =
+ llvm::StructType::createNamed("struct._ivar_list_t",
+ IntTy, IntTy,
+ llvm::ArrayType::get(IvarnfABITy, 0),
+ NULL);
IvarListnfABIPtrTy = llvm::PointerType::getUnqual(IvarListnfABITy);
@@ -4498,22 +4483,21 @@
// }
// FIXME. Add 'reserved' field in 64bit abi mode!
- ClassRonfABITy = llvm::StructType::get(IntTy,
- IntTy,
- IntTy,
- Int8PtrTy,
- Int8PtrTy,
- MethodListnfABIPtrTy,
- ProtocolListnfABIPtrTy,
- IvarListnfABIPtrTy,
- Int8PtrTy,
- PropertyListPtrTy,
- NULL);
- CGM.getModule().addTypeName("struct._class_ro_t",
- ClassRonfABITy);
+ ClassRonfABITy = llvm::StructType::createNamed("struct._class_ro_t",
+ IntTy,
+ IntTy,
+ IntTy,
+ Int8PtrTy,
+ Int8PtrTy,
+ MethodListnfABIPtrTy,
+ ProtocolListnfABIPtrTy,
+ IvarListnfABIPtrTy,
+ Int8PtrTy,
+ PropertyListPtrTy,
+ NULL);
// ImpnfABITy - LLVM for id (*)(id, SEL, ...)
- const llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
+ llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy };
ImpnfABITy = llvm::FunctionType::get(ObjectPtrTy, params, false)
->getPointerTo();
@@ -4525,18 +4509,13 @@
// struct class_ro_t *ro;
// }
- llvm::PATypeHolder ClassTyHolder = llvm::OpaqueType::get(VMContext);
- ClassnfABITy =
- llvm::StructType::get(llvm::PointerType::getUnqual(ClassTyHolder),
- llvm::PointerType::getUnqual(ClassTyHolder),
- CachePtrTy,
- llvm::PointerType::getUnqual(ImpnfABITy),
- llvm::PointerType::getUnqual(ClassRonfABITy),
- NULL);
- CGM.getModule().addTypeName("struct._class_t", ClassnfABITy);
-
- cast<llvm::OpaqueType>(ClassTyHolder.get())->refineAbstractTypeTo(
- ClassnfABITy);
+ ClassnfABITy = llvm::StructType::createNamed(VMContext, "struct._class_t");
+ ClassnfABITy->setBody(llvm::PointerType::getUnqual(ClassnfABITy),
+ llvm::PointerType::getUnqual(ClassnfABITy),
+ CachePtrTy,
+ llvm::PointerType::getUnqual(ImpnfABITy),
+ llvm::PointerType::getUnqual(ClassRonfABITy),
+ NULL);
// LLVM for struct _class_t *
ClassnfABIPtrTy = llvm::PointerType::getUnqual(ClassnfABITy);
@@ -4549,14 +4528,14 @@
// const struct _protocol_list_t * const protocols;
// const struct _prop_list_t * const properties;
// }
- CategorynfABITy = llvm::StructType::get(Int8PtrTy,
- ClassnfABIPtrTy,
- MethodListnfABIPtrTy,
- MethodListnfABIPtrTy,
- ProtocolListnfABIPtrTy,
- PropertyListPtrTy,
- NULL);
- CGM.getModule().addTypeName("struct._category_t", CategorynfABITy);
+ CategorynfABITy = llvm::StructType::createNamed("struct._category_t",
+ Int8PtrTy,
+ ClassnfABIPtrTy,
+ MethodListnfABIPtrTy,
+ MethodListnfABIPtrTy,
+ ProtocolListnfABIPtrTy,
+ PropertyListPtrTy,
+ NULL);
// New types for nonfragile abi messaging.
CodeGen::CodeGenTypes &Types = CGM.getTypes();
@@ -4591,8 +4570,9 @@
// SUPER_IMP messenger;
// SEL name;
// };
- SuperMessageRefTy = llvm::StructType::get(ImpnfABITy, SelectorPtrTy, NULL);
- CGM.getModule().addTypeName("struct._super_message_ref_t", SuperMessageRefTy);
+ SuperMessageRefTy =
+ llvm::StructType::createNamed("struct._super_message_ref_t",
+ ImpnfABITy, SelectorPtrTy, NULL);
// SuperMessageRefPtrTy - LLVM for struct _super_message_ref_t*
SuperMessageRefPtrTy = llvm::PointerType::getUnqual(SuperMessageRefTy);
@@ -4603,11 +4583,12 @@
// const char* name; // c++ typeinfo string
// Class cls;
// };
- EHTypeTy = llvm::StructType::get(llvm::PointerType::getUnqual(Int8PtrTy),
- Int8PtrTy,
- ClassnfABIPtrTy,
- NULL);
- CGM.getModule().addTypeName("struct._objc_typeinfo", EHTypeTy);
+ EHTypeTy =
+ llvm::StructType::createNamed("struct._objc_typeinfo",
+ llvm::PointerType::getUnqual(Int8PtrTy),
+ Int8PtrTy,
+ ClassnfABIPtrTy,
+ NULL);
EHTypePtrTy = llvm::PointerType::getUnqual(EHTypeTy);
}
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=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGRecordLayout.h (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGRecordLayout.h Fri Jul 8 03:40:05 2011
@@ -208,8 +208,8 @@
bool IsZeroInitializableAsBase : 1;
public:
- CGRecordLayout(const llvm::StructType *CompleteObjectType,
- const llvm::StructType *BaseSubobjectType,
+ CGRecordLayout(llvm::StructType *CompleteObjectType,
+ llvm::StructType *BaseSubobjectType,
bool IsZeroInitializable,
bool IsZeroInitializableAsBase)
: CompleteObjectType(CompleteObjectType),
@@ -219,13 +219,13 @@
/// \brief Return the "complete object" LLVM type associated with
/// this record.
- const llvm::StructType *getLLVMType() const {
+ llvm::StructType *getLLVMType() const {
return cast<llvm::StructType>(CompleteObjectType.get());
}
/// \brief Return the "base subobject" LLVM type associated with
/// this record.
- const llvm::StructType *getBaseSubobjectLLVMType() const {
+ llvm::StructType *getBaseSubobjectLLVMType() const {
return cast<llvm::StructType>(BaseSubobjectType.get());
}
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=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGRecordLayoutBuilder.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGRecordLayoutBuilder.cpp Fri Jul 8 03:40:05 2011
@@ -35,7 +35,7 @@
public:
/// FieldTypes - Holds the LLVM types that the struct is created from.
///
- llvm::SmallVector<const llvm::Type *, 16> FieldTypes;
+ llvm::SmallVector<llvm::Type *, 16> FieldTypes;
/// BaseSubobjectType - Holds the LLVM type for the non-virtual part
/// of the struct. For example, consider:
@@ -52,7 +52,7 @@
///
/// This only gets initialized if the base subobject type is
/// different from the complete-object type.
- const llvm::StructType *BaseSubobjectType;
+ llvm::StructType *BaseSubobjectType;
/// FieldInfo - Holds a field and its corresponding LLVM field number.
llvm::DenseMap<const FieldDecl *, unsigned> Fields;
@@ -109,8 +109,8 @@
/// LayoutUnionField - Will layout a field in an union and return the type
/// that the field will have.
- const llvm::Type *LayoutUnionField(const FieldDecl *Field,
- const ASTRecordLayout &Layout);
+ llvm::Type *LayoutUnionField(const FieldDecl *Field,
+ const ASTRecordLayout &Layout);
/// LayoutUnion - Will layout a union RecordDecl.
void LayoutUnion(const RecordDecl *D);
@@ -151,7 +151,7 @@
void LayoutBitField(const FieldDecl *D, uint64_t FieldOffset);
/// AppendField - Appends a field with the given offset and type.
- void AppendField(CharUnits fieldOffset, const llvm::Type *FieldTy);
+ void AppendField(CharUnits fieldOffset, llvm::Type *FieldTy);
/// AppendPadding - Appends enough padding bytes so that the total
/// struct size is a multiple of the field alignment.
@@ -165,7 +165,7 @@
/// getByteArrayType - Returns a byte array type with the given number of
/// elements.
- const llvm::Type *getByteArrayType(CharUnits NumBytes);
+ llvm::Type *getByteArrayType(CharUnits NumBytes);
/// AppendBytes - Append a given number of bytes to the record.
void AppendBytes(CharUnits numBytes);
@@ -440,7 +440,7 @@
CharUnits fieldOffsetInBytes
= Types.getContext().toCharUnitsFromBits(fieldOffset);
- const llvm::Type *Ty = Types.ConvertTypeForMemRecursive(D->getType());
+ llvm::Type *Ty = Types.ConvertTypeForMemRecursive(D->getType());
CharUnits typeAlignment = getTypeAlignment(Ty);
// If the type alignment is larger then the struct alignment, we must use
@@ -488,7 +488,7 @@
return true;
}
-const llvm::Type *
+llvm::Type *
CGRecordLayoutBuilder::LayoutUnionField(const FieldDecl *Field,
const ASTRecordLayout &Layout) {
if (Field->isBitField()) {
@@ -499,7 +499,7 @@
if (FieldSize == 0)
return 0;
- const llvm::Type *FieldTy = llvm::Type::getInt8Ty(Types.getLLVMContext());
+ llvm::Type *FieldTy = llvm::Type::getInt8Ty(Types.getLLVMContext());
CharUnits NumBytesToAppend = Types.getContext().toCharUnitsFromBits(
llvm::RoundUpToAlignment(FieldSize,
Types.getContext().Target.getCharAlign()));
@@ -523,7 +523,7 @@
const ASTRecordLayout &layout = Types.getContext().getASTRecordLayout(D);
- const llvm::Type *unionType = 0;
+ llvm::Type *unionType = 0;
CharUnits unionSize = CharUnits::Zero();
CharUnits unionAlign = CharUnits::Zero();
@@ -534,7 +534,7 @@
fieldEnd = D->field_end(); field != fieldEnd; ++field, ++fieldNo) {
assert(layout.getFieldOffset(fieldNo) == 0 &&
"Union field offset did not start at the beginning of record!");
- const llvm::Type *fieldType = LayoutUnionField(*field, layout);
+ llvm::Type *fieldType = LayoutUnionField(*field, layout);
if (!fieldType)
continue;
@@ -599,7 +599,7 @@
// approximation, which is to use the base subobject type if it
// has the same LLVM storage size as the nvsize.
- const llvm::StructType *subobjectType = baseLayout.getBaseSubobjectLLVMType();
+ llvm::StructType *subobjectType = baseLayout.getBaseSubobjectLLVMType();
AppendField(baseOffset, subobjectType);
Types.addBaseSubobjectTypeName(base, baseLayout);
@@ -819,7 +819,7 @@
}
void CGRecordLayoutBuilder::AppendField(CharUnits fieldOffset,
- const llvm::Type *fieldType) {
+ llvm::Type *fieldType) {
CharUnits fieldSize =
CharUnits::fromQuantity(Types.getTargetData().getTypeAllocSize(fieldType));
@@ -865,10 +865,10 @@
return true;
}
-const llvm::Type *CGRecordLayoutBuilder::getByteArrayType(CharUnits numBytes) {
+llvm::Type *CGRecordLayoutBuilder::getByteArrayType(CharUnits numBytes) {
assert(!numBytes.isZero() && "Empty byte arrays aren't allowed.");
- const llvm::Type *Ty = llvm::Type::getInt8Ty(Types.getLLVMContext());
+ llvm::Type *Ty = llvm::Type::getInt8Ty(Types.getLLVMContext());
if (numBytes > CharUnits::One())
Ty = llvm::ArrayType::get(Ty, numBytes.getQuantity());
@@ -929,12 +929,12 @@
Builder.Layout(D);
- const llvm::StructType *Ty = llvm::StructType::get(getLLVMContext(),
- Builder.FieldTypes,
- Builder.Packed);
+ llvm::StructType *Ty = llvm::StructType::get(getLLVMContext(),
+ Builder.FieldTypes,
+ Builder.Packed);
// If we're in C++, compute the base subobject type.
- const llvm::StructType *BaseTy = 0;
+ llvm::StructType *BaseTy = 0;
if (isa<CXXRecordDecl>(D)) {
BaseTy = Builder.BaseSubobjectType;
if (!BaseTy) BaseTy = Ty;
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CGStmt.cpp?rev=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CGStmt.cpp Fri Jul 8 03:40:05 2011
@@ -1410,13 +1410,13 @@
std::vector<QualType> ResultRegQualTys;
std::vector<const llvm::Type *> ResultRegTypes;
std::vector<const llvm::Type *> ResultTruncRegTypes;
- std::vector<const llvm::Type*> ArgTypes;
+ std::vector<llvm::Type*> ArgTypes;
std::vector<llvm::Value*> Args;
// Keep track of inout constraints.
std::string InOutConstraints;
std::vector<llvm::Value*> InOutArgs;
- std::vector<const llvm::Type*> InOutArgTypes;
+ std::vector<llvm::Type*> InOutArgTypes;
for (unsigned i = 0, e = S.getNumOutputs(); i != e; i++) {
TargetInfo::ConstraintInfo &Info = OutputConstraintInfos[i];
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenFunction.cpp?rev=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenFunction.cpp Fri Jul 8 03:40:05 2011
@@ -45,11 +45,11 @@
}
-const llvm::Type *CodeGenFunction::ConvertTypeForMem(QualType T) {
+llvm::Type *CodeGenFunction::ConvertTypeForMem(QualType T) {
return CGM.getTypes().ConvertTypeForMem(T);
}
-const llvm::Type *CodeGenFunction::ConvertType(QualType T) {
+llvm::Type *CodeGenFunction::ConvertType(QualType T) {
return CGM.getTypes().ConvertType(T);
}
@@ -213,8 +213,8 @@
/// function instrumentation is enabled.
void CodeGenFunction::EmitFunctionInstrumentation(const char *Fn) {
// void __cyg_profile_func_{enter,exit} (void *this_fn, void *call_site);
- const llvm::PointerType *PointerTy = Int8PtrTy;
- const llvm::Type *ProfileFuncArgs[] = { PointerTy, PointerTy };
+ llvm::PointerType *PointerTy = Int8PtrTy;
+ llvm::Type *ProfileFuncArgs[] = { PointerTy, PointerTy };
const llvm::FunctionType *FunctionTy =
llvm::FunctionType::get(llvm::Type::getVoidTy(getLLVMContext()),
ProfileFuncArgs, false);
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenFunction.h?rev=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenFunction.h Fri Jul 8 03:40:05 2011
@@ -1312,9 +1312,9 @@
/// a terminate scope encloses a try.
llvm::BasicBlock *getTerminateHandler();
- const llvm::Type *ConvertTypeForMem(QualType T);
- const llvm::Type *ConvertType(QualType T);
- const llvm::Type *ConvertType(const TypeDecl *T) {
+ llvm::Type *ConvertTypeForMem(QualType T);
+ llvm::Type *ConvertType(QualType T);
+ llvm::Type *ConvertType(const TypeDecl *T) {
return ConvertType(getContext().getTypeDeclType(T));
}
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=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenModule.cpp Fri Jul 8 03:40:05 2011
@@ -1613,10 +1613,12 @@
return GetOrCreateLLVMFunction(Name, Ty, D, /*ForVTable=*/false);
}
-llvm::Function *CodeGenModule::getIntrinsic(unsigned IID,const llvm::Type **Tys,
+llvm::Function *CodeGenModule::getIntrinsic(unsigned IID, llvm::Type **Tys,
unsigned NumTys) {
return llvm::Intrinsic::getDeclaration(&getModule(),
- (llvm::Intrinsic::ID)IID, Tys, NumTys);
+ (llvm::Intrinsic::ID)IID,
+ const_cast<const llvm::Type **>(Tys),
+ NumTys);
}
static llvm::StringMapEntry<llvm::Constant*> &
Modified: cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenModule.h?rev=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenModule.h Fri Jul 8 03:40:05 2011
@@ -99,31 +99,31 @@
struct CodeGenTypeCache {
/// void
- const llvm::Type *VoidTy;
+ llvm::Type *VoidTy;
/// i8, i32, and i64
- const llvm::IntegerType *Int8Ty, *Int32Ty, *Int64Ty;
+ llvm::IntegerType *Int8Ty, *Int32Ty, *Int64Ty;
/// int
- const llvm::IntegerType *IntTy;
+ llvm::IntegerType *IntTy;
/// intptr_t, size_t, and ptrdiff_t, which we assume are the same size.
union {
- const llvm::IntegerType *IntPtrTy;
- const llvm::IntegerType *SizeTy;
- const llvm::IntegerType *PtrDiffTy;
+ llvm::IntegerType *IntPtrTy;
+ llvm::IntegerType *SizeTy;
+ llvm::IntegerType *PtrDiffTy;
};
/// void* in address space 0
union {
- const llvm::PointerType *VoidPtrTy;
- const llvm::PointerType *Int8PtrTy;
+ llvm::PointerType *VoidPtrTy;
+ llvm::PointerType *Int8PtrTy;
};
/// void** in address space 0
union {
- const llvm::PointerType *VoidPtrPtrTy;
- const llvm::PointerType *Int8PtrPtrTy;
+ llvm::PointerType *VoidPtrPtrTy;
+ llvm::PointerType *Int8PtrPtrTy;
};
/// The width of a pointer into the generic address space.
@@ -312,8 +312,8 @@
llvm::Constant *BlockObjectAssign;
llvm::Constant *BlockObjectDispose;
- const llvm::Type *BlockDescriptorType;
- const llvm::Type *GenericBlockLiteralType;
+ llvm::Type *BlockDescriptorType;
+ llvm::Type *GenericBlockLiteralType;
struct {
int GlobalUniqueCount;
@@ -503,10 +503,10 @@
/// getBlockDescriptorType - Fetches the type of a generic block
/// descriptor.
- const llvm::Type *getBlockDescriptorType();
+ llvm::Type *getBlockDescriptorType();
/// getGenericBlockLiteralType - The type of a generic block literal.
- const llvm::Type *getGenericBlockLiteralType();
+ llvm::Type *getGenericBlockLiteralType();
/// GetAddrOfGlobalBlock - Gets the address of a block which
/// requires no captures.
@@ -573,7 +573,7 @@
llvm::Value *getBuiltinLibFunction(const FunctionDecl *FD,
unsigned BuiltinID);
- llvm::Function *getIntrinsic(unsigned IID, const llvm::Type **Tys = 0,
+ llvm::Function *getIntrinsic(unsigned IID, llvm::Type **Tys = 0,
unsigned NumTys = 0);
/// EmitTopLevelDecl - Emit code for a single top level declaration.
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=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.cpp Fri Jul 8 03:40:05 2011
@@ -97,8 +97,8 @@
}
/// ConvertType - Convert the specified type to its LLVM form.
-const llvm::Type *CodeGenTypes::ConvertType(QualType T, bool IsRecursive) {
- const llvm::Type *Result = ConvertTypeRecursive(T);
+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
@@ -111,7 +111,7 @@
return Result;
}
-const llvm::Type *CodeGenTypes::ConvertTypeRecursive(QualType T) {
+llvm::Type *CodeGenTypes::ConvertTypeRecursive(QualType T) {
T = Context.getCanonicalType(T);
// See if type is already cached.
@@ -122,7 +122,7 @@
if (I != TypeCache.end())
return I->second.get();
- const llvm::Type *ResultType = ConvertNewType(T);
+ llvm::Type *ResultType = ConvertNewType(T);
TypeCache.insert(std::make_pair(T.getTypePtr(),
llvm::PATypeHolder(ResultType)));
return ResultType;
@@ -132,8 +132,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.
-const llvm::Type *CodeGenTypes::ConvertTypeForMem(QualType T, bool IsRecursive){
- const llvm::Type *R = ConvertType(T, IsRecursive);
+llvm::Type *CodeGenTypes::ConvertTypeForMem(QualType T, bool IsRecursive){
+ llvm::Type *R = ConvertType(T, IsRecursive);
// If this is a non-bool type, don't map it.
if (!R->isIntegerTy(1))
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=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.h (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/CodeGenTypes.h Fri Jul 8 03:40:05 2011
@@ -123,15 +123,15 @@
llvm::LLVMContext &getLLVMContext() { return TheModule.getContext(); }
/// ConvertType - Convert type T into a llvm::Type.
- const llvm::Type *ConvertType(QualType T, bool IsRecursive = false);
- const llvm::Type *ConvertTypeRecursive(QualType T);
+ llvm::Type *ConvertType(QualType T, bool IsRecursive = false);
+ llvm::Type *ConvertTypeRecursive(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.
- const llvm::Type *ConvertTypeForMem(QualType T, bool IsRecursive = false);
- const llvm::Type *ConvertTypeForMemRecursive(QualType T) {
+ llvm::Type *ConvertTypeForMem(QualType T, bool IsRecursive = false);
+ llvm::Type *ConvertTypeForMemRecursive(QualType T) {
return ConvertTypeForMem(T, true);
}
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=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/ItaniumCXXABI.cpp Fri Jul 8 03:40:05 2011
@@ -34,15 +34,15 @@
namespace {
class ItaniumCXXABI : public CodeGen::CGCXXABI {
private:
- const llvm::IntegerType *PtrDiffTy;
+ llvm::IntegerType *PtrDiffTy;
protected:
bool IsARM;
// It's a little silly for us to cache this.
- const llvm::IntegerType *getPtrDiffTy() {
+ llvm::IntegerType *getPtrDiffTy() {
if (!PtrDiffTy) {
QualType T = getContext().getPointerDiffType();
- const llvm::Type *Ty = CGM.getTypes().ConvertTypeRecursive(T);
+ llvm::Type *Ty = CGM.getTypes().ConvertTypeRecursive(T);
PtrDiffTy = cast<llvm::IntegerType>(Ty);
}
return PtrDiffTy;
@@ -58,7 +58,7 @@
bool isZeroInitializable(const MemberPointerType *MPT);
- const llvm::Type *ConvertMemberPointerType(const MemberPointerType *MPT);
+ llvm::Type *ConvertMemberPointerType(const MemberPointerType *MPT);
llvm::Value *EmitLoadOfMemberFunctionPointer(CodeGenFunction &CGF,
llvm::Value *&This,
@@ -176,7 +176,7 @@
return new ARMCXXABI(CGM);
}
-const llvm::Type *
+llvm::Type *
ItaniumCXXABI::ConvertMemberPointerType(const MemberPointerType *MPT) {
if (MPT->isMemberDataPointer())
return getPtrDiffTy();
@@ -1034,31 +1034,34 @@
/*********************** Static local initialization **************************/
static llvm::Constant *getGuardAcquireFn(CodeGenModule &CGM,
- const llvm::PointerType *GuardPtrTy) {
+ llvm::PointerType *GuardPtrTy) {
// int __cxa_guard_acquire(__guard *guard_object);
+ llvm::Type *ArgTys[] = { GuardPtrTy };
const llvm::FunctionType *FTy =
llvm::FunctionType::get(CGM.getTypes().ConvertType(CGM.getContext().IntTy),
- GuardPtrTy, /*isVarArg=*/false);
+ ArgTys, /*isVarArg=*/false);
return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_acquire");
}
static llvm::Constant *getGuardReleaseFn(CodeGenModule &CGM,
- const llvm::PointerType *GuardPtrTy) {
+ llvm::PointerType *GuardPtrTy) {
// void __cxa_guard_release(__guard *guard_object);
+ llvm::Type *ArgTys[] = { GuardPtrTy };
const llvm::FunctionType *FTy =
llvm::FunctionType::get(llvm::Type::getVoidTy(CGM.getLLVMContext()),
- GuardPtrTy, /*isVarArg=*/false);
+ ArgTys, /*isVarArg=*/false);
return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_release");
}
static llvm::Constant *getGuardAbortFn(CodeGenModule &CGM,
- const llvm::PointerType *GuardPtrTy) {
+ llvm::PointerType *GuardPtrTy) {
// void __cxa_guard_abort(__guard *guard_object);
+ llvm::Type *ArgTys[] = { GuardPtrTy };
const llvm::FunctionType *FTy =
llvm::FunctionType::get(llvm::Type::getVoidTy(CGM.getLLVMContext()),
- GuardPtrTy, /*isVarArg=*/false);
+ ArgTys, /*isVarArg=*/false);
return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_abort");
}
@@ -1098,7 +1101,7 @@
// Guard variables are 64 bits in the generic ABI and 32 bits on ARM.
GuardTy = (IsARM ? CGF.Int32Ty : CGF.Int64Ty);
}
- const llvm::PointerType *GuardPtrTy = GuardTy->getPointerTo();
+ llvm::PointerType *GuardPtrTy = GuardTy->getPointerTo();
// Create the guard variable.
llvm::SmallString<256> GuardVName;
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=134694&r1=134693&r2=134694&view=diff
==============================================================================
--- cfe/branches/type-system-rewrite/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/branches/type-system-rewrite/lib/CodeGen/TargetInfo.cpp Fri Jul 8 03:40:05 2011
@@ -562,7 +562,7 @@
} else if (SeltTy->isPointerType()) {
// FIXME: It would be really nice if this could come out as the proper
// pointer type.
- const llvm::Type *PtrTy = llvm::Type::getInt8PtrTy(getVMContext());
+ llvm::Type *PtrTy = llvm::Type::getInt8PtrTy(getVMContext());
return ABIArgInfo::getDirect(PtrTy);
} else if (SeltTy->isVectorType()) {
// 64- and 128-bit vectors are never returned in a
@@ -699,7 +699,7 @@
Size));
}
- const llvm::Type *IRType = CGT.ConvertTypeRecursive(Ty);
+ llvm::Type *IRType = CGT.ConvertTypeRecursive(Ty);
if (UseX86_MMXType(IRType)) {
ABIArgInfo AAI = ABIArgInfo::getDirect(IRType);
AAI.setCoerceToType(llvm::Type::getX86_MMXTy(getVMContext()));
@@ -843,13 +843,13 @@
/// also be ComplexX87.
void classify(QualType T, uint64_t OffsetBase, Class &Lo, Class &Hi) const;
- const llvm::Type *Get16ByteVectorType(QualType Ty) const;
- const llvm::Type *GetSSETypeAtOffset(const llvm::Type *IRType,
- unsigned IROffset, QualType SourceTy,
- unsigned SourceOffset) const;
- const llvm::Type *GetINTEGERTypeAtOffset(const llvm::Type *IRType,
- unsigned IROffset, QualType SourceTy,
- unsigned SourceOffset) const;
+ llvm::Type *Get16ByteVectorType(QualType Ty) const;
+ llvm::Type *GetSSETypeAtOffset(llvm::Type *IRType,
+ unsigned IROffset, QualType SourceTy,
+ unsigned SourceOffset) const;
+ llvm::Type *GetINTEGERTypeAtOffset(llvm::Type *IRType,
+ unsigned IROffset, QualType SourceTy,
+ unsigned SourceOffset) const;
/// getIndirectResult - Give a source type \arg Ty, return a suitable result
/// such that the argument will be returned in memory.
@@ -1324,20 +1324,20 @@
/// Get16ByteVectorType - The ABI specifies that a value should be passed in an
/// full vector XMM register. Pick an LLVM IR type that will be passed as a
/// vector register.
-const llvm::Type *X86_64ABIInfo::Get16ByteVectorType(QualType Ty) const {
- const llvm::Type *IRType = CGT.ConvertTypeRecursive(Ty);
+llvm::Type *X86_64ABIInfo::Get16ByteVectorType(QualType Ty) const {
+ llvm::Type *IRType = CGT.ConvertTypeRecursive(Ty);
// Wrapper structs that just contain vectors are passed just like vectors,
// strip them off if present.
- const llvm::StructType *STy = dyn_cast<llvm::StructType>(IRType);
+ llvm::StructType *STy = dyn_cast<llvm::StructType>(IRType);
while (STy && STy->getNumElements() == 1) {
IRType = STy->getElementType(0);
STy = dyn_cast<llvm::StructType>(IRType);
}
// If the preferred type is a 16-byte vector, prefer to pass it.
- if (const llvm::VectorType *VT = dyn_cast<llvm::VectorType>(IRType)){
- const llvm::Type *EltTy = VT->getElementType();
+ if (llvm::VectorType *VT = dyn_cast<llvm::VectorType>(IRType)){
+ llvm::Type *EltTy = VT->getElementType();
if (VT->getBitWidth() == 128 &&
(EltTy->isFloatTy() || EltTy->isDoubleTy() ||
EltTy->isIntegerTy(8) || EltTy->isIntegerTy(16) ||
@@ -1466,8 +1466,8 @@
/// GetSSETypeAtOffset - Return a type that will be passed by the backend in the
/// low 8 bytes of an XMM register, corresponding to the SSE class.
-const llvm::Type *X86_64ABIInfo::
-GetSSETypeAtOffset(const llvm::Type *IRType, unsigned IROffset,
+llvm::Type *X86_64ABIInfo::
+GetSSETypeAtOffset(llvm::Type *IRType, unsigned IROffset,
QualType SourceTy, unsigned SourceOffset) const {
// The only three choices we have are either double, <2 x float>, or float. We
// pass as float if the last 4 bytes is just padding. This happens for
@@ -1501,8 +1501,8 @@
/// SourceTy is the source level type for the entire argument. SourceOffset is
/// an offset into this that we're processing (which is always either 0 or 8).
///
-const llvm::Type *X86_64ABIInfo::
-GetINTEGERTypeAtOffset(const llvm::Type *IRType, unsigned IROffset,
+llvm::Type *X86_64ABIInfo::
+GetINTEGERTypeAtOffset(llvm::Type *IRType, unsigned IROffset,
QualType SourceTy, unsigned SourceOffset) const {
// If we're dealing with an un-offset LLVM IR type, then it means that we're
// returning an 8-byte unit starting with it. See if we can safely use it.
@@ -1540,7 +1540,7 @@
}
if (const llvm::ArrayType *ATy = dyn_cast<llvm::ArrayType>(IRType)) {
- const llvm::Type *EltTy = ATy->getElementType();
+ llvm::Type *EltTy = ATy->getElementType();
unsigned EltSize = getTargetData().getTypeAllocSize(EltTy);
unsigned EltOffset = IROffset/EltSize*EltSize;
return GetINTEGERTypeAtOffset(EltTy, IROffset-EltOffset, SourceTy,
@@ -1566,7 +1566,7 @@
/// first class aggregate to represent them. For example, if the low part of
/// a by-value argument should be passed as i32* and the high part as float,
/// return {i32*, float}.
-static const llvm::Type *
+static llvm::Type *
GetX86_64ByValArgumentPair(const llvm::Type *Lo, const llvm::Type *Hi,
const llvm::TargetData &TD) {
// In order to correctly satisfy the ABI, we need to the high part to start
@@ -1594,7 +1594,7 @@
}
}
- const llvm::StructType *Result = llvm::StructType::get(Lo, Hi, NULL);
+ llvm::StructType *Result = llvm::StructType::get(Lo, Hi, NULL);
// Verify that the second element is at an 8-byte offset.
@@ -1614,7 +1614,7 @@
assert((Hi != Memory || Lo == Memory) && "Invalid memory classification.");
assert((Hi != SSEUp || Lo == SSE) && "Invalid SSEUp classification.");
- const llvm::Type *ResType = 0;
+ llvm::Type *ResType = 0;
switch (Lo) {
case NoClass:
if (Hi == NoClass)
@@ -1676,7 +1676,7 @@
break;
}
- const llvm::Type *HighPart = 0;
+ llvm::Type *HighPart = 0;
switch (Hi) {
// Memory was handled previously and X87 should
// never occur as a hi class.
@@ -1746,7 +1746,7 @@
neededInt = 0;
neededSSE = 0;
- const llvm::Type *ResType = 0;
+ llvm::Type *ResType = 0;
switch (Lo) {
case NoClass:
if (Hi == NoClass)
@@ -1800,14 +1800,14 @@
// available SSE register is used, the registers are taken in the
// order from %xmm0 to %xmm7.
case SSE: {
- const llvm::Type *IRType = CGT.ConvertTypeRecursive(Ty);
+ llvm::Type *IRType = CGT.ConvertTypeRecursive(Ty);
ResType = GetSSETypeAtOffset(IRType, 0, Ty, 0);
++neededSSE;
break;
}
}
- const llvm::Type *HighPart = 0;
+ llvm::Type *HighPart = 0;
switch (Hi) {
// Memory was handled previously, ComplexX87 and X87 should
// never occur as hi classes, and X87Up must be preceded by X87,
@@ -2368,7 +2368,7 @@
SizeRegs = (getContext().getTypeSize(Ty) + 63) / 64;
}
- const llvm::Type *STy =
+ llvm::Type *STy =
llvm::StructType::get(llvm::ArrayType::get(ElemTy, SizeRegs), NULL);
return ABIArgInfo::getDirect(STy);
}
More information about the llvm-branch-commits
mailing list