blob: 49881c36d9405a3001a50c00545cb6166d5174e6 [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//
Chris Lattner959e5be2007-12-29 19:59:25 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Chris Lattner4b009652007-07-25 00:24:17 +00007//
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,
Chris Lattner22595b82007-12-02 01:40:18 +000022 llvm::Module &M, const llvm::TargetData &TD,
23 Diagnostic &Diags) {
24 return new CodeGenModule(Context, Features, M, TD, Diags);
Chris Lattner4b009652007-07-25 00:24:17 +000025}
26
Chris Lattner07f44dc2007-11-13 18:16:41 +000027void clang::CodeGen::Terminate(CodeGenModule *B) {
28 delete B;
Chris Lattner4b009652007-07-25 00:24:17 +000029}
30
31/// CodeGenFunction - Convert the AST node for a FunctionDecl into LLVM.
32///
Chris Lattner07f44dc2007-11-13 18:16:41 +000033void clang::CodeGen::CodeGenFunction(CodeGenModule *B, FunctionDecl *D) {
34 B->EmitFunction(D);
Chris Lattner4b009652007-07-25 00:24:17 +000035}
36
37/// CodeGenGlobalVar - Emit the specified global variable to LLVM.
Chris Lattner07f44dc2007-11-13 18:16:41 +000038void clang::CodeGen::CodeGenGlobalVar(CodeGenModule *Builder, FileVarDecl *D) {
39 Builder->EmitGlobalVarDeclarator(D);
Chris Lattner4b009652007-07-25 00:24:17 +000040}
41
42
43/// PrintStats - Emit statistic information to stderr.
44///
Chris Lattner07f44dc2007-11-13 18:16:41 +000045void clang::CodeGen::PrintStats(CodeGenModule *B) {
46 B->PrintStats();
Chris Lattner4b009652007-07-25 00:24:17 +000047}