[cfe-commits] r64451 - in /cfe/trunk/lib/CodeGen: CGBlocks.cpp CodeGenModule.cpp CodeGenModule.h
Mike Stump
mrs at apple.com
Fri Feb 13 07:16:57 PST 2009
Author: mrs
Date: Fri Feb 13 09:16:56 2009
New Revision: 64451
URL: http://llvm.org/viewvc/llvm-project?rev=64451&view=rev
Log:
Move BlockDescriptorType into CGM.
Modified:
cfe/trunk/lib/CodeGen/CGBlocks.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.h
Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=64451&r1=64450&r2=64451&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Fri Feb 13 09:16:56 2009
@@ -26,25 +26,25 @@
IsGlobal = 1 << 28
};
-static const llvm::Type *getBlockDescriptorType(CodeGenModule &CGM) {
- static const llvm::Type *Ty = 0;
-
- if (!Ty) {
- const llvm::Type *UnsignedLongTy =
- CGM.getTypes().ConvertType(CGM.getContext().UnsignedLongTy);
-
- // struct __block_descriptor {
- // unsigned long reserved;
- // unsigned long block_size;
- // };
- Ty = llvm::StructType::get(UnsignedLongTy,
- UnsignedLongTy,
- NULL);
+const llvm::Type *CodeGenModule::getBlockDescriptorType() {
+ if (BlockDescriptorType)
+ return BlockDescriptorType;
+
+ const llvm::Type *UnsignedLongTy =
+ getTypes().ConvertType(getContext().UnsignedLongTy);
- CGM.getModule().addTypeName("struct.__block_descriptor", Ty);
- }
-
- return Ty;
+ // struct __block_descriptor {
+ // unsigned long reserved;
+ // unsigned long block_size;
+ // };
+ BlockDescriptorType = llvm::StructType::get(UnsignedLongTy,
+ UnsignedLongTy,
+ NULL);
+
+ getModule().addTypeName("struct.__block_descriptor",
+ BlockDescriptorType);
+
+ return BlockDescriptorType;
}
static const llvm::Type *getGenericBlockLiteralType(CodeGenModule &CGM) {
@@ -55,7 +55,7 @@
llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
const llvm::Type *BlockDescPtrTy =
- llvm::PointerType::getUnqual(getBlockDescriptorType(CGM));
+ llvm::PointerType::getUnqual(CGM.getBlockDescriptorType());
// struct __block_literal_generic {
// void *isa;
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=64451&r1=64450&r2=64451&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Feb 13 09:16:56 2009
@@ -36,7 +36,8 @@
Diagnostic &diags, bool GenerateDebugInfo)
: Context(C), Features(LO), TheModule(M), TheTargetData(TD), Diags(diags),
Types(C, M, TD), Runtime(0), MemCpyFn(0), MemMoveFn(0), MemSetFn(0),
- CFConstantStringClassRef(0), NSConcreteGlobalBlock(0) {
+ CFConstantStringClassRef(0), NSConcreteGlobalBlock(0),
+ BlockDescriptorType(0) {
if (Features.ObjC1) {
if (Features.NeXTRuntime) {
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=64451&r1=64450&r2=64451&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Fri Feb 13 09:16:56 2009
@@ -123,10 +123,12 @@
/// Obj-C class pointer.
llvm::Constant *CFConstantStringClassRef;
- /// NSConcreteGlobalBlock - Cached reference to the clas pointer for
+ /// NSConcreteGlobalBlock - Cached reference to the class pointer for
/// global blocks.
llvm::Constant *NSConcreteGlobalBlock;
+ const llvm::Type *BlockDescriptorType;
+
std::vector<llvm::Function *> BuiltinFunctions;
public:
CodeGenModule(ASTContext &C, const LangOptions &Features, llvm::Module &M,
@@ -138,6 +140,8 @@
/// Release - Finalize LLVM code generation.
void Release();
+ const llvm::Type *getBlockDescriptorType();
+
/// getObjCRuntime() - Return a reference to the configured
/// Objective-C runtime.
CGObjCRuntime &getObjCRuntime() {
More information about the cfe-commits
mailing list