about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-04-14 17:41:03 -0400
committerGitHub <noreply@github.com>2017-04-14 17:41:03 -0400
commite6f6b445aa2fc71f626dff7f7c7988b04f4a292d (patch)
tree7ecc980b1e110fbf55b96cf7ac88825d77244f54 /src/rustllvm/RustWrapper.cpp
parentba377982a3fde98a3cac02493c16dc623b02a421 (diff)
parenta35c4e354a65fdbbb61741db3a9dd1c190f2f146 (diff)
downloadrust-e6f6b445aa2fc71f626dff7f7c7988b04f4a292d.tar.gz
rust-e6f6b445aa2fc71f626dff7f7c7988b04f4a292d.zip
Rollup merge of #40702 - mrhota:global_asm, r=nagisa
Implement global_asm!() (RFC 1548)

This is a first attempt. ~~One (potential) problem I haven't solved is how to handle multiple usages of `global_asm!` in a module/crate. It looks like `LLVMSetModuleInlineAsm` overwrites module asm, and `LLVMAppendModuleInlineAsm` is not provided in LLVM C headers 😦~~

I can provide more detail as needed, but honestly, there's not a lot going on here.

r? @eddyb

CC @Amanieu @jackpot51

Tracking issue: #35119
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 5ab786f40b9..c24867224ea 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -312,6 +312,10 @@ extern "C" LLVMValueRef LLVMRustInlineAsm(LLVMTypeRef Ty, char *AsmString,
                              HasSideEffects, IsAlignStack, fromRust(Dialect)));
 }
 
+extern "C" void LLVMRustAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm) {
+  unwrap(M)->appendModuleInlineAsm(StringRef(Asm));
+}
+
 typedef DIBuilder *LLVMRustDIBuilderRef;
 
 typedef struct LLVMOpaqueMetadata *LLVMRustMetadataRef;