Mercurial > projects > ldc
annotate gen/todebug.h @ 1117:4c20fcc4252b
Fun with parameter attributes: For several of the "synthetic" parameters added
to D functions, we can apply noalias and nocapture. They are sret parameters,
'nest' pointers passed to nested functions, and _argptr:
Nocapture:
- Sret and nest are nocapture because they don't represent D-level variables,
and thus the callee can't (validly) obtain a pointer to them, let alone keep
it around after it returns.
- _argptr is nocapture because although the callee has access to it as a
pointer, that pointer is invalidated when it returns.
All three are noalias because they're function-local variables
- Sret and _argptr are noalias because they're freshly alloca'd memory only
used for a single function call that's not allowed to keep an aliasing
pointer to it around (since the parameter is nocapture).
- 'Nest' is noalias because the callee only ever has access to one such pointer
per parent function, and every parent function has a different one.
This commit also ensures attributes set on sret, _arguments and _argptr are
propagated to calls to such functions.
It also adds one exception to the general rule that attributes on function types
should propagate to calls: the type of a delegate's function pointer has a
'nest' parameter, but this can either be a true 'nest' (for delegates to nested
functions) or a 'this' (for delegates to member functions). Since 'this' is
neither noalias nor nocapture, and there's generally no way to tell which one it
is, we remove these attributes at the call site if the callee is a delegate.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Sat, 14 Mar 2009 22:15:31 +0100 |
parents | 1714836f2c0b |
children | 40bd4a0d4870 |
rev | line source |
---|---|
664
eef8ac26c66c
Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents:
250
diff
changeset
|
1 #ifndef LDC_GEN_TODEBUG_H |
eef8ac26c66c
Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents:
250
diff
changeset
|
2 #define LDC_GEN_TODEBUG_H |
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
|
3 |
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 void RegisterDwarfSymbols(llvm::Module* mod); |
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 |
250
fc9c1a0eabbd
[svn r267] Fixed debug info for global variables.
lindquist
parents:
247
diff
changeset
|
6 /** |
fc9c1a0eabbd
[svn r267] Fixed debug info for global variables.
lindquist
parents:
247
diff
changeset
|
7 * Emit the Dwarf compile_unit global for a Module m. |
fc9c1a0eabbd
[svn r267] Fixed debug info for global variables.
lindquist
parents:
247
diff
changeset
|
8 * @param m |
fc9c1a0eabbd
[svn r267] Fixed debug info for global variables.
lindquist
parents:
247
diff
changeset
|
9 * @return the Dwarf compile_unit. |
fc9c1a0eabbd
[svn r267] Fixed debug info for global variables.
lindquist
parents:
247
diff
changeset
|
10 */ |
946
1714836f2c0b
Mostly rewrite debug info generation in terms of llvm/Analysis/DebugInfo.h.
Christian Kamm <kamm incasoftware de>
parents:
686
diff
changeset
|
11 llvm::DICompileUnit DtoDwarfCompileUnit(Module* m); |
250
fc9c1a0eabbd
[svn r267] Fixed debug info for global variables.
lindquist
parents:
247
diff
changeset
|
12 |
fc9c1a0eabbd
[svn r267] Fixed debug info for global variables.
lindquist
parents:
247
diff
changeset
|
13 /** |
fc9c1a0eabbd
[svn r267] Fixed debug info for global variables.
lindquist
parents:
247
diff
changeset
|
14 * Emit the Dwarf subprogram global for a function declaration fd. |
fc9c1a0eabbd
[svn r267] Fixed debug info for global variables.
lindquist
parents:
247
diff
changeset
|
15 * @param fd |
fc9c1a0eabbd
[svn r267] Fixed debug info for global variables.
lindquist
parents:
247
diff
changeset
|
16 * @return the Dwarf subprogram global. |
fc9c1a0eabbd
[svn r267] Fixed debug info for global variables.
lindquist
parents:
247
diff
changeset
|
17 */ |
946
1714836f2c0b
Mostly rewrite debug info generation in terms of llvm/Analysis/DebugInfo.h.
Christian Kamm <kamm incasoftware de>
parents:
686
diff
changeset
|
18 llvm::DISubprogram DtoDwarfSubProgram(FuncDeclaration* fd); |
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 |
686
363bb6c0cc80
Emit stub debug info for generated functions to work around LLVM bug 2172.
Christian Kamm <kamm incasoftware de>
parents:
664
diff
changeset
|
20 /** |
363bb6c0cc80
Emit stub debug info for generated functions to work around LLVM bug 2172.
Christian Kamm <kamm incasoftware de>
parents:
664
diff
changeset
|
21 * Emit the Dwarf subprogram global for a internal function. |
363bb6c0cc80
Emit stub debug info for generated functions to work around LLVM bug 2172.
Christian Kamm <kamm incasoftware de>
parents:
664
diff
changeset
|
22 * This is used for generated functions like moduleinfoctors, |
363bb6c0cc80
Emit stub debug info for generated functions to work around LLVM bug 2172.
Christian Kamm <kamm incasoftware de>
parents:
664
diff
changeset
|
23 * module ctors/dtors and unittests. |
363bb6c0cc80
Emit stub debug info for generated functions to work around LLVM bug 2172.
Christian Kamm <kamm incasoftware de>
parents:
664
diff
changeset
|
24 * @return the Dwarf subprogram global. |
363bb6c0cc80
Emit stub debug info for generated functions to work around LLVM bug 2172.
Christian Kamm <kamm incasoftware de>
parents:
664
diff
changeset
|
25 */ |
946
1714836f2c0b
Mostly rewrite debug info generation in terms of llvm/Analysis/DebugInfo.h.
Christian Kamm <kamm incasoftware de>
parents:
686
diff
changeset
|
26 llvm::DISubprogram DtoDwarfSubProgramInternal(const char* prettyname, const char* mangledname); |
686
363bb6c0cc80
Emit stub debug info for generated functions to work around LLVM bug 2172.
Christian Kamm <kamm incasoftware de>
parents:
664
diff
changeset
|
27 |
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
|
28 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
|
29 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
|
30 |
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 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
|
32 |
245
d61ce72c39ab
[svn r262] Fixed debug info for normal function parameters.
lindquist
parents:
244
diff
changeset
|
33 /** |
d61ce72c39ab
[svn r262] Fixed debug info for normal function parameters.
lindquist
parents:
244
diff
changeset
|
34 * Emits all things necessary for making debug info for a local variable vd. |
d61ce72c39ab
[svn r262] Fixed debug info for normal function parameters.
lindquist
parents:
244
diff
changeset
|
35 * @param ll LLVM Value of the variable. |
d61ce72c39ab
[svn r262] Fixed debug info for normal function parameters.
lindquist
parents:
244
diff
changeset
|
36 * @param vd Variable declaration to emit debug info for. |
d61ce72c39ab
[svn r262] Fixed debug info for normal function parameters.
lindquist
parents:
244
diff
changeset
|
37 */ |
d61ce72c39ab
[svn r262] Fixed debug info for normal function parameters.
lindquist
parents:
244
diff
changeset
|
38 void DtoDwarfLocalVariable(LLValue* ll, VarDeclaration* vd); |
244
a95056b3c996
[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB.
lindquist
parents:
139
diff
changeset
|
39 |
247
56199753e637
[svn r264] Fixed debug info for global variables.
lindquist
parents:
245
diff
changeset
|
40 /** |
56199753e637
[svn r264] Fixed debug info for global variables.
lindquist
parents:
245
diff
changeset
|
41 * Emits all things necessary for making debug info for a global variable vd. |
56199753e637
[svn r264] Fixed debug info for global variables.
lindquist
parents:
245
diff
changeset
|
42 * @param ll |
56199753e637
[svn r264] Fixed debug info for global variables.
lindquist
parents:
245
diff
changeset
|
43 * @param vd |
56199753e637
[svn r264] Fixed debug info for global variables.
lindquist
parents:
245
diff
changeset
|
44 * @return |
56199753e637
[svn r264] Fixed debug info for global variables.
lindquist
parents:
245
diff
changeset
|
45 */ |
946
1714836f2c0b
Mostly rewrite debug info generation in terms of llvm/Analysis/DebugInfo.h.
Christian Kamm <kamm incasoftware de>
parents:
686
diff
changeset
|
46 llvm::DIGlobalVariable DtoDwarfGlobalVariable(LLGlobalVariable* ll, VarDeclaration* vd); |
247
56199753e637
[svn r264] Fixed debug info for global variables.
lindquist
parents:
245
diff
changeset
|
47 |
664
eef8ac26c66c
Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents:
250
diff
changeset
|
48 #endif // LDC_GEN_TODEBUG_H |
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
|
49 |
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
|
50 |