comparison gen/todebug.cpp @ 156:ccd07d9f2ce9 trunk

[svn r172] moving all IR state previously stored in Dsymbol into IrDsymbol and a Dsymbol->IrDsymbol map
author ChristianK
date Thu, 01 May 2008 13:05:53 +0200
parents 7f92f477ff53
children db9890b3fb64
comparison
equal deleted inserted replaced
155:7f92f477ff53 156:ccd07d9f2ce9
112 112
113 ////////////////////////////////////////////////////////////////////////////////////////////////// 113 //////////////////////////////////////////////////////////////////////////////////////////////////
114 114
115 llvm::GlobalVariable* DtoDwarfCompileUnit(Module* m) 115 llvm::GlobalVariable* DtoDwarfCompileUnit(Module* m)
116 { 116 {
117 if (!m->irModule) 117 if (!gIR->irDsymbol[m].irModule)
118 m->irModule = new IrModule(m); 118 gIR->irDsymbol[m].irModule = new IrModule(m);
119 else if (m->irModule->dwarfCompileUnit) 119 else if (gIR->irDsymbol[m].irModule->dwarfCompileUnit)
120 { 120 {
121 if (m->irModule->dwarfCompileUnit->getParent() == gIR->module) 121 if (gIR->irDsymbol[m].irModule->dwarfCompileUnit->getParent() == gIR->module)
122 return m->irModule->dwarfCompileUnit; 122 return gIR->irDsymbol[m].irModule->dwarfCompileUnit;
123 } 123 }
124 124
125 // create a valid compile unit constant for the current module 125 // create a valid compile unit constant for the current module
126 126
127 llvm::Constant* c = NULL; 127 llvm::Constant* c = NULL;
146 c = llvm::ConstantStruct::get(GetDwarfCompileUnitType(), vals); 146 c = llvm::ConstantStruct::get(GetDwarfCompileUnitType(), vals);
147 147
148 llvm::GlobalVariable* gv = new llvm::GlobalVariable(GetDwarfCompileUnitType(), true, llvm::GlobalValue::InternalLinkage, c, "llvm.dbg.compile_unit", gIR->module); 148 llvm::GlobalVariable* gv = new llvm::GlobalVariable(GetDwarfCompileUnitType(), true, llvm::GlobalValue::InternalLinkage, c, "llvm.dbg.compile_unit", gIR->module);
149 gv->setSection("llvm.metadata"); 149 gv->setSection("llvm.metadata");
150 150
151 m->irModule->dwarfCompileUnit = gv; 151 gIR->irDsymbol[m].irModule->dwarfCompileUnit = gv;
152 return gv; 152 return gv;
153 } 153 }
154 154
155 ////////////////////////////////////////////////////////////////////////////////////////////////// 155 //////////////////////////////////////////////////////////////////////////////////////////////////
156 156
180 180
181 ////////////////////////////////////////////////////////////////////////////////////////////////// 181 //////////////////////////////////////////////////////////////////////////////////////////////////
182 182
183 void DtoDwarfFuncStart(FuncDeclaration* fd) 183 void DtoDwarfFuncStart(FuncDeclaration* fd)
184 { 184 {
185 assert(gIR->irFunc[fd]->dwarfSubProg); 185 assert(gIR->irDsymbol[fd].irFunc->dwarfSubProg);
186 gIR->ir->CreateCall(gIR->module->getFunction("llvm.dbg.func.start"), dbgToArrTy(gIR->irFunc[fd]->dwarfSubProg)); 186 gIR->ir->CreateCall(gIR->module->getFunction("llvm.dbg.func.start"), dbgToArrTy(gIR->irDsymbol[fd].irFunc->dwarfSubProg));
187 } 187 }
188 188
189 void DtoDwarfFuncEnd(FuncDeclaration* fd) 189 void DtoDwarfFuncEnd(FuncDeclaration* fd)
190 { 190 {
191 assert(gIR->irFunc[fd]->dwarfSubProg); 191 assert(gIR->irDsymbol[fd].irFunc->dwarfSubProg);
192 gIR->ir->CreateCall(gIR->module->getFunction("llvm.dbg.region.end"), dbgToArrTy(gIR->irFunc[fd]->dwarfSubProg)); 192 gIR->ir->CreateCall(gIR->module->getFunction("llvm.dbg.region.end"), dbgToArrTy(gIR->irDsymbol[fd].irFunc->dwarfSubProg));
193 } 193 }
194 194
195 ////////////////////////////////////////////////////////////////////////////////////////////////// 195 //////////////////////////////////////////////////////////////////////////////////////////////////
196 196
197 void DtoDwarfStopPoint(unsigned ln) 197 void DtoDwarfStopPoint(unsigned ln)