diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-09-23 23:39:58 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-09-23 23:46:45 -0700 |
| commit | f215d98043ef948a996ac036609f4b71fa9c3c13 (patch) | |
| tree | fcb9818017f619be3940831834c3cbbf553c9173 /lib/std | |
| parent | 418105589a2723ca372596e5893e0e1e030efe87 (diff) | |
| download | zig-f215d98043ef948a996ac036609f4b71fa9c3c13.tar.gz zig-f215d98043ef948a996ac036609f4b71fa9c3c13.zip | |
stage2: LLVM backend: improved naming and exporting
Introduce an explicit decl_map for *Decl to LLVMValueRef. Doc comment
reproduced here:
Ideally we would use `llvm_module.getNamedFunction` to go from *Decl to
LLVM function, but that has some downsides:
* we have to compute the fully qualified name every time we want to do the lookup
* for externally linked functions, the name is not fully qualified, but when
a Decl goes from exported to not exported and vice-versa, we would use the wrong
version of the name and incorrectly get function not found in the llvm module.
* it works for functions not all globals.
Therefore, this table keeps track of the mapping.
Non-exported functions now use fully-qualified symbol names.
`Module.Decl.getFullyQualifiedName` now returns a sentinel-terminated
slice which is useful to pass to LLVMAddFunction.
Instead of using aliases for all external symbols, now the LLVM backend
takes advantage of LLVMSetValueName to rename functions that become
exported. Aliases are still used for the second and remaining exports.
freeDecl is now handled properly in the LLVM backend, deleting the
LLVMValueRef corresponding to the Decl being deleted. The linker
backends for ELF, COFF, Mach-O, and Wasm had to be updated to forward
the freeDecl call to the LLVM backend.
Diffstat (limited to 'lib/std')
0 files changed, 0 insertions, 0 deletions
