aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-07-09 17:41:47 +0000
committerChris Lattner <sabre@nondot.org>2011-07-09 17:41:47 +0000
commit9cbe4f0ba01ec304e1e3d071c071f7bca33631c0 (patch)
treef89ae9b252a8af0e0a2cbdfbddc230e3183ee8ee
parent0850e8d1b093cfe1fc2fdf533a0e264ef9d5412e (diff)
clang side to match the LLVM IR type system rewrite patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134831 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/ABIInfo.h12
-rw-r--r--lib/CodeGen/CGBlocks.cpp49
-rw-r--r--lib/CodeGen/CGBuiltin.cpp71
-rw-r--r--lib/CodeGen/CGCXXABI.cpp2
-rw-r--r--lib/CodeGen/CGCXXABI.h2
-rw-r--r--lib/CodeGen/CGCall.cpp64
-rw-r--r--lib/CodeGen/CGDeclCXX.cpp7
-rw-r--r--lib/CodeGen/CGException.cpp40
-rw-r--r--lib/CodeGen/CGExpr.cpp2
-rw-r--r--lib/CodeGen/CGExprCXX.cpp10
-rw-r--r--lib/CodeGen/CGExprScalar.cpp6
-rw-r--r--lib/CodeGen/CGObjC.cpp18
-rw-r--r--lib/CodeGen/CGObjCGNU.cpp54
-rw-r--r--lib/CodeGen/CGObjCMac.cpp489
-rw-r--r--lib/CodeGen/CGRecordLayout.h16
-rw-r--r--lib/CodeGen/CGRecordLayoutBuilder.cpp56
-rw-r--r--lib/CodeGen/CGStmt.cpp4
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp8
-rw-r--r--lib/CodeGen/CodeGenFunction.h6
-rw-r--r--lib/CodeGen/CodeGenModule.cpp13
-rw-r--r--lib/CodeGen/CodeGenModule.h30
-rw-r--r--lib/CodeGen/CodeGenTypes.cpp407
-rw-r--r--lib/CodeGen/CodeGenTypes.h114
-rw-r--r--lib/CodeGen/ItaniumCXXABI.cpp27
-rw-r--r--lib/CodeGen/TargetInfo.cpp73
-rw-r--r--test/CXX/except/except.spec/p14-ir.cpp13
-rw-r--r--test/CodeGen/annotate.c2
-rw-r--r--test/CodeGen/arm-arguments.c4
-rw-r--r--test/CodeGen/arm-asm-variable.c2
-rw-r--r--test/CodeGen/asm-errors.c6
-rw-r--r--test/CodeGen/bitfield-2.c8
-rw-r--r--test/CodeGen/blocksignature.c6
-rw-r--r--test/CodeGen/blockstret.c2
-rw-r--r--test/CodeGen/complex-indirect.c4
-rw-r--r--test/CodeGen/const-arithmetic.c4
-rw-r--r--test/CodeGen/const-init.c20
-rw-r--r--test/CodeGen/decl.c4
-rw-r--r--test/CodeGen/designated-initializers.c12
-rw-r--r--test/CodeGen/flexible-array-init.c4
-rw-r--r--test/CodeGen/global-init.c2
-rw-r--r--test/CodeGen/mmx-inline-asm.c2
-rw-r--r--test/CodeGen/ms-anonymous-struct.c4
-rw-r--r--test/CodeGen/packed-union.c1
-rw-r--r--test/CodeGen/pragma-pack-3.c2
-rw-r--r--test/CodeGen/regparm.c2
-rw-r--r--test/CodeGen/transparent-union.c2
-rw-r--r--test/CodeGen/trapv.c20
-rw-r--r--test/CodeGen/union-init2.c4
-rw-r--r--test/CodeGen/volatile-1.c2
-rw-r--r--test/CodeGen/volatile-2.c12
-rw-r--r--test/CodeGen/x86_32-arguments-darwin.c4
-rw-r--r--test/CodeGen/x86_64-arguments.c10
-rw-r--r--test/CodeGenCXX/blocks.cpp4
-rw-r--r--test/CodeGenCXX/class-layout.cpp2
-rw-r--r--test/CodeGenCXX/constructors.cpp4
-rw-r--r--test/CodeGenCXX/copy-constructor-elim-2.cpp2
-rw-r--r--test/CodeGenCXX/copy-initialization.cpp2
-rw-r--r--test/CodeGenCXX/delete.cpp2
-rw-r--r--test/CodeGenCXX/destructors.cpp10
-rw-r--r--test/CodeGenCXX/eh.cpp14
-rw-r--r--test/CodeGenCXX/for-range.cpp8
-rw-r--r--test/CodeGenCXX/global-init.cpp8
-rw-r--r--test/CodeGenCXX/mangle-subst-std.cpp4
-rw-r--r--test/CodeGenCXX/mangle-template.cpp2
-rw-r--r--test/CodeGenCXX/member-function-pointers.cpp44
-rw-r--r--test/CodeGenCXX/new-overflow.cpp50
-rw-r--r--test/CodeGenCXX/pointers-to-data-members.cpp8
-rw-r--r--test/CodeGenCXX/references.cpp4
-rw-r--r--test/CodeGenCXX/static-init-3.cpp4
-rw-r--r--test/CodeGenCXX/template-anonymous-types.cpp4
-rw-r--r--test/CodeGenCXX/virt-call-offsets.cpp2
-rw-r--r--test/CodeGenCXX/virtual-bases.cpp4
-rw-r--r--test/CodeGenCXX/virtual-functions-incomplete-types.cpp2
-rw-r--r--test/CodeGenCXX/volatile-1.cpp2
-rw-r--r--test/CodeGenCXX/vtable-pointer-initialization.cpp6
-rw-r--r--test/CodeGenCXX/x86_32-arguments.cpp2
-rw-r--r--test/CodeGenObjC/arc-foreach.m4
-rw-r--r--test/CodeGenObjC/arc.m18
-rw-r--r--test/CodeGenObjC/blocks.m10
-rw-r--r--test/CodeGenObjC/property-list-in-class.m4
-rw-r--r--test/CodeGenObjC/variadic-sends.m8
-rw-r--r--test/CodeGenObjCXX/property-object-conditional-exp.mm7
-rw-r--r--test/CodeGenObjCXX/property-objects.mm2
83 files changed, 935 insertions, 1050 deletions
diff --git a/lib/CodeGen/ABIInfo.h b/lib/CodeGen/ABIInfo.h
index ce1039849b..138123816c 100644
--- a/lib/CodeGen/ABIInfo.h
+++ b/lib/CodeGen/ABIInfo.h
@@ -68,22 +68,22 @@ namespace clang {
private:
Kind TheKind;
- llvm::PATypeHolder TypeData;
+ llvm::Type *TypeData;
unsigned UIntData;
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 @@ namespace clang {
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;
}
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp
index a0a8d667df..020cbdf60e 100644
--- a/lib/CodeGen/CGBlocks.cpp
+++ b/lib/CodeGen/CGBlocks.cpp
@@ -654,11 +654,11 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const BlockExpr *blockExpr) {
}
-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 llvm::Type *CodeGenModule::getBlockDescriptorType() {
// 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 @@ const llvm::Type *CodeGenModule::getGenericBlockLiteralType() {
// 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 @@ const llvm::Type *CodeGenFunction::BuildByRefType(const VarDecl *D) {
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 @@ const llvm::Type *CodeGenFunction::BuildByRefType(const VarDecl *D) {
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 @@ const llvm::Type *CodeGenFunction::BuildByRefType(const VarDecl *D) {
// 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;
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp
index 8f29663613..3246cfc34e 100644
--- a/lib/CodeGen/CGBuiltin.cpp
+++ b/lib/CodeGen/CGBuiltin.cpp
@@ -95,12 +95,12 @@ static RValue EmitBinaryAtomic(CodeGenFunction &CGF,
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];
@@ -130,12 +130,12 @@ static RValue EmitBinaryAtomicPost(CodeGenFunction &CGF,
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];
@@ -165,7 +165,8 @@ static Value *EmitFAbs(CodeGenFunction &CGF, Value *V, QualType ValTy) {
}
// 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);
@@ -233,7 +234,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
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());
@@ -248,7 +249,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
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());
@@ -264,7 +265,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
// 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());
@@ -284,7 +285,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
// 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());
@@ -301,7 +302,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
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());
@@ -313,7 +314,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
}
case Builtin::BI__builtin_expect: {
Value *ArgValue = EmitScalarExpr(E->getArg(0));
- const llvm::Type *ArgType = ArgValue->getType();
+ llvm::Type *ArgType = ArgValue->getType();
Value *FnExpect = CGM.getIntrinsic(Intrinsic::expect, &ArgType, 1);
Value *ExpectedValue = EmitScalarExpr(E->getArg(1));
@@ -321,19 +322,18 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
Value *Result = Builder.CreateCall2(FnExpect, ArgValue, ExpectedValue,
"expval");
return RValue::get(Result);
-
}
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())
};
@@ -382,7 +382,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
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"));
}
@@ -867,11 +867,11 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
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);
@@ -897,11 +897,11 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
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);
@@ -984,7 +984,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
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"));
}
@@ -997,7 +997,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
case Builtin::BI__builtin_fmal: {