[cfe-commits] r66042 - in /cfe/trunk/lib/CodeGen: CGBlocks.cpp CGBlocks.h CodeGenFunction.h CodeGenModule.cpp CodeGenModule.h
Mike Stump
mrs at apple.com
Wed Mar 4 10:17:45 PST 2009
Author: mrs
Date: Wed Mar 4 12:17:45 2009
New Revision: 66042
URL: http://llvm.org/viewvc/llvm-project?rev=66042&view=rev
Log:
Move more of blocks codegen out of CodeGenModule and into the
BlockModule. No functionality change. This should help people that
don't want to know anything about blocks not be confused by the
overloaded use of the term block or nor want to see all the blocks
goop.
Modified:
cfe/trunk/lib/CodeGen/CGBlocks.cpp
cfe/trunk/lib/CodeGen/CGBlocks.h
cfe/trunk/lib/CodeGen/CodeGenFunction.h
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=66042&r1=66041&r2=66042&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Wed Mar 4 12:17:45 2009
@@ -74,7 +74,7 @@
return C;
}
-llvm::Constant *CodeGenModule::getNSConcreteGlobalBlock() {
+llvm::Constant *BlockModule::getNSConcreteGlobalBlock() {
if (NSConcreteGlobalBlock)
return NSConcreteGlobalBlock;
@@ -92,7 +92,7 @@
return NSConcreteGlobalBlock;
}
-llvm::Constant *CodeGenModule::getNSConcreteStackBlock() {
+llvm::Constant *BlockModule::getNSConcreteStackBlock() {
if (NSConcreteStackBlock)
return NSConcreteStackBlock;
@@ -297,7 +297,7 @@
}
-const llvm::Type *CodeGenModule::getBlockDescriptorType() {
+const llvm::Type *BlockModule::getBlockDescriptorType() {
if (BlockDescriptorType)
return BlockDescriptorType;
@@ -318,8 +318,7 @@
return BlockDescriptorType;
}
-const llvm::Type *
-CodeGenModule::getGenericBlockLiteralType() {
+const llvm::Type *BlockModule::getGenericBlockLiteralType() {
if (GenericBlockLiteralType)
return GenericBlockLiteralType;
@@ -352,8 +351,7 @@
return GenericBlockLiteralType;
}
-const llvm::Type *
-CodeGenModule::getGenericExtendedBlockLiteralType() {
+const llvm::Type *BlockModule::getGenericExtendedBlockLiteralType() {
if (GenericExtendedBlockLiteralType)
return GenericExtendedBlockLiteralType;
Modified: cfe/trunk/lib/CodeGen/CGBlocks.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.h?rev=66042&r1=66041&r2=66042&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.h (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.h Wed Mar 4 12:17:45 2009
@@ -14,6 +14,32 @@
#ifndef CLANG_CODEGEN_CGBLOCKS_H
#define CLANG_CODEGEN_CGBLOCKS_H
+#include "CodeGenTypes.h"
+#include "clang/AST/Type.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallVector.h"
+#include "clang/Basic/TargetInfo.h"
+#include "clang/AST/Expr.h"
+#include "clang/AST/ExprCXX.h"
+#include "clang/AST/ExprObjC.h"
+
+#include <vector>
+#include <map>
+
+#include "CGBuilder.h"
+#include "CGCall.h"
+#include "CGValue.h"
+
+namespace llvm {
+ class Module;
+ class Constant;
+ class Function;
+ class GlobalValue;
+ class TargetData;
+ class FunctionType;
+ class Value;
+}
+
namespace clang {
namespace CodeGen {
@@ -31,6 +57,43 @@
};
class BlockModule : public BlockBase {
+ ASTContext &Context;
+ llvm::Module &TheModule;
+ CodeGenTypes &Types;
+
+ ASTContext &getContext() const { return Context; }
+ llvm::Module &getModule() const { return TheModule; }
+ CodeGenTypes &getTypes() { return Types; }
+public:
+ llvm::Constant *getNSConcreteGlobalBlock();
+ llvm::Constant *getNSConcreteStackBlock();
+ int getGlobalUniqueCount() { return ++Block.GlobalUniqueCount; }
+ const llvm::Type *getBlockDescriptorType();
+
+ const llvm::Type *getGenericBlockLiteralType();
+ const llvm::Type *getGenericExtendedBlockLiteralType();
+
+ /// NSConcreteGlobalBlock - Cached reference to the class pointer for global
+ /// blocks.
+ llvm::Constant *NSConcreteGlobalBlock;
+
+ /// NSConcreteStackBlock - Cached reference to the class poinnter for stack
+ /// blocks.
+ llvm::Constant *NSConcreteStackBlock;
+
+ const llvm::Type *BlockDescriptorType;
+ const llvm::Type *GenericBlockLiteralType;
+ const llvm::Type *GenericExtendedBlockLiteralType;
+ struct {
+ int GlobalUniqueCount;
+ } Block;
+
+ BlockModule(ASTContext &C, llvm::Module &M, CodeGenTypes &T)
+ : Context(C), TheModule(M), Types(T), NSConcreteGlobalBlock(0),
+ NSConcreteStackBlock(0), BlockDescriptorType(0),
+ GenericBlockLiteralType(0) {
+ Block.GlobalUniqueCount = 0;
+ }
};
class BlockFunction : public BlockBase {
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=66042&r1=66041&r2=66042&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Wed Mar 4 12:17:45 2009
@@ -62,7 +62,7 @@
/// CodeGenFunction - This class organizes the per-function state that is used
/// while generating LLVM code.
- class CodeGenFunction : public BlockFunction {
+class CodeGenFunction : public BlockFunction {
CodeGenFunction(const CodeGenFunction&); // DO NOT IMPLEMENT
void operator=(const CodeGenFunction&); // DO NOT IMPLEMENT
public:
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=66042&r1=66041&r2=66042&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed Mar 4 12:17:45 2009
@@ -34,10 +34,9 @@
CodeGenModule::CodeGenModule(ASTContext &C, const LangOptions &LO,
llvm::Module &M, const llvm::TargetData &TD,
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),
- NSConcreteStackBlock(0),BlockDescriptorType(0), GenericBlockLiteralType(0) {
+ : BlockModule(C, M, Types), Context(C), Features(LO), TheModule(M),
+ TheTargetData(TD), Diags(diags), Types(C, M, TD), Runtime(0),
+ MemCpyFn(0), MemMoveFn(0), MemSetFn(0), CFConstantStringClassRef(0) {
if (Features.ObjC1) {
if (Features.NeXTRuntime) {
@@ -50,8 +49,6 @@
// If debug info generation is enabled, create the CGDebugInfo object.
DebugInfo = GenerateDebugInfo ? new CGDebugInfo(this) : 0;
-
- Block.GlobalUniqueCount = 0;
}
CodeGenModule::~CodeGenModule() {
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=66042&r1=66041&r2=66042&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Wed Mar 4 12:17:45 2009
@@ -63,7 +63,7 @@
/// CodeGenModule - This class organizes the cross-function state that is used
/// while generating LLVM code.
- class CodeGenModule : public BlockModule {
+class CodeGenModule : public BlockModule {
CodeGenModule(const CodeGenModule&); // DO NOT IMPLEMENT
void operator=(const CodeGenModule&); // DO NOT IMPLEMENT
@@ -140,21 +140,6 @@
/// strings. This value has type int * but is actually an Obj-C class pointer.
llvm::Constant *CFConstantStringClassRef;
- /// NSConcreteGlobalBlock - Cached reference to the class pointer for global
- /// blocks.
- llvm::Constant *NSConcreteGlobalBlock;
-
- /// NSConcreteStackBlock - Cached reference to the class poinnter for stack
- /// blocks.
- llvm::Constant *NSConcreteStackBlock;
-
- const llvm::Type *BlockDescriptorType;
- const llvm::Type *GenericBlockLiteralType;
- const llvm::Type *GenericExtendedBlockLiteralType;
- struct {
- int GlobalUniqueCount;
- } Block;
-
std::vector<llvm::Value *> BuiltinFunctions;
public:
CodeGenModule(ASTContext &C, const LangOptions &Features, llvm::Module &M,
@@ -166,14 +151,6 @@
/// Release - Finalize LLVM code generation.
void Release();
- llvm::Constant *getNSConcreteGlobalBlock();
- llvm::Constant *getNSConcreteStackBlock();
- int getGlobalUniqueCount() { return ++Block.GlobalUniqueCount; }
- const llvm::Type *getBlockDescriptorType();
-
- const llvm::Type *getGenericBlockLiteralType();
- const llvm::Type *getGenericExtendedBlockLiteralType();
-
/// getObjCRuntime() - Return a reference to the configured
/// Objective-C runtime.
CGObjCRuntime &getObjCRuntime() {
More information about the cfe-commits
mailing list