2007-05-28 09:07:47 +08:00
|
|
|
//===--- CodeGenModule.h - Per-Module state for LLVM CodeGen --------------===//
|
2007-05-24 14:29:05 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by Chris Lattner and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This is the internal per-translation-unit state used for llvm translation.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2007-05-28 09:07:47 +08:00
|
|
|
#ifndef CODEGEN_CODEGENMODULE_H
|
|
|
|
#define CODEGEN_CODEGENMODULE_H
|
2007-05-24 14:29:05 +08:00
|
|
|
|
2007-06-16 08:16:26 +08:00
|
|
|
#include "CodeGenTypes.h"
|
2007-06-20 12:44:43 +08:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2007-06-16 08:16:26 +08:00
|
|
|
|
2007-05-24 14:29:05 +08:00
|
|
|
namespace llvm {
|
|
|
|
class Module;
|
2007-06-16 08:12:05 +08:00
|
|
|
class Constant;
|
2007-06-23 02:48:09 +08:00
|
|
|
class Function;
|
2007-06-16 07:05:46 +08:00
|
|
|
}
|
|
|
|
|
2007-05-24 14:29:05 +08:00
|
|
|
namespace clang {
|
|
|
|
class ASTContext;
|
|
|
|
class FunctionDecl;
|
2007-06-16 08:12:05 +08:00
|
|
|
class Decl;
|
2007-07-13 13:13:43 +08:00
|
|
|
class FileVarDecl;
|
2007-05-24 14:29:05 +08:00
|
|
|
|
|
|
|
namespace CodeGen {
|
|
|
|
|
2007-05-28 09:07:47 +08:00
|
|
|
/// CodeGenModule - This class organizes the cross-module state that is used
|
|
|
|
/// while generating LLVM code.
|
|
|
|
class CodeGenModule {
|
2007-05-24 14:29:05 +08:00
|
|
|
ASTContext &Context;
|
2007-06-16 07:05:46 +08:00
|
|
|
llvm::Module &TheModule;
|
2007-06-16 08:16:26 +08:00
|
|
|
CodeGenTypes Types;
|
|
|
|
|
2007-06-23 02:48:09 +08:00
|
|
|
llvm::Function *MemCpyFn;
|
2007-06-20 12:44:43 +08:00
|
|
|
llvm::DenseMap<const Decl*, llvm::Constant*> GlobalDeclMap;
|
2007-05-24 14:29:05 +08:00
|
|
|
public:
|
2007-06-16 08:16:26 +08:00
|
|
|
CodeGenModule(ASTContext &C, llvm::Module &M);
|
2007-05-24 14:29:05 +08:00
|
|
|
|
2007-05-30 07:17:50 +08:00
|
|
|
ASTContext &getContext() const { return Context; }
|
2007-06-16 07:05:46 +08:00
|
|
|
llvm::Module &getModule() const { return TheModule; }
|
2007-06-16 08:16:26 +08:00
|
|
|
CodeGenTypes &getTypes() { return Types; }
|
2007-05-30 07:17:50 +08:00
|
|
|
|
2007-06-20 12:44:43 +08:00
|
|
|
llvm::Constant *GetAddrOfGlobalDecl(const Decl *D);
|
|
|
|
|
2007-06-23 02:48:09 +08:00
|
|
|
llvm::Function *getMemCpyFn();
|
|
|
|
|
2007-07-13 13:13:43 +08:00
|
|
|
void EmitFunction(const FunctionDecl *FD);
|
|
|
|
void EmitGlobalVar(const FileVarDecl *D);
|
2007-07-14 08:16:50 +08:00
|
|
|
void EmitGlobalVarDeclarator(const FileVarDecl *D);
|
2007-05-24 14:29:05 +08:00
|
|
|
|
|
|
|
void PrintStats() {}
|
|
|
|
};
|
|
|
|
} // end namespace CodeGen
|
|
|
|
} // end namespace clang
|
|
|
|
|
|
|
|
#endif
|