forked from OSchip/llvm-project
parent
7a50aa98f0
commit
bed314465a
|
@ -0,0 +1,20 @@
|
|||
//===--- CodeGenFunction.cpp - Emit LLVM Code from ASTs for a Function ----===//
|
||||
//
|
||||
// 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 coordinates the per-function state used while generating code.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "CodeGenFunction.h"
|
||||
#include "CodeGenModule.h"
|
||||
#include "llvm/Support/LLVMBuilder.h"
|
||||
using namespace llvm;
|
||||
using namespace clang;
|
||||
using namespace CodeGen;
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
//===--- CodeGenFunction.h - Per-Function state for LLVM CodeGen ----------===//
|
||||
//
|
||||
// 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-function state used for llvm translation.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef CODEGEN_CODEGENFUNCTION_H
|
||||
#define CODEGEN_CODEGENFUNCTION_H
|
||||
|
||||
namespace llvm {
|
||||
class Module;
|
||||
namespace clang {
|
||||
class ASTContext;
|
||||
class FunctionDecl;
|
||||
|
||||
namespace CodeGen {
|
||||
class CodeGenModule;
|
||||
|
||||
/// CodeGenFunction - This class organizes the per-function state that is used
|
||||
/// while generating LLVM code.
|
||||
class CodeGenFunction {
|
||||
CodeGenModule &CGM; // Per-module state.
|
||||
public:
|
||||
CodeGenFunction(CodeGenModule &cgm) : CGM(cgm) {}
|
||||
|
||||
};
|
||||
} // end namespace CodeGen
|
||||
} // end namespace clang
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
|
@ -0,0 +1,24 @@
|
|||
//===--- CodeGenModule.cpp - Emit LLVM Code from ASTs for a Module --------===//
|
||||
//
|
||||
// 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 coordinates the per-module state used while generating code.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "CodeGenModule.h"
|
||||
#include "CodeGenFunction.h"
|
||||
using namespace llvm;
|
||||
using namespace clang;
|
||||
using namespace CodeGen;
|
||||
|
||||
|
||||
void CodeGenModule::EmitFunction(FunctionDecl *FD) {
|
||||
CodeGenFunction CGF(*this);
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
//===--- Builder.h - Internal interface for LLVM Builder ------------------===//
|
||||
//===--- CodeGenModule.h - Per-Module state for LLVM CodeGen --------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -11,8 +11,8 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef CODEGEN_BUILDER_H
|
||||
#define CODEGEN_BUILDER_H
|
||||
#ifndef CODEGEN_CODEGENMODULE_H
|
||||
#define CODEGEN_CODEGENMODULE_H
|
||||
|
||||
namespace llvm {
|
||||
class Module;
|
||||
|
@ -22,16 +22,17 @@ namespace clang {
|
|||
|
||||
namespace CodeGen {
|
||||
|
||||
class Builder {
|
||||
/// CodeGenModule - This class organizes the cross-module state that is used
|
||||
/// while generating LLVM code.
|
||||
class CodeGenModule {
|
||||
ASTContext &Context;
|
||||
Module &TheModule;
|
||||
public:
|
||||
Builder(ASTContext &C, Module &M) : Context(C), TheModule(M) {}
|
||||
CodeGenModule(ASTContext &C, Module &M) : Context(C), TheModule(M) {}
|
||||
|
||||
void CodeGenFunction(FunctionDecl *FD) {}
|
||||
void EmitFunction(FunctionDecl *FD);
|
||||
|
||||
void PrintStats() {}
|
||||
|
||||
};
|
||||
} // end namespace CodeGen
|
||||
} // end namespace clang
|
|
@ -12,7 +12,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/CodeGen/ModuleBuilder.h"
|
||||
#include "Builder.h"
|
||||
#include "CodeGenModule.h"
|
||||
using namespace llvm;
|
||||
using namespace clang;
|
||||
|
||||
|
@ -20,21 +20,21 @@ using namespace clang;
|
|||
/// Init - Create an ModuleBuilder with the specified ASTContext.
|
||||
llvm::clang::CodeGen::BuilderTy *
|
||||
llvm::clang::CodeGen::Init(ASTContext &Context, Module &M) {
|
||||
return new Builder(Context, M);
|
||||
return new CodeGenModule(Context, M);
|
||||
}
|
||||
|
||||
void llvm::clang::CodeGen::Terminate(BuilderTy *B) {
|
||||
delete static_cast<Builder*>(B);
|
||||
delete static_cast<CodeGenModule*>(B);
|
||||
}
|
||||
|
||||
/// CodeGenFunction - Convert the AST node for a FunctionDecl into LLVM.
|
||||
///
|
||||
void llvm::clang::CodeGen::CodeGenFunction(BuilderTy *B, FunctionDecl *D) {
|
||||
static_cast<Builder*>(B)->CodeGenFunction(D);
|
||||
static_cast<CodeGenModule*>(B)->EmitFunction(D);
|
||||
}
|
||||
|
||||
/// PrintStats - Emit statistic information to stderr.
|
||||
///
|
||||
void llvm::clang::CodeGen::PrintStats(BuilderTy *B) {
|
||||
static_cast<Builder*>(B)->PrintStats();
|
||||
static_cast<CodeGenModule*>(B)->PrintStats();
|
||||
}
|
||||
|
|
|
@ -56,9 +56,12 @@
|
|||
DE75ED290B044DC90020CF81 /* ASTContext.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE75ED280B044DC90020CF81 /* ASTContext.h */; };
|
||||
DE75EDF10B06880E0020CF81 /* Type.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE75EDF00B06880E0020CF81 /* Type.cpp */; };
|
||||
DE927FFD0C055DE900231DA4 /* LLVMCodegen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE927FFC0C055DE900231DA4 /* LLVMCodegen.cpp */; };
|
||||
DE928B110C05658A00231DA4 /* Builder.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE928B100C05658A00231DA4 /* Builder.h */; };
|
||||
DE928B130C05659200231DA4 /* ModuleBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE928B120C05659200231DA4 /* ModuleBuilder.cpp */; };
|
||||
DE928B200C0565B000231DA4 /* ModuleBuilder.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE928B1F0C0565B000231DA4 /* ModuleBuilder.h */; };
|
||||
DE928B7D0C0A615100231DA4 /* CodeGenModule.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE928B7C0C0A615100231DA4 /* CodeGenModule.h */; };
|
||||
DE928B7F0C0A615600231DA4 /* CodeGenModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE928B7E0C0A615600231DA4 /* CodeGenModule.cpp */; };
|
||||
DE928B810C0A615B00231DA4 /* CodeGenFunction.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE928B800C0A615B00231DA4 /* CodeGenFunction.h */; };
|
||||
DE928B830C0A616000231DA4 /* CodeGenFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE928B820C0A616000231DA4 /* CodeGenFunction.cpp */; };
|
||||
DEAEE98B0A5A2B970045101B /* MultipleIncludeOpt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DEAEE98A0A5A2B970045101B /* MultipleIncludeOpt.h */; };
|
||||
DEAEED4B0A5AF89A0045101B /* NOTES.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = DEAEED4A0A5AF89A0045101B /* NOTES.txt */; };
|
||||
DEC8D9910A9433CD00353FCA /* Decl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DEC8D9900A9433CD00353FCA /* Decl.h */; };
|
||||
|
@ -100,23 +103,6 @@
|
|||
DED7D9E50A5257F6003AD0FB /* ScratchBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DED7D9E40A5257F6003AD0FB /* ScratchBuffer.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXBuildStyle section */
|
||||
84FCE23B0C08F6EF00F0C622 /* Development */ = {
|
||||
isa = PBXBuildStyle;
|
||||
buildSettings = {
|
||||
COPY_PHASE_STRIP = NO;
|
||||
};
|
||||
name = Development;
|
||||
};
|
||||
84FCE23C0C08F6EF00F0C622 /* Deployment */ = {
|
||||
isa = PBXBuildStyle;
|
||||
buildSettings = {
|
||||
COPY_PHASE_STRIP = YES;
|
||||
};
|
||||
name = Deployment;
|
||||
};
|
||||
/* End PBXBuildStyle section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
8DD76F690486A84900D96B5E /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
|
@ -168,8 +154,9 @@
|
|||
1A869A700BA2164C008DA07A /* LiteralSupport.h in CopyFiles */,
|
||||
DE67E7150C020EDF00F66BC5 /* Sema.h in CopyFiles */,
|
||||
DE67E7280C02109800F66BC5 /* ASTStreamer.h in CopyFiles */,
|
||||
DE928B110C05658A00231DA4 /* Builder.h in CopyFiles */,
|
||||
DE928B200C0565B000231DA4 /* ModuleBuilder.h in CopyFiles */,
|
||||
DE928B7D0C0A615100231DA4 /* CodeGenModule.h in CopyFiles */,
|
||||
DE928B810C0A615B00231DA4 /* CodeGenFunction.h in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
|
@ -226,9 +213,12 @@
|
|||
DE75ED280B044DC90020CF81 /* ASTContext.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ASTContext.h; path = clang/AST/ASTContext.h; sourceTree = "<group>"; };
|
||||
DE75EDF00B06880E0020CF81 /* Type.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Type.cpp; path = AST/Type.cpp; sourceTree = "<group>"; };
|
||||
DE927FFC0C055DE900231DA4 /* LLVMCodegen.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = LLVMCodegen.cpp; path = Driver/LLVMCodegen.cpp; sourceTree = "<group>"; };
|
||||
DE928B100C05658A00231DA4 /* Builder.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Builder.h; path = CodeGen/Builder.h; sourceTree = "<group>"; };
|
||||
DE928B120C05659200231DA4 /* ModuleBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ModuleBuilder.cpp; path = CodeGen/ModuleBuilder.cpp; sourceTree = "<group>"; };
|
||||
DE928B1F0C0565B000231DA4 /* ModuleBuilder.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ModuleBuilder.h; path = clang/CodeGen/ModuleBuilder.h; sourceTree = "<group>"; };
|
||||
DE928B7C0C0A615100231DA4 /* CodeGenModule.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CodeGenModule.h; path = CodeGen/CodeGenModule.h; sourceTree = "<group>"; };
|
||||
DE928B7E0C0A615600231DA4 /* CodeGenModule.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = CodeGenModule.cpp; path = CodeGen/CodeGenModule.cpp; sourceTree = "<group>"; };
|
||||
DE928B800C0A615B00231DA4 /* CodeGenFunction.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CodeGenFunction.h; path = CodeGen/CodeGenFunction.h; sourceTree = "<group>"; };
|
||||
DE928B820C0A616000231DA4 /* CodeGenFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = CodeGenFunction.cpp; path = CodeGen/CodeGenFunction.cpp; sourceTree = "<group>"; };
|
||||
DEAEE98A0A5A2B970045101B /* MultipleIncludeOpt.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MultipleIncludeOpt.h; sourceTree = "<group>"; };
|
||||
DEAEED4A0A5AF89A0045101B /* NOTES.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = NOTES.txt; sourceTree = "<group>"; };
|
||||
DEC8D9900A9433CD00353FCA /* Decl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Decl.h; path = clang/AST/Decl.h; sourceTree = "<group>"; };
|
||||
|
@ -376,7 +366,10 @@
|
|||
DE927FCC0C0557CD00231DA4 /* CodeGen */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DE928B100C05658A00231DA4 /* Builder.h */,
|
||||
DE928B800C0A615B00231DA4 /* CodeGenFunction.h */,
|
||||
DE928B820C0A616000231DA4 /* CodeGenFunction.cpp */,
|
||||
DE928B7C0C0A615100231DA4 /* CodeGenModule.h */,
|
||||
DE928B7E0C0A615600231DA4 /* CodeGenModule.cpp */,
|
||||
DE928B120C05659200231DA4 /* ModuleBuilder.cpp */,
|
||||
);
|
||||
name = CodeGen;
|
||||
|
@ -545,12 +538,6 @@
|
|||
08FB7793FE84155DC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
|
||||
buildSettings = {
|
||||
};
|
||||
buildStyles = (
|
||||
84FCE23B0C08F6EF00F0C622 /* Development */,
|
||||
84FCE23C0C08F6EF00F0C622 /* Deployment */,
|
||||
);
|
||||
hasScannedForEncodings = 1;
|
||||
mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
|
||||
projectDirPath = "";
|
||||
|
@ -610,6 +597,8 @@
|
|||
DE06756C0C051CFE00EBBFD8 /* ParseExprCXX.cpp in Sources */,
|
||||
DE927FFD0C055DE900231DA4 /* LLVMCodegen.cpp in Sources */,
|
||||
DE928B130C05659200231DA4 /* ModuleBuilder.cpp in Sources */,
|
||||
DE928B7F0C0A615600231DA4 /* CodeGenModule.cpp in Sources */,
|
||||
DE928B830C0A616000231DA4 /* CodeGenFunction.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue