}
llvm::Constant *
-CodeGenModule::GetAddrOfGlobalBlock(const BlockExpr *BE, const char * n) {
+BlockModule::GetAddrOfGlobalBlock(const BlockExpr *BE, const char * n) {
// Generate the block descriptor.
const llvm::Type *UnsignedLongTy = Types.ConvertType(Context.UnsignedLongTy);
const llvm::IntegerType *IntTy = cast<llvm::IntegerType>(
uint64_t subBlockSize, subBlockAlign;
llvm::SmallVector<const Expr *, 8> subBlockDeclRefDecls;
llvm::Function *Fn
- = CodeGenFunction(*this).GenerateBlockFunction(BE, Info, subBlockSize,
- subBlockAlign,
- subBlockDeclRefDecls);
+ = CodeGenFunction(CGM).GenerateBlockFunction(BE, Info, subBlockSize,
+ subBlockAlign,
+ subBlockDeclRefDecls);
assert(subBlockSize == BlockLiteralSize
&& "no imports allowed for global block");
namespace clang {
namespace CodeGen {
+class CodeGenModule;
class BlockBase {
public:
class BlockModule : public BlockBase {
ASTContext &Context;
llvm::Module &TheModule;
+ const llvm::TargetData &TheTargetData;
CodeGenTypes &Types;
+ CodeGenModule &CGM;
ASTContext &getContext() const { return Context; }
llvm::Module &getModule() const { return TheModule; }
CodeGenTypes &getTypes() { return Types; }
+ const llvm::TargetData &getTargetData() const { return TheTargetData; }
public:
llvm::Constant *getNSConcreteGlobalBlock();
llvm::Constant *getNSConcreteStackBlock();
const llvm::Type *getGenericBlockLiteralType();
const llvm::Type *getGenericExtendedBlockLiteralType();
+ llvm::Constant *GetAddrOfGlobalBlock(const BlockExpr *BE, const char *);
+
/// NSConcreteGlobalBlock - Cached reference to the class pointer for global
/// blocks.
llvm::Constant *NSConcreteGlobalBlock;
int GlobalUniqueCount;
} Block;
- BlockModule(ASTContext &C, llvm::Module &M, CodeGenTypes &T)
- : Context(C), TheModule(M), Types(T), NSConcreteGlobalBlock(0),
- NSConcreteStackBlock(0), BlockDescriptorType(0),
+ BlockModule(ASTContext &C, llvm::Module &M, const llvm::TargetData &TD,
+ CodeGenTypes &T, CodeGenModule &CodeGen)
+ : Context(C), TheModule(M), TheTargetData(TD), Types(T),
+ CGM(CodeGen),
+ NSConcreteGlobalBlock(0), NSConcreteStackBlock(0), BlockDescriptorType(0),
GenericBlockLiteralType(0) {
Block.GlobalUniqueCount = 0;
}
CodeGenModule::CodeGenModule(ASTContext &C, const LangOptions &LO,
llvm::Module &M, const llvm::TargetData &TD,
Diagnostic &diags, bool GenerateDebugInfo)
- : BlockModule(C, M, Types), Context(C), Features(LO), TheModule(M),
+ : BlockModule(C, M, TD, Types, *this), Context(C), Features(LO), TheModule(M),
TheTargetData(TD), Diags(diags), Types(C, M, TD), Runtime(0),
MemCpyFn(0), MemMoveFn(0), MemSetFn(0), CFConstantStringClassRef(0) {
llvm::Constant *GetAddrOfConstantCString(const std::string &str,
const char *GlobalName=0);
- llvm::Constant *GetAddrOfGlobalBlock(const BlockExpr *BE, const char *);
-
/// getBuiltinLibFunction - Given a builtin id for a function like
/// "__builtin_fabsf", return a Function* for "fabsf".
llvm::Value *getBuiltinLibFunction(unsigned BuiltinID);