comparison gen/toobj.c @ 18:c05ef76f1c20 trunk

[svn r22] * Forgot to add std.stdio
author lindquist
date Thu, 04 Oct 2007 01:47:53 +0200
parents 6c6cd097bcdf
children 8d45266bbabe
comparison
equal deleted inserted replaced
17:6c6cd097bcdf 18:c05ef76f1c20
32 #include "init.h" 32 #include "init.h"
33 #include "attrib.h" 33 #include "attrib.h"
34 #include "id.h" 34 #include "id.h"
35 #include "import.h" 35 #include "import.h"
36 #include "template.h" 36 #include "template.h"
37 #include "scope.h"
37 38
38 #include "gen/irstate.h" 39 #include "gen/irstate.h"
39 #include "gen/elem.h" 40 #include "gen/elem.h"
40 #include "gen/logger.h" 41 #include "gen/logger.h"
41 #include "gen/tollvm.h" 42 #include "gen/tollvm.h"
49 LOG_SCOPE; 50 LOG_SCOPE;
50 51
51 // start by deleting the old object file 52 // start by deleting the old object file
52 deleteObjFile(); 53 deleteObjFile();
53 54
54 // creaet a new ir state 55 // create a new ir state
55 IRState ir; 56 IRState ir;
56 gIR = &ir; 57 gIR = &ir;
57 ir.dmodule = this; 58 ir.dmodule = this;
58 59
59 // name the module 60 // name the module
83 // emit the llvm main function if necessary 84 // emit the llvm main function if necessary
84 if (ir.emitMain) { 85 if (ir.emitMain) {
85 LLVM_DtoMain(); 86 LLVM_DtoMain();
86 } 87 }
87 88
88 /*
89 // verify the llvm 89 // verify the llvm
90 std::string verifyErr; 90 std::string verifyErr;
91 Logger::println("Verifying module..."); 91 Logger::println("Verifying module...");
92 if (llvm::verifyModule(*ir.module,llvm::ReturnStatusAction,&verifyErr)) 92 if (llvm::verifyModule(*ir.module,llvm::ReturnStatusAction,&verifyErr))
93 { 93 {
94 error("%s", verifyErr.c_str()); 94 error("%s", verifyErr.c_str());
95 fatal(); 95 fatal();
96 } 96 }
97 else 97 else
98 Logger::println("Verification passed!"); 98 Logger::println("Verification passed!");
99 */
100 99
101 // run passes 100 // run passes
102 // TODO 101 // TODO
103 102
104 /*if (global.params.llvmLL) { 103 /*if (global.params.llvmLL) {
606 605
607 /* ================================================================== */ 606 /* ================================================================== */
608 607
609 void FuncDeclaration::toObjFile() 608 void FuncDeclaration::toObjFile()
610 { 609 {
611 if (llvmDModule == gIR->dmodule) { 610 if (llvmDModule) {
612 assert(llvmValue != 0); 611 assert(llvmValue != 0);
613 return; 612 return;
614 } 613 }
615 614
616 llvm::Function* func = LLVM_DtoDeclareFunction(this); 615 llvm::Function* func = LLVM_DtoDeclareFunction(this);