authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2015-12-23 15:49:34-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2015-12-23 15:49:34-07:00
log9ce36ba0ccd5d7de076e688423862d315ef4233f
tree24be8536eba04042e04995aa8d89951b8cc4fbe1
parente21369a1539063773734432993bc2c23680f0913

inline assembly uses -> instead of return


4 files changed, 8 insertions(+), 8 deletions(-)

doc/langref.md+1-1
...@@ -84,7 +84,7 @@ AsmOutput : token(Colon) list(AsmOutputItem, token(Comma)) option(AsmInput)...@@ -84,7 +84,7 @@ AsmOutput : token(Colon) list(AsmOutputItem, token(Comma)) option(AsmInput)
8484
85AsmInput : token(Colon) list(AsmInputItem, token(Comma)) option(AsmClobbers)85AsmInput : token(Colon) list(AsmInputItem, token(Comma)) option(AsmClobbers)
8686
87AsmOutputItem : token(LBracket) token(Symbol) token(RBracket) token(String) token(LParen) (token(Symbol) | token(Return) Type) token(RParen)87AsmOutputItem : token(LBracket) token(Symbol) token(RBracket) token(String) token(LParen) (token(Symbol) | token(Arrow) Type) token(RParen)
8888
89AsmInputItem : token(LBracket) token(Symbol) token(RBracket) token(String) token(LParen) Expression token(RParen)89AsmInputItem : token(LBracket) token(Symbol) token(RBracket) token(String) token(LParen) Expression token(RParen)
9090
src/parser.cpp+2-2
...@@ -1761,7 +1761,7 @@ static void ast_parse_asm_input_item(ParseContext *pc, int *token_index, AstNode...@@ -1761,7 +1761,7 @@ static void ast_parse_asm_input_item(ParseContext *pc, int *token_index, AstNode
1761}1761}
17621762
1763/*1763/*
1764AsmOutputItem : token(LBracket) token(Symbol) token(RBracket) token(String) token(LParen) (token(Symbol) | token(Return) Type) token(RParen)1764AsmOutputItem : token(LBracket) token(Symbol) token(RBracket) token(String) token(LParen) (token(Symbol) | token(Arrow) Type) token(RParen)
1765*/1765*/
1766static void ast_parse_asm_output_item(ParseContext *pc, int *token_index, AstNode *node) {1766static void ast_parse_asm_output_item(ParseContext *pc, int *token_index, AstNode *node) {
1767 ast_eat_token(pc, token_index, TokenIdLBracket);1767 ast_eat_token(pc, token_index, TokenIdLBracket);
...@@ -1778,7 +1778,7 @@ static void ast_parse_asm_output_item(ParseContext *pc, int *token_index, AstNod...@@ -1778,7 +1778,7 @@ static void ast_parse_asm_output_item(ParseContext *pc, int *token_index, AstNod
1778 *token_index += 1;1778 *token_index += 1;
1779 if (token->id == TokenIdSymbol) {1779 if (token->id == TokenIdSymbol) {
1780 ast_buf_from_token(pc, token, &asm_output->variable_name);1780 ast_buf_from_token(pc, token, &asm_output->variable_name);
1781 } else if (token->id == TokenIdKeywordReturn) {1781 } else if (token->id == TokenIdArrow) {
1782 asm_output->return_type = ast_parse_type(pc, token_index);1782 asm_output->return_type = ast_parse_type(pc, token_index);
1783 } else {1783 } else {
1784 ast_invalid_token_error(pc, token);1784 ast_invalid_token_error(pc, token);
std/bootstrap.zig+3-3
...@@ -2,8 +2,8 @@ use "std.zig";...@@ -2,8 +2,8 @@ use "std.zig";
22
3#attribute("naked")3#attribute("naked")
4export fn _start() -> unreachable {4export fn _start() -> unreachable {
5 const argc = asm("mov (%%rsp), %[argc]" : [argc] "=r" (return isize));5 const argc = asm("mov (%%rsp), %[argc]" : [argc] "=r" (-> isize));
6 const argv = asm("lea 0x8(%%rsp), %[argv]" : [argv] "=r" (return &&u8));6 const argv = asm("lea 0x8(%%rsp), %[argv]" : [argv] "=r" (-> &&u8));
7 const env = asm("lea 0x10(%%rsp,%%rdi,8), %[env]" : [env] "=r" (return &&u8));7 const env = asm("lea 0x10(%%rsp,%%rdi,8), %[env]" : [env] "=r" (-> &&u8));
8 exit(main(argc, argv, env))8 exit(main(argc, argv, env))
9}9}
std/std.zig+2-2
...@@ -4,14 +4,14 @@ const stdout_fileno : isize = 1;...@@ -4,14 +4,14 @@ const stdout_fileno : isize = 1;
44
5fn syscall1(number: isize, arg1: isize) -> isize {5fn syscall1(number: isize, arg1: isize) -> isize {
6 asm volatile ("syscall"6 asm volatile ("syscall"
7 : [ret] "={rax}" (return isize)7 : [ret] "={rax}" (-> isize)
8 : [number] "{rax}" (number), [arg1] "{rdi}" (arg1)8 : [number] "{rax}" (number), [arg1] "{rdi}" (arg1)
9 : "rcx", "r11")9 : "rcx", "r11")
10}10}
1111
12fn syscall3(number: isize, arg1: isize, arg2: isize, arg3: isize) -> isize {12fn syscall3(number: isize, arg1: isize, arg2: isize, arg3: isize) -> isize {
13 asm volatile ("syscall"13 asm volatile ("syscall"
14 : [ret] "={rax}" (return isize)14 : [ret] "={rax}" (-> isize)
15 : [number] "{rax}" (number), [arg1] "{rdi}" (arg1), [arg2] "{rsi}" (arg2), [arg3] "{rdx}" (arg3)15 : [number] "{rax}" (number), [arg1] "{rdi}" (arg1), [arg2] "{rsi}" (arg2), [arg3] "{rdx}" (arg3)
16 : "rcx", "r11")16 : "rcx", "r11")
17}17}