[llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp
Alkis Evlogimenos
alkis at cs.uiuc.edu
Wed Sep 29 09:15:17 PDT 2004
Changes in directory llvm-java/lib/Compiler:
Compiler.cpp updated: 1.115 -> 1.116
---
Log message:
Create a new module every time a class is compiled. This module will
have bytecode for all classes references in the transitive closure of
the callgraph starting on this class static main() method.
---
Diffs of the changes: (+7 -5)
Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.115 llvm-java/lib/Compiler/Compiler.cpp:1.116
--- llvm-java/lib/Compiler/Compiler.cpp:1.115 Wed Sep 29 10:27:24 2004
+++ llvm-java/lib/Compiler/Compiler.cpp Wed Sep 29 11:15:06 2004
@@ -130,9 +130,8 @@
}
};
- struct CompilerImpl :
+ class CompilerImpl :
public BytecodeParser<CompilerImpl> {
- private:
Module* module_;
ClassFile* cf_;
OperandStack opStack_;
@@ -1525,13 +1524,15 @@
delete compilerImpl_;
}
-void Compiler::compile(Module& m, const std::string& className)
+std::auto_ptr<Module> Compiler::compile(const std::string& className)
{
DEBUG(std::cerr << "Compiling class: " << className << '\n');
+ std::auto_ptr<Module> m(new Module(className));
+
Function* main =
- compilerImpl_->compileMethod(m, className + "/main([Ljava/lang/String;)V");
- Function* javaMain = m.getOrInsertFunction
+ compilerImpl_->compileMethod(*m, className + "/main([Ljava/lang/String;)V");
+ Function* javaMain = m->getOrInsertFunction
("llvm_java_main", Type::VoidTy,
Type::IntTy, PointerType::get(PointerType::get(Type::SByteTy)), NULL);
@@ -1543,4 +1544,5 @@
"",
bb);
new ReturnInst(NULL, bb);
+ return m;
}
More information about the llvm-commits
mailing list