diff options
| author | Levente Kurusa <lkurusa@acm.org> | 2018-09-25 20:35:19 +0200 |
|---|---|---|
| committer | Levente Kurusa <lkurusa@acm.org> | 2018-09-25 20:38:35 +0200 |
| commit | fec86c8352d57fd7764d0fa2c4975010c7de793e (patch) | |
| tree | 76d7eb0fbda781b8ee5a5c6aca645a99d4946d7f /src/rustllvm/RustWrapper.cpp | |
| parent | e5c6575801028f5e089ef2e7720aa1af9d452334 (diff) | |
| download | rust-fec86c8352d57fd7764d0fa2c4975010c7de793e.tar.gz rust-fec86c8352d57fd7764d0fa2c4975010c7de793e.zip | |
codegen_llvm: check inline assembly constraints with LLVM
LLVM provides a way of checking whether the constraints and the actual
inline assembly make sense. This commit introduces a check before
emitting code for the inline assembly. If LLVM rejects the inline
assembly (or its constraints), then the compiler emits an error E0668
("malformed inline assembly").
Signed-off-by: Levente Kurusa <lkurusa@acm.org>
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
| -rw-r--r-- | src/rustllvm/RustWrapper.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 9b9c908ea52..f1ab1d4ddfa 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -426,6 +426,11 @@ extern "C" LLVMValueRef LLVMRustInlineAsm(LLVMTypeRef Ty, char *AsmString, HasSideEffects, IsAlignStack, fromRust(Dialect))); } +extern "C" bool LLVMRustInlineAsmVerify(LLVMTypeRef Ty, + char *Constraints) { + return InlineAsm::Verify(unwrap<FunctionType>(Ty), Constraints); +} + extern "C" void LLVMRustAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm) { unwrap(M)->appendModuleInlineAsm(StringRef(Asm)); } |
