comparison gen/toobj.cpp @ 139:0ab29b838084 trunk

[svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :) Fixed: tango.io.Console seems to be working now.
author lindquist
date Tue, 22 Jan 2008 00:01:16 +0100
parents ce7b81fb957f
children 4c577c2b7229
comparison
equal deleted inserted replaced
138:aeddd4d533b3 139:0ab29b838084
40 #include "gen/functions.h" 40 #include "gen/functions.h"
41 #include "gen/todebug.h" 41 #include "gen/todebug.h"
42 #include "gen/runtime.h" 42 #include "gen/runtime.h"
43 43
44 #include "ir/irvar.h" 44 #include "ir/irvar.h"
45 #include "ir/irmodule.h"
45 46
46 ////////////////////////////////////////////////////////////////////////////////////////// 47 //////////////////////////////////////////////////////////////////////////////////////////
47 48
48 // in gen/optimize.cpp 49 // in gen/optimize.cpp
49 void llvmdc_optimize_module(llvm::Module* m, char lvl, bool doinline); 50 void llvmdc_optimize_module(llvm::Module* m, char lvl, bool doinline);
57 58
58 // start by deleting the old object file 59 // start by deleting the old object file
59 deleteObjFile(); 60 deleteObjFile();
60 61
61 // create a new ir state 62 // create a new ir state
63 // TODO look at making the instance static and moving most functionality into IrModule where it belongs
62 IRState ir; 64 IRState ir;
63 gIR = &ir; 65 gIR = &ir;
64 ir.dmodule = this; 66 ir.dmodule = this;
67
68 // module ir state
69 // might already exist via import, just overwrite...
70 irModule = new IrModule(this);
65 71
66 // name the module 72 // name the module
67 std::string mname(toChars()); 73 std::string mname(toChars());
68 if (md != 0) 74 if (md != 0)
69 mname = md->toChars(); 75 mname = md->toChars();
86 gTargetData = targetMachine.getTargetData(); 92 gTargetData = targetMachine.getTargetData();
87 93
88 // debug info 94 // debug info
89 if (global.params.symdebug) { 95 if (global.params.symdebug) {
90 RegisterDwarfSymbols(ir.module); 96 RegisterDwarfSymbols(ir.module);
91 ir.dmodule->llvmCompileUnit = DtoDwarfCompileUnit(this,true); 97 DtoDwarfCompileUnit(this);
92 } 98 }
93 99
94 // start out by providing opaque for the built-in class types 100 // start out by providing opaque for the built-in class types
95 if (!ClassDeclaration::object->type->llvmType) 101 if (!ClassDeclaration::object->type->llvmType)
96 ClassDeclaration::object->type->llvmType = new llvm::PATypeHolder(llvm::OpaqueType::get()); 102 ClassDeclaration::object->type->llvmType = new llvm::PATypeHolder(llvm::OpaqueType::get());