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>
This commit is contained in:
@@ -86,7 +86,10 @@ impl FunctionCx<'a, 'll, 'tcx> {
|
||||
self.codegen_operand(&bx, input).immediate()
|
||||
}).collect();
|
||||
|
||||
asm::codegen_inline_asm(&bx, asm, outputs, input_vals);
|
||||
let res = asm::codegen_inline_asm(&bx, asm, outputs, input_vals);
|
||||
if !res {
|
||||
span_err!(bx.sess(), statement.source_info.span, E0668, "malformed inline assembly");
|
||||
}
|
||||
bx
|
||||
}
|
||||
mir::StatementKind::FakeRead(..) |
|
||||
|
||||
Reference in New Issue
Block a user