annotate gen/todebug.cpp @ 245:d61ce72c39ab trunk

[svn r262] Fixed debug info for normal function parameters. Fixed debug info for pointers to basic types.
author lindquist
date Mon, 09 Jun 2008 12:43:16 +0200
parents a95056b3c996
children b604c56945b0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
1 #include "gen/llvm.h"
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
2 #include "llvm/Support/Dwarf.h"
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
3 #include "llvm/CodeGen/MachineModuleInfo.h"
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
4
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
5 #include "declaration.h"
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
6 #include "module.h"
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
7 #include "mars.h"
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
8
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
9 #include "gen/todebug.h"
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
10 #include "gen/irstate.h"
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
11 #include "gen/tollvm.h"
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
12 #include "gen/logger.h"
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
13
139
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
14 #include "ir/irmodule.h"
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
15
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
16 using namespace llvm::dwarf;
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
17
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 173
diff changeset
18 static const llvm::PointerType* ptrTy(const LLType* t)
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
19 {
133
44a95ac7368a [svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents: 131
diff changeset
20 return llvm::PointerType::get(t, 0);
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
21 }
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
22
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
23 static const llvm::PointerType* dbgArrTy()
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
24 {
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
25 return ptrTy(llvm::StructType::get(NULL,NULL));
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
26 }
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
27
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 173
diff changeset
28 static LLConstant* dbgToArrTy(LLConstant* c)
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
29 {
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
30 return llvm::ConstantExpr::getBitCast(c, dbgArrTy());
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
31 }
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
32
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
33 #define Ty(X) LLType::X
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
34
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
35 //////////////////////////////////////////////////////////////////////////////////////////////////
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
36
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
37 static llvm::GlobalVariable* dbg_compile_units = 0;
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
38 static llvm::GlobalVariable* dbg_global_variables = 0;
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
39 static llvm::GlobalVariable* dbg_subprograms = 0;
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
40
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
41 const llvm::StructType* GetDwarfAnchorType()
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
42 {
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
43 /*
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
44 %llvm.dbg.anchor.type = type {
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
45 uint, ;; Tag = 0 + LLVMDebugVersion
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
46 uint ;; Tag of descriptors grouped by the anchor
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
47 }
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
48 */
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
49
96
ce7ed8f59b99 [svn r100] Moved test/ray.d to demos/ray.d.
lindquist
parents: 94
diff changeset
50 const llvm::StructType* t = isaStruct(gIR->module->getTypeByName("llvm.dbg.anchor.type"));
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
51
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
52 /*
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
53 %llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { uint 0, uint 17 } ;; DW_TAG_compile_unit
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
54 %llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type { uint 0, uint 52 } ;; DW_TAG_variable
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
55 %llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { uint 0, uint 46 } ;; DW_TAG_subprogram
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
56 */
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
57 if (!gIR->module->getNamedGlobal("llvm.dbg.compile_units")) {
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 173
diff changeset
58 std::vector<LLConstant*> vals;
94
61615fa85940 [svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents: 86
diff changeset
59 vals.push_back(DtoConstUint(llvm::LLVMDebugVersion));
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
60 vals.push_back(DtoConstUint(DW_TAG_compile_unit));
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 173
diff changeset
61 LLConstant* i = llvm::ConstantStruct::get(t, vals);
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
62 dbg_compile_units = new llvm::GlobalVariable(t,true,llvm::GlobalValue::LinkOnceLinkage,i,"llvm.dbg.compile_units",gIR->module);
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
63 dbg_compile_units->setSection("llvm.metadata");
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
64 }
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
65 if (!gIR->module->getNamedGlobal("llvm.dbg.global_variables")) {
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 173
diff changeset
66 std::vector<LLConstant*> vals;
94
61615fa85940 [svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents: 86
diff changeset
67 vals.push_back(DtoConstUint(llvm::LLVMDebugVersion));
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
68 vals.push_back(DtoConstUint(DW_TAG_variable));
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 173
diff changeset
69 LLConstant* i = llvm::ConstantStruct::get(t, vals);
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
70 dbg_global_variables = new llvm::GlobalVariable(t,true,llvm::GlobalValue::LinkOnceLinkage,i,"llvm.dbg.global_variables",gIR->module);
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
71 dbg_global_variables->setSection("llvm.metadata");
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
72 }
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
73 if (!gIR->module->getNamedGlobal("llvm.dbg.subprograms")) {
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 173
diff changeset
74 std::vector<LLConstant*> vals;
94
61615fa85940 [svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents: 86
diff changeset
75 vals.push_back(DtoConstUint(llvm::LLVMDebugVersion));
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
76 vals.push_back(DtoConstUint(DW_TAG_subprogram));
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 173
diff changeset
77 LLConstant* i = llvm::ConstantStruct::get(t, vals);
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
78 dbg_subprograms = new llvm::GlobalVariable(t,true,llvm::GlobalValue::LinkOnceLinkage,i,"llvm.dbg.subprograms",gIR->module);
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
79 dbg_subprograms->setSection("llvm.metadata");
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
80 }
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
81
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
82 return t;
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
83 }
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
84
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 173
diff changeset
85 LLConstant* GetDwarfAnchor(llvm::dwarf::dwarf_constants c)
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
86 {
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
87 GetDwarfAnchorType();
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
88 switch (c)
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
89 {
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
90 case DW_TAG_compile_unit:
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
91 return dbg_compile_units;
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
92 case DW_TAG_variable:
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
93 return dbg_global_variables;
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
94 case DW_TAG_subprogram:
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
95 return dbg_subprograms;
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
96 }
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
97 assert(0);
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
98 return 0;
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
99 }
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
100
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
101 //////////////////////////////////////////////////////////////////////////////////////////////////
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
102
245
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
103 static const llvm::StructType* GetDwarfCompileUnitType() {
96
ce7ed8f59b99 [svn r100] Moved test/ray.d to demos/ray.d.
lindquist
parents: 94
diff changeset
104 return isaStruct(gIR->module->getTypeByName("llvm.dbg.compile_unit.type"));
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
105 }
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
106
245
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
107 static const llvm::StructType* GetDwarfSubProgramType() {
96
ce7ed8f59b99 [svn r100] Moved test/ray.d to demos/ray.d.
lindquist
parents: 94
diff changeset
108 return isaStruct(gIR->module->getTypeByName("llvm.dbg.subprogram.type"));
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
109 }
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
110
245
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
111 static const llvm::StructType* GetDwarfVariableType() {
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
112 return isaStruct(gIR->module->getTypeByName("llvm.dbg.variable.type"));
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
113 }
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
114
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
115 static const llvm::StructType* GetDwarfDerivedTypeType() {
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
116 return isaStruct(gIR->module->getTypeByName("llvm.dbg.derivedtype.type"));
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
117 }
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
118
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
119 static const llvm::StructType* GetDwarfBasicTypeType() {
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
120 return isaStruct(gIR->module->getTypeByName("llvm.dbg.basictype.type"));
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
121 }
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
122
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
123 //////////////////////////////////////////////////////////////////////////////////////////////////
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
124
245
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
125 LLGlobalVariable* DtoDwarfCompileUnit(Module* m)
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
126 {
173
db9890b3fb64 [svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents: 156
diff changeset
127 if (!m->ir.irModule)
db9890b3fb64 [svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents: 156
diff changeset
128 m->ir.irModule = new IrModule(m);
db9890b3fb64 [svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents: 156
diff changeset
129 else if (m->ir.irModule->dwarfCompileUnit)
139
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
130 {
173
db9890b3fb64 [svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents: 156
diff changeset
131 if (m->ir.irModule->dwarfCompileUnit->getParent() == gIR->module)
db9890b3fb64 [svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents: 156
diff changeset
132 return m->ir.irModule->dwarfCompileUnit;
139
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
133 }
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
134
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
135 // create a valid compile unit constant for the current module
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
136
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 173
diff changeset
137 LLConstant* c = NULL;
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
138
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 173
diff changeset
139 std::vector<LLConstant*> vals;
139
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
140 vals.push_back(llvm::ConstantExpr::getAdd(
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
141 DtoConstUint(DW_TAG_compile_unit),
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
142 DtoConstUint(llvm::LLVMDebugVersion)));
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
143 vals.push_back(dbgToArrTy(GetDwarfAnchor(DW_TAG_compile_unit)));
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
144
139
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
145 vals.push_back(DtoConstUint(DW_LANG_C));// _D)); // doesn't seem to work
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
146 vals.push_back(DtoConstStringPtr(m->srcfile->name->toChars(), "llvm.metadata"));
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
147 std::string srcpath(FileName::path(m->srcfile->name->toChars()));
140
ffcc9a2f3d9d [svn r144] fixes
lindquist
parents: 139
diff changeset
148 if (srcpath.empty()) {
ffcc9a2f3d9d [svn r144] fixes
lindquist
parents: 139
diff changeset
149 const char* str = get_current_dir_name();
ffcc9a2f3d9d [svn r144] fixes
lindquist
parents: 139
diff changeset
150 assert(str != NULL);
ffcc9a2f3d9d [svn r144] fixes
lindquist
parents: 139
diff changeset
151 srcpath = str;
ffcc9a2f3d9d [svn r144] fixes
lindquist
parents: 139
diff changeset
152 }
139
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
153 vals.push_back(DtoConstStringPtr(srcpath.c_str(), "llvm.metadata"));
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
154 vals.push_back(DtoConstStringPtr("LLVMDC (http://www.dsource.org/projects/llvmdc)", "llvm.metadata"));
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
155
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
156 c = llvm::ConstantStruct::get(GetDwarfCompileUnitType(), vals);
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
157
94
61615fa85940 [svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents: 86
diff changeset
158 llvm::GlobalVariable* gv = new llvm::GlobalVariable(GetDwarfCompileUnitType(), true, llvm::GlobalValue::InternalLinkage, c, "llvm.dbg.compile_unit", gIR->module);
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
159 gv->setSection("llvm.metadata");
139
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
160
173
db9890b3fb64 [svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents: 156
diff changeset
161 m->ir.irModule->dwarfCompileUnit = gv;
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
162 return gv;
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
163 }
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
164
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
165 //////////////////////////////////////////////////////////////////////////////////////////////////
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
166
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
167 LLGlobalVariable* DtoDwarfSubProgram(FuncDeclaration* fd, llvm::GlobalVariable* compileUnit)
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
168 {
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 173
diff changeset
169 std::vector<LLConstant*> vals;
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
170 vals.push_back(llvm::ConstantExpr::getAdd(
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
171 DtoConstUint(DW_TAG_subprogram),
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
172 DtoConstUint(llvm::LLVMDebugVersion)));
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
173 vals.push_back(dbgToArrTy(GetDwarfAnchor(DW_TAG_subprogram)));
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
174
94
61615fa85940 [svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents: 86
diff changeset
175 vals.push_back(dbgToArrTy(compileUnit));
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
176 vals.push_back(DtoConstStringPtr(fd->toPrettyChars(), "llvm.metadata"));
94
61615fa85940 [svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents: 86
diff changeset
177 vals.push_back(vals.back());
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
178 vals.push_back(DtoConstStringPtr(fd->mangle(), "llvm.metadata"));
94
61615fa85940 [svn r98] Added support for std.c.stdlib.alloca via pragma(LLVM_internal, "alloca").
lindquist
parents: 86
diff changeset
179 vals.push_back(dbgToArrTy(compileUnit));
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
180 vals.push_back(DtoConstUint(fd->loc.linnum));
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
181 vals.push_back(llvm::ConstantPointerNull::get(dbgArrTy()));
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
182 vals.push_back(DtoConstBool(fd->protection == PROTprivate));
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
183 vals.push_back(DtoConstBool(fd->getModule() == gIR->dmodule));
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
184
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 173
diff changeset
185 LLConstant* c = llvm::ConstantStruct::get(GetDwarfSubProgramType(), vals);
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
186 llvm::GlobalVariable* gv = new llvm::GlobalVariable(c->getType(), true, llvm::GlobalValue::InternalLinkage, c, "llvm.dbg.subprogram", gIR->module);
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
187 gv->setSection("llvm.metadata");
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
188 return gv;
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
189 }
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
190
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
191 //////////////////////////////////////////////////////////////////////////////////////////////////
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
192
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
193 void DtoDwarfFuncStart(FuncDeclaration* fd)
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
194 {
173
db9890b3fb64 [svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents: 156
diff changeset
195 assert(fd->ir.irFunc->dwarfSubProg);
db9890b3fb64 [svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents: 156
diff changeset
196 gIR->ir->CreateCall(gIR->module->getFunction("llvm.dbg.func.start"), dbgToArrTy(fd->ir.irFunc->dwarfSubProg));
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
197 }
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
198
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
199 void DtoDwarfFuncEnd(FuncDeclaration* fd)
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
200 {
173
db9890b3fb64 [svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents: 156
diff changeset
201 assert(fd->ir.irFunc->dwarfSubProg);
db9890b3fb64 [svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents: 156
diff changeset
202 gIR->ir->CreateCall(gIR->module->getFunction("llvm.dbg.region.end"), dbgToArrTy(fd->ir.irFunc->dwarfSubProg));
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
203 }
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
204
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
205 //////////////////////////////////////////////////////////////////////////////////////////////////
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
206
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
207 void DtoDwarfStopPoint(unsigned ln)
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
208 {
217
0806379a5eca [svn r233] Added: -oq command line option for writing fully qualified object names.
lindquist
parents: 213
diff changeset
209 LLSmallVector<LLValue*,3> args;
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
210 args.push_back(DtoConstUint(ln));
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
211 args.push_back(DtoConstUint(0));
139
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
212 FuncDeclaration* fd = gIR->func()->decl;
0ab29b838084 [svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :)
lindquist
parents: 136
diff changeset
213 args.push_back(dbgToArrTy(DtoDwarfCompileUnit(fd->getModule())));
82
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
214 gIR->ir->CreateCall(gIR->module->getFunction("llvm.dbg.stoppoint"), args.begin(), args.end());
d8dd47ef3973 [svn r86] Changed the way arguments are given storage. It is now detected if they will need it during semantic passes.
lindquist
parents:
diff changeset
215 }
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
216
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
217 //////////////////////////////////////////////////////////////////////////////////////////////////
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
218
245
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
219 static LLGlobalVariable* DtoDwarfTypeDescription(Loc loc, Type* type, LLGlobalVariable* cu);
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
220
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
221 //////////////////////////////////////////////////////////////////////////////////////////////////
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
222
245
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
223 static LLGlobalVariable* DtoDwarfBasicType(Type* type, llvm::GlobalVariable* compileUnit)
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
224 {
245
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
225 Type* t = type->toBasetype();
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
226
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
227
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
228 const LLType* T = DtoType(type);
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
229
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
230 std::vector<LLConstant*> vals;
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
231 // tag
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
232 vals.push_back(llvm::ConstantExpr::getAdd(
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
233 DtoConstUint(DW_TAG_base_type),
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
234 DtoConstUint(llvm::LLVMDebugVersion)));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
235 // context
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
236 vals.push_back(dbgToArrTy(compileUnit));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
237 // name
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
238 vals.push_back(DtoConstStringPtr(type->toChars(), "llvm.metadata"));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
239 // compile unit where defined
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
240 vals.push_back(getNullPtr(dbgArrTy()));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
241 // line number where defined
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
242 vals.push_back(DtoConstInt(0));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
243 // size in bits
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
244 vals.push_back(LLConstantInt::get(LLType::Int64Ty, getTypeBitSize(T), false));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
245 // alignment in bits
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
246 vals.push_back(LLConstantInt::get(LLType::Int64Ty, getABITypeAlign(T)*8, false));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
247 // offset in bits
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
248 vals.push_back(LLConstantInt::get(LLType::Int64Ty, 0, false));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
249 // FIXME: dont know what this is
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
250 vals.push_back(DtoConstUint(0));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
251 // dwarf type
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
252 unsigned id;
245
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
253 if (t->isintegral())
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
254 {
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
255 if (type->isunsigned())
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
256 id = llvm::dwarf::DW_ATE_unsigned;
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
257 else
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
258 id = llvm::dwarf::DW_ATE_signed;
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
259 }
245
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
260 else if (t->isfloating())
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
261 {
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
262 id = llvm::dwarf::DW_ATE_float;
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
263 }
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
264 else
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
265 {
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
266 assert(0 && "unsupported basictype for debug info");
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
267 }
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
268 vals.push_back(DtoConstUint(id));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
269
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
270 LLConstant* c = llvm::ConstantStruct::get(GetDwarfBasicTypeType(), vals);
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
271 LLGlobalVariable* gv = new LLGlobalVariable(c->getType(), true, LLGlobalValue::InternalLinkage, c, "llvm.dbg.basictype", gIR->module);
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
272 gv->setSection("llvm.metadata");
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
273 return gv;
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
274 }
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
275
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
276 //////////////////////////////////////////////////////////////////////////////////////////////////
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
277
245
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
278 static LLGlobalVariable* DtoDwarfDerivedType(Loc loc, Type* type, llvm::GlobalVariable* compileUnit)
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
279 {
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
280 const LLType* T = DtoType(type);
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
281 Type* t = DtoDType(type);
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
282
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
283 // defaults
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
284 LLConstant* name = getNullPtr(getVoidPtrType());
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
285
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
286 // find tag
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
287 unsigned tag;
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
288 if (t->ty == Tpointer)
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
289 {
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
290 tag = llvm::dwarf::DW_TAG_pointer_type;
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
291 }
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
292 else
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
293 {
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
294 assert(0 && "unsupported derivedtype for debug info");
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
295 }
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
296
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
297 std::vector<LLConstant*> vals;
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
298 // tag
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
299 vals.push_back(llvm::ConstantExpr::getAdd(
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
300 DtoConstUint(tag),
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
301 DtoConstUint(llvm::LLVMDebugVersion)));
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
302 // context
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
303 vals.push_back(dbgToArrTy(compileUnit));
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
304 // name
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
305 vals.push_back(name);
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
306 // compile unit where defined
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
307 vals.push_back(getNullPtr(dbgArrTy()));
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
308 // line number where defined
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
309 vals.push_back(DtoConstInt(0));
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
310 // size in bits
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
311 vals.push_back(LLConstantInt::get(LLType::Int64Ty, getTypeBitSize(T), false));
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
312 // alignment in bits
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
313 vals.push_back(LLConstantInt::get(LLType::Int64Ty, getABITypeAlign(T)*8, false));
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
314 // offset in bits
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
315 vals.push_back(LLConstantInt::get(LLType::Int64Ty, 0, false));
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
316 // FIXME: dont know what this is
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
317 vals.push_back(DtoConstUint(0));
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
318 // base type
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
319 Type* nt = t->nextOf();
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
320 LLGlobalVariable* nTD = DtoDwarfTypeDescription(loc, nt, compileUnit);
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
321 if (nt->ty == Tvoid || !nTD)
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
322 vals.push_back(getNullPtr(dbgArrTy()));
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
323 else
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
324 vals.push_back(dbgToArrTy(nTD));
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
325
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
326 LLConstant* c = llvm::ConstantStruct::get(GetDwarfDerivedTypeType(), vals);
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
327 LLGlobalVariable* gv = new LLGlobalVariable(c->getType(), true, LLGlobalValue::InternalLinkage, c, "llvm.dbg.derivedtype", gIR->module);
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
328 gv->setSection("llvm.metadata");
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
329 return gv;
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
330 }
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
331
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
332 //////////////////////////////////////////////////////////////////////////////////////////////////
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
333
245
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
334 static LLGlobalVariable* DtoDwarfVariable(VarDeclaration* vd, LLGlobalVariable* typeDescr)
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
335 {
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
336 unsigned tag;
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
337 if (vd->isParameter())
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
338 tag = DW_TAG_arg_variable;
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
339 else if (vd->isCodeseg())
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
340 assert(0 && "a static variable");
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
341 else
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
342 tag = DW_TAG_auto_variable;
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
343
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
344 std::vector<LLConstant*> vals;
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
345 // tag
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
346 vals.push_back(llvm::ConstantExpr::getAdd(
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
347 DtoConstUint(tag),
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
348 DtoConstUint(llvm::LLVMDebugVersion)));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
349 // context
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
350 vals.push_back(dbgToArrTy(gIR->func()->dwarfSubProg));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
351 // name
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
352 vals.push_back(DtoConstStringPtr(vd->toChars(), "llvm.metadata"));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
353 // compile unit where defined
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
354 vals.push_back(dbgToArrTy(DtoDwarfCompileUnit(vd->getModule())));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
355 // line number where defined
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
356 vals.push_back(DtoConstUint(vd->loc.linnum));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
357 // type descriptor
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
358 vals.push_back(dbgToArrTy(typeDescr));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
359
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
360 LLConstant* c = llvm::ConstantStruct::get(GetDwarfVariableType(), vals);
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
361 LLGlobalVariable* gv = new LLGlobalVariable(c->getType(), true, LLGlobalValue::InternalLinkage, c, "llvm.dbg.variable", gIR->module);
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
362 gv->setSection("llvm.metadata");
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
363 return gv;
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
364 }
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
365
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
366 //////////////////////////////////////////////////////////////////////////////////////////////////
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
367
245
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
368 static void DtoDwarfDeclare(LLValue* var, LLGlobalVariable* varDescr)
244
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
369 {
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
370 LLSmallVector<LLValue*,2> args;
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
371 args.push_back(DtoBitCast(var, dbgArrTy()));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
372 args.push_back(dbgToArrTy(varDescr));
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
373 gIR->ir->CreateCall(gIR->module->getFunction("llvm.dbg.declare"), args.begin(), args.end());
a95056b3c996 [svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents: 217
diff changeset
374 }
245
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
375
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
376 //////////////////////////////////////////////////////////////////////////////////////////////////
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
377
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
378 static LLGlobalVariable* DtoDwarfTypeDescription(Loc loc, Type* type, LLGlobalVariable* cu)
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
379 {
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
380 Type* t = type->toBasetype();
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
381 if (t->isintegral() || t->isfloating())
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
382 return DtoDwarfBasicType(type, cu);
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
383 else if (t->ty == Tpointer)
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
384 return DtoDwarfDerivedType(loc, type, cu);
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
385
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
386 Logger::attention(loc, "unsupport type for debug info: %s", type->toChars());
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
387 return NULL;
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
388 }
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
389
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
390 void DtoDwarfLocalVariable(LLValue* ll, VarDeclaration* vd)
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
391 {
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
392 // get compile units
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
393 LLGlobalVariable* thisCU = DtoDwarfCompileUnit(gIR->dmodule);
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
394 LLGlobalVariable* varCU = thisCU;
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
395 if (vd->getModule() != gIR->dmodule)
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
396 varCU = DtoDwarfCompileUnit(vd->getModule());
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
397
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
398 // get type description
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
399 Type* t = vd->type->toBasetype();
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
400 LLGlobalVariable* TD = DtoDwarfTypeDescription(vd->loc, vd->type, thisCU);
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
401 if (TD == NULL)
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
402 return; // unsupported
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
403
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
404 // get variable description
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
405 LLGlobalVariable* VD;
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
406 VD = DtoDwarfVariable(vd, TD);
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
407
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
408 // declare
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
409 DtoDwarfDeclare(ll, VD);
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
410 }
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
411
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
412
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
413
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
414
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
415
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
416
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
417
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
418
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
419
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
420
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
421
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
422
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
423
d61ce72c39ab [svn r262] Fixed debug info for normal function parameters.
lindquist
parents: 244
diff changeset
424