aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-02-05 13:12:06 -0500
committerAndrew Kelley <superjoe30@gmail.com>2017-02-05 13:12:06 -0500
commit52eec6b9a60f18ef9818b38c83e8e056985acebd (patch)
tree5de700bad83f53cedb218c87e58c95fc8d713dbd
parent6f316d8ebd1d7e594b957bac16a5458b5d173481 (diff)
downloadzig-52eec6b9a60f18ef9818b38c83e8e056985acebd.tar.gz
zig-52eec6b9a60f18ef9818b38c83e8e056985acebd.zip
`%=` in inline assembly survives optimization
-rw-r--r--src/all_types.hpp2
-rw-r--r--src/codegen.cpp5
2 files changed, 1 insertions, 6 deletions
diff --git a/src/all_types.hpp b/src/all_types.hpp
index dc4b40ba2d..e14240d79c 100644
--- a/src/all_types.hpp
+++ b/src/all_types.hpp
@@ -1292,8 +1292,6 @@ struct CodeGen {
IrInstruction *invalid_instruction;
ConstExprValue const_void_val;
-
- uint32_t unique_asm_id;
};
enum VarLinkage {
diff --git a/src/codegen.cpp b/src/codegen.cpp
index a34312c5de..9c121adbf4 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -1487,9 +1487,6 @@ static LLVMValueRef ir_render_asm(CodeGen *g, IrExecutable *executable, IrInstru
Buf llvm_template = BUF_INIT;
buf_resize(&llvm_template, 0);
- uint32_t unique_id = g->unique_asm_id;
- g->unique_asm_id += 1;
-
for (size_t token_i = 0; token_i < asm_expr->token_list.length; token_i += 1) {
AsmToken *asm_token = &asm_expr->token_list.at(token_i);
switch (asm_token->id) {
@@ -1514,7 +1511,7 @@ static LLVMValueRef ir_render_asm(CodeGen *g, IrExecutable *executable, IrInstru
break;
}
case AsmTokenIdUniqueId:
- buf_appendf(&llvm_template, "%" PRIu32, unique_id);
+ buf_append_str(&llvm_template, "${:uid}");
break;
}
}