about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-08-11 07:29:07 -0700
committerbors <bors@rust-lang.org>2013-08-11 07:29:07 -0700
commitf08851e31ab95da3b5bc446744d6dc89905335d9 (patch)
tree1d5bdf20d9f69978745d8b3b8bc32376b854c6d1 /src/rustllvm/RustWrapper.cpp
parent45da2a5f48300eff8ccfd524a0bad5c351c20298 (diff)
parent2f3fde60c316031f657e149c56ff3eaa8ae2c7fa (diff)
downloadrust-f08851e31ab95da3b5bc446744d6dc89905335d9.tar.gz
rust-f08851e31ab95da3b5bc446744d6dc89905335d9.zip
auto merge of #8421 : alexcrichton/rust/unnamed-addr, r=thestinger
This can be applied to statics and it will indicate that LLVM will attempt to
merge the constant in .data with other statics.

I have preliminarily applied this to all of the statics generated by the new
`ifmt!` syntax extension. I compiled a file with 1000 calls to `ifmt!` and a
separate file with 1000 calls to `fmt!` to compare the sizes, and the results
were:

```
fmt           310k
ifmt (before) 529k
ifmt (after)  202k
```

This now means that ifmt! is both faster and smaller than fmt!, yay!
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
-rw-r--r--src/rustllvm/RustWrapper.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index 04c062072d6..db353036336 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -833,3 +833,7 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateUnionType(
         unwrapDI<DIArray>(Elements),
         RunTimeLang));
 }
+
+extern "C" void LLVMSetUnnamedAddr(LLVMValueRef Value, LLVMBool Unnamed) {
+    unwrap<GlobalValue>(Value)->setUnnamedAddr(Unnamed);
+}