Chris Lattner | bed3144 | 2007-05-28 01:07:47 +0000 | [diff] [blame] | 1 | //===--- CodeGenFunction.h - Per-Function 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-function state used for llvm translation. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef CODEGEN_CODEGENFUNCTION_H |
| 15 | #define CODEGEN_CODEGENFUNCTION_H |
| 16 | |
Chris Lattner | 308f431 | 2007-05-29 23:50:05 +0000 | [diff] [blame^] | 17 | #include "llvm/Support/LLVMBuilder.h" |
| 18 | |
Chris Lattner | bed3144 | 2007-05-28 01:07:47 +0000 | [diff] [blame] | 19 | namespace llvm { |
| 20 | class Module; |
| 21 | namespace clang { |
| 22 | class ASTContext; |
| 23 | class FunctionDecl; |
Chris Lattner | d1af2d2 | 2007-05-29 23:17:50 +0000 | [diff] [blame] | 24 | class QualType; |
| 25 | class SourceLocation; |
| 26 | class TargetInfo; |
Chris Lattner | 308f431 | 2007-05-29 23:50:05 +0000 | [diff] [blame^] | 27 | class Stmt; |
| 28 | class CompoundStmt; |
Chris Lattner | bed3144 | 2007-05-28 01:07:47 +0000 | [diff] [blame] | 29 | |
| 30 | namespace CodeGen { |
| 31 | class CodeGenModule; |
| 32 | |
| 33 | /// CodeGenFunction - This class organizes the per-function state that is used |
| 34 | /// while generating LLVM code. |
| 35 | class CodeGenFunction { |
| 36 | CodeGenModule &CGM; // Per-module state. |
Chris Lattner | d1af2d2 | 2007-05-29 23:17:50 +0000 | [diff] [blame] | 37 | TargetInfo &Target; |
Chris Lattner | 308f431 | 2007-05-29 23:50:05 +0000 | [diff] [blame^] | 38 | LLVMBuilder Builder; |
Chris Lattner | bed3144 | 2007-05-28 01:07:47 +0000 | [diff] [blame] | 39 | public: |
Chris Lattner | d1af2d2 | 2007-05-29 23:17:50 +0000 | [diff] [blame] | 40 | CodeGenFunction(CodeGenModule &cgm); |
Chris Lattner | bed3144 | 2007-05-28 01:07:47 +0000 | [diff] [blame] | 41 | |
Chris Lattner | d1af2d2 | 2007-05-29 23:17:50 +0000 | [diff] [blame] | 42 | const llvm::Type *ConvertType(QualType T, SourceLocation Loc); |
| 43 | |
Chris Lattner | 308f431 | 2007-05-29 23:50:05 +0000 | [diff] [blame^] | 44 | void GenerateCode(const FunctionDecl *FD); |
| 45 | |
| 46 | //===--------------------------------------------------------------------===// |
| 47 | // Statement Emission |
| 48 | //===--------------------------------------------------------------------===// |
| 49 | |
| 50 | void EmitStmt(const Stmt *S); |
| 51 | void EmitCompoundStmt(const CompoundStmt &S); |
Chris Lattner | bed3144 | 2007-05-28 01:07:47 +0000 | [diff] [blame] | 52 | }; |
| 53 | } // end namespace CodeGen |
| 54 | } // end namespace clang |
| 55 | } // end namespace llvm |
| 56 | |
| 57 | #endif |