From 2f3fde60c316031f657e149c56ff3eaa8ae2c7fa Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 9 Aug 2013 13:47:00 -0700 Subject: 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! --- src/rustllvm/RustWrapper.cpp | 4 ++++ src/rustllvm/rustllvm.def.in | 1 + 2 files changed, 5 insertions(+) (limited to 'src/rustllvm') 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(Elements), RunTimeLang)); } + +extern "C" void LLVMSetUnnamedAddr(LLVMValueRef Value, LLVMBool Unnamed) { + unwrap(Value)->setUnnamedAddr(Unnamed); +} diff --git a/src/rustllvm/rustllvm.def.in b/src/rustllvm/rustllvm.def.in index 260a16dab98..a2af7a18b4f 100644 --- a/src/rustllvm/rustllvm.def.in +++ b/src/rustllvm/rustllvm.def.in @@ -613,3 +613,4 @@ LLVMDIBuilderInsertDeclareBefore LLVMDIBuilderCreateEnumerator LLVMDIBuilderCreateEnumerationType LLVMDIBuilderCreateUnionType +LLVMSetUnnamedAddr -- cgit 1.4.1-3-g733a5