History

Add __builtin_frame_address(0)

Adding the GCC extension __builtin_frame_address(). We support only zero as the argument for now. With this functionality, we can implement GCC compatible stdarg by macros in x86-64.

Shinichiro Hamaji committed 17 years ago

Commit d6072d31 parent 73a84ce2 files · +19 −0Browse files

Unified · Split

2 files
  1. tcc.c +18 −0
  2. tcctok.h +1 −0
tcc.c+18−0
@@ -7599,6 +7599,24 @@ static void unary(void) · 7598 unmodified lines
7599 vpushi(res);7599 vpushi(res);
7600 }7600 }
7601 break;7601 break;
7602 case TOK_builtin_frame_address:
7603 {
7604 CType type;
7605 next();
7606 skip('(');
7607 if (tok != TOK_CINT) {
7608 error("__builtin_frame_address only takes integers");
7609 }
7610 if (tokc.i != 0) {
7611 error("TCC only supports __builtin_frame_address(0)");
7612 }
7613 next();
7614 skip(')');
7615 type.t = VT_VOID;
7616 mk_pointer(&type);
7617 vset(&type, VT_LOCAL, 0);
7618 }
7619 break;
7602 case TOK_INC:7620 case TOK_INC:
7603 case TOK_DEC:7621 case TOK_DEC:
7604 t = tok;7622 t = tok;
tcctok.h+1−0
@@ -109,6 +109,7 @@ · 108 unmodified lines
109 DEF(TOK_NORETURN2, "__noreturn__")109 DEF(TOK_NORETURN2, "__noreturn__")
110 DEF(TOK_builtin_types_compatible_p, "__builtin_types_compatible_p")110 DEF(TOK_builtin_types_compatible_p, "__builtin_types_compatible_p")
111 DEF(TOK_builtin_constant_p, "__builtin_constant_p")111 DEF(TOK_builtin_constant_p, "__builtin_constant_p")
112 DEF(TOK_builtin_frame_address, "__builtin_frame_address")
112 DEF(TOK_REGPARM1, "regparm")113 DEF(TOK_REGPARM1, "regparm")
113 DEF(TOK_REGPARM2, "__regparm__")114 DEF(TOK_REGPARM2, "__regparm__")
114 115

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t