about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-08-09 13:47:00 -0700
committerAlex Crichton <alex@alexcrichton.com>2013-08-09 13:49:41 -0700
commit2f3fde60c316031f657e149c56ff3eaa8ae2c7fa (patch)
tree975c1c1fff6594b5ff56a83f5e13dbeae215f571 /src/rustllvm/RustWrapper.cpp
parent74efdf6197aaee39bd14f8d97b75dbba08f1d32e (diff)
downloadrust-2f3fde60c316031f657e149c56ff3eaa8ae2c7fa.tar.gz
rust-2f3fde60c316031f657e149c56ff3eaa8ae2c7fa.zip
Implement an `address_insignificant` attribute
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);
+}