blob: adc187819617fd2b14861c0bfd69e9c1543d295f [file] [log] [blame]
Chris Lattner4b009652007-07-25 00:24:17 +00001//===--- ModuleBuilder.cpp - Emit LLVM Code from ASTs ---------------------===//
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 builds an AST and converts it to LLVM Code.
11//
12//===----------------------------------------------------------------------===//
13
14#include "clang/CodeGen/ModuleBuilder.h"
15#include "CodeGenModule.h"
16using namespace clang;
17
18
19/// Init - Create an ModuleBuilder with the specified ASTContext.
Chris Lattner07f44dc2007-11-13 18:16:41 +000020clang::CodeGen::CodeGenModule *
Chris Lattnerdb6be562007-11-28 05:34:05 +000021clang::CodeGen::Init(ASTContext &Context, const LangOptions &Features,
22 llvm::Module &M, const llvm::TargetData &TD) {
23 return new CodeGenModule(Context, Features, M, TD);
Chris Lattner4b009652007-07-25 00:24:17 +000024}
25
Chris Lattner07f44dc2007-11-13 18:16:41 +000026void clang::CodeGen::Terminate(CodeGenModule *B) {
27 delete B;
Chris Lattner4b009652007-07-25 00:24:17 +000028}
29
30/// CodeGenFunction - Convert the AST node for a FunctionDecl into LLVM.
31///
Chris Lattner07f44dc2007-11-13 18:16:41 +000032void clang::CodeGen::CodeGenFunction(CodeGenModule *B, FunctionDecl *D) {
33 B->EmitFunction(D);
Chris Lattner4b009652007-07-25 00:24:17 +000034}
35
36/// CodeGenGlobalVar - Emit the specified global variable to LLVM.
Chris Lattner07f44dc2007-11-13 18:16:41 +000037void clang::CodeGen::CodeGenGlobalVar(CodeGenModule *Builder, FileVarDecl *D) {
38 Builder->EmitGlobalVarDeclarator(D);
Chris Lattner4b009652007-07-25 00:24:17 +000039}
40
41
42/// PrintStats - Emit statistic information to stderr.
43///
Chris Lattner07f44dc2007-11-13 18:16:41 +000044void clang::CodeGen::PrintStats(CodeGenModule *B) {
45 B->PrintStats();
Chris Lattner4b009652007-07-25 00:24:17 +000046}