blob: 51f9e1bb51ad5091ff05f862533eb8143f8f7939 [file] [log] [blame]
Chris Lattnerbed31442007-05-28 01:07:47 +00001//===--- 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 Lattner308f4312007-05-29 23:50:05 +000017#include "llvm/Support/LLVMBuilder.h"
18
Chris Lattnerbed31442007-05-28 01:07:47 +000019namespace llvm {
20 class Module;
21namespace clang {
22 class ASTContext;
23 class FunctionDecl;
Chris Lattnerd1af2d22007-05-29 23:17:50 +000024 class QualType;
25 class SourceLocation;
26 class TargetInfo;
Chris Lattner308f4312007-05-29 23:50:05 +000027 class Stmt;
28 class CompoundStmt;
Chris Lattnerbed31442007-05-28 01:07:47 +000029
30namespace CodeGen {
31 class CodeGenModule;
32
33/// CodeGenFunction - This class organizes the per-function state that is used
34/// while generating LLVM code.
35class CodeGenFunction {
36 CodeGenModule &CGM; // Per-module state.
Chris Lattnerd1af2d22007-05-29 23:17:50 +000037 TargetInfo &Target;
Chris Lattner308f4312007-05-29 23:50:05 +000038 LLVMBuilder Builder;
Chris Lattnerbed31442007-05-28 01:07:47 +000039public:
Chris Lattnerd1af2d22007-05-29 23:17:50 +000040 CodeGenFunction(CodeGenModule &cgm);
Chris Lattnerbed31442007-05-28 01:07:47 +000041
Chris Lattnerd1af2d22007-05-29 23:17:50 +000042 const llvm::Type *ConvertType(QualType T, SourceLocation Loc);
43
Chris Lattner308f4312007-05-29 23:50:05 +000044 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 Lattnerbed31442007-05-28 01:07:47 +000052};
53} // end namespace CodeGen
54} // end namespace clang
55} // end namespace llvm
56
57#endif