[cfe-commits] r39661 - in /cfe/cfe/trunk/CodeGen: CodeGenFunction.cpp CodeGenFunction.h CodeGenModule.cpp CodeGenModule.h
clattner at cs.uiuc.edu
clattner at cs.uiuc.edu
Wed Jul 11 09:46:51 PDT 2007
Author: clattner
Date: Wed Jul 11 11:46:51 2007
New Revision: 39661
URL: http://llvm.org/viewvc/llvm-project?rev=39661&view=rev
Log:
Refactor CodeGenTypes out to CodeGenModule so it can be used for functions
and globals.
Modified:
cfe/cfe/trunk/CodeGen/CodeGenFunction.cpp
cfe/cfe/trunk/CodeGen/CodeGenFunction.h
cfe/cfe/trunk/CodeGen/CodeGenModule.cpp
cfe/cfe/trunk/CodeGen/CodeGenModule.h
Modified: cfe/cfe/trunk/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/CodeGen/CodeGenFunction.cpp?rev=39661&r1=39660&r2=39661&view=diff
==============================================================================
--- cfe/cfe/trunk/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/cfe/trunk/CodeGen/CodeGenFunction.cpp Wed Jul 11 11:46:51 2007
@@ -23,7 +23,7 @@
using namespace CodeGen;
CodeGenFunction::CodeGenFunction(CodeGenModule &cgm)
- : CGM(cgm), Target(CGM.getContext().Target), Types(Target) {}
+ : CGM(cgm), Target(CGM.getContext().Target) {}
ASTContext &CodeGenFunction::getContext() const {
return CGM.getContext();
@@ -40,7 +40,7 @@
const llvm::Type *CodeGenFunction::ConvertType(QualType T, SourceLocation Loc) {
- return Types.ConvertType(T, Loc);
+ return CGM.getTypes().ConvertType(T, Loc);
}
void CodeGenFunction::GenerateCode(const FunctionDecl *FD) {
Modified: cfe/cfe/trunk/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/CodeGen/CodeGenFunction.h?rev=39661&r1=39660&r2=39661&view=diff
==============================================================================
--- cfe/cfe/trunk/CodeGen/CodeGenFunction.h (original)
+++ cfe/cfe/trunk/CodeGen/CodeGenFunction.h Wed Jul 11 11:46:51 2007
@@ -16,7 +16,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/LLVMBuilder.h"
-#include "CodeGenTypes.h"
+#include <vector>
namespace llvm {
class Module;
@@ -26,6 +26,10 @@
class ASTContext;
class Decl;
class FunctionDecl;
+ class TargetInfo;
+ class SourceLocation;
+ class QualType;
+ class FunctionTypeProto;
class Stmt;
class CompoundStmt;
@@ -121,7 +125,6 @@
CodeGenModule &CGM; // Per-module state.
TargetInfo &Target;
llvm::LLVMBuilder Builder;
- CodeGenTypes Types;
const FunctionDecl *CurFuncDecl;
llvm::Function *CurFn;
Modified: cfe/cfe/trunk/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/CodeGen/CodeGenModule.cpp?rev=39661&r1=39660&r2=39661&view=diff
==============================================================================
--- cfe/cfe/trunk/CodeGen/CodeGenModule.cpp (original)
+++ cfe/cfe/trunk/CodeGen/CodeGenModule.cpp Wed Jul 11 11:46:51 2007
@@ -13,11 +13,15 @@
#include "CodeGenModule.h"
#include "CodeGenFunction.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
using namespace clang;
using namespace CodeGen;
+CodeGenModule::CodeGenModule(ASTContext &C, llvm::Module &M)
+ : Context(C), TheModule(M), Types(C.Target) {}
+
void CodeGenModule::EmitFunction(FunctionDecl *FD) {
// If this is not a prototype, emit the body.
if (FD->getBody())
Modified: cfe/cfe/trunk/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/CodeGen/CodeGenModule.h?rev=39661&r1=39660&r2=39661&view=diff
==============================================================================
--- cfe/cfe/trunk/CodeGen/CodeGenModule.h (original)
+++ cfe/cfe/trunk/CodeGen/CodeGenModule.h Wed Jul 11 11:46:51 2007
@@ -14,6 +14,8 @@
#ifndef CODEGEN_CODEGENMODULE_H
#define CODEGEN_CODEGENMODULE_H
+#include "CodeGenTypes.h"
+
namespace llvm {
class Module;
class Constant;
@@ -31,13 +33,15 @@
class CodeGenModule {
ASTContext &Context;
llvm::Module &TheModule;
-
+ CodeGenTypes Types;
+
//llvm::DenseMap<const Decl*, llvm::Constant*> GlobalDeclMap;
public:
- CodeGenModule(ASTContext &C, llvm::Module &M) : Context(C), TheModule(M) {}
+ CodeGenModule(ASTContext &C, llvm::Module &M);
ASTContext &getContext() const { return Context; }
llvm::Module &getModule() const { return TheModule; }
+ CodeGenTypes &getTypes() { return Types; }
void EmitFunction(FunctionDecl *FD);
More information about the cfe-commits
mailing list