Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1 | //===--- CodeGenModule.h - Per-Module state for LLVM CodeGen --------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by Chris Lattner and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This is the internal per-translation-unit state used for llvm translation. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef CODEGEN_CODEGENMODULE_H |
| 15 | #define CODEGEN_CODEGENMODULE_H |
| 16 | |
| 17 | #include "CodeGenTypes.h" |
| 18 | #include "llvm/ADT/DenseMap.h" |
| 19 | |
| 20 | namespace llvm { |
| 21 | class Module; |
| 22 | class Constant; |
| 23 | class Function; |
| 24 | } |
| 25 | |
| 26 | namespace clang { |
| 27 | class ASTContext; |
| 28 | class FunctionDecl; |
| 29 | class Decl; |
Chris Lattner | 88a69ad | 2007-07-13 05:13:43 +0000 | [diff] [blame] | 30 | class FileVarDecl; |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 31 | |
| 32 | namespace CodeGen { |
| 33 | |
| 34 | /// CodeGenModule - This class organizes the cross-module state that is used |
| 35 | /// while generating LLVM code. |
| 36 | class CodeGenModule { |
| 37 | ASTContext &Context; |
| 38 | llvm::Module &TheModule; |
| 39 | CodeGenTypes Types; |
| 40 | |
| 41 | llvm::Function *MemCpyFn; |
| 42 | llvm::DenseMap<const Decl*, llvm::Constant*> GlobalDeclMap; |
| 43 | public: |
| 44 | CodeGenModule(ASTContext &C, llvm::Module &M); |
| 45 | |
| 46 | ASTContext &getContext() const { return Context; } |
| 47 | llvm::Module &getModule() const { return TheModule; } |
| 48 | CodeGenTypes &getTypes() { return Types; } |
| 49 | |
| 50 | llvm::Constant *GetAddrOfGlobalDecl(const Decl *D); |
| 51 | |
| 52 | llvm::Function *getMemCpyFn(); |
| 53 | |
Chris Lattner | 88a69ad | 2007-07-13 05:13:43 +0000 | [diff] [blame] | 54 | void EmitFunction(const FunctionDecl *FD); |
| 55 | void EmitGlobalVar(const FileVarDecl *D); |
Chris Lattner | 32b266c | 2007-07-14 00:16:50 +0000 | [diff] [blame^] | 56 | void EmitGlobalVarDeclarator(const FileVarDecl *D); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 57 | |
| 58 | void PrintStats() {} |
| 59 | }; |
| 60 | } // end namespace CodeGen |
| 61 | } // end namespace clang |
| 62 | |
| 63 | #endif |