summaryrefslogtreecommitdiffstats
path: root/clang/CodeGen/ModuleBuilder.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-05-24 06:29:05 +0000
committerChris Lattner <sabre@nondot.org>2007-05-24 06:29:05 +0000
commitf97fe38cb554dc2c1c13d426ec5cb06cf5673072 (patch)
treeadf8048e5c8ba0da78e230f675b764af8ee6f344 /clang/CodeGen/ModuleBuilder.cpp
parent6d4024ae6b60f97910dc75b5f6efde3caf2b89e7 (diff)
downloadbcm5719-llvm-f97fe38cb554dc2c1c13d426ec5cb06cf5673072.tar.gz
bcm5719-llvm-f97fe38cb554dc2c1c13d426ec5cb06cf5673072.zip
Initial scaffolding for an -emit-llvm mode. This requires the LLVM VMCore
library to be built for the driver to link. llvm-svn: 39495
Diffstat (limited to 'clang/CodeGen/ModuleBuilder.cpp')
-rw-r--r--clang/CodeGen/ModuleBuilder.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/clang/CodeGen/ModuleBuilder.cpp b/clang/CodeGen/ModuleBuilder.cpp
new file mode 100644
index 00000000000..309a35762a2
--- /dev/null
+++ b/clang/CodeGen/ModuleBuilder.cpp
@@ -0,0 +1,40 @@
+//===--- ModuleBuilder.cpp - Emit LLVM Code from ASTs ---------------------===//
+//
+// 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 builds an AST and converts it to LLVM Code.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/CodeGen/ModuleBuilder.h"
+#include "Builder.h"
+using namespace llvm;
+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);
+}
+
+void llvm::clang::CodeGen::Terminate(BuilderTy *B) {
+ delete static_cast<Builder*>(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);
+}
+
+/// PrintStats - Emit statistic information to stderr.
+///
+void llvm::clang::CodeGen::PrintStats(BuilderTy *B) {
+ static_cast<Builder*>(B)->PrintStats();
+}
OpenPOWER on IntegriCloud