diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2015-12-15 01:55:52 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2015-12-15 01:55:52 -0700 |
| commit | 673d638070452d86543c6bb47879e83adcfa73a1 (patch) | |
| tree | 5a58cef1f45c198d93266ebbb072a102fbdfa5b2 /src/codegen.cpp | |
| parent | a292eb8d64da4383f2d4637f231d338ed9c680e0 (diff) | |
| download | zig-673d638070452d86543c6bb47879e83adcfa73a1.tar.gz zig-673d638070452d86543c6bb47879e83adcfa73a1.zip | |
std: more efficient inline assembly
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 110286a3c9..f60f116a2c 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -805,14 +805,12 @@ static LLVMValueRef gen_asm_expr(CodeGen *g, AstNode *node) { LLVMValueRef *param_values = allocate<LLVMValueRef>(input_and_output_count); for (int i = 0; i < asm_expr->output_list.length; i += 1, total_index += 1) { AsmOutput *asm_output = asm_expr->output_list.at(i); - bool is_return = false; - if (buf_eql_str(&asm_output->constraint, "=m")) { - buf_append_str(&constraint_buf, "=*m"); - } else if (buf_eql_str(&asm_output->constraint, "=r")) { - buf_append_str(&constraint_buf, "=r"); - is_return = true; + bool is_return = (asm_output->return_type != nullptr); + assert(*buf_ptr(&asm_output->constraint) == '='); + if (is_return) { + buf_appendf(&constraint_buf, "=%s", buf_ptr(&asm_output->constraint) + 1); } else { - zig_panic("TODO unable to handle anything other than '=m' and '=r' for outputs"); + buf_appendf(&constraint_buf, "=*%s", buf_ptr(&asm_output->constraint) + 1); } if (total_index + 1 < total_constraint_count) { buf_append_char(&constraint_buf, ','); |
