aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/pre_parser.mly
diff options
context:
space:
mode:
authorXavier Leroy <xavierleroy@users.noreply.github.com>2015-04-22 14:27:12 +0200
committerXavier Leroy <xavierleroy@users.noreply.github.com>2015-04-22 14:27:12 +0200
commit0bf99217426a44046ef0aaa7f84a9b2a3646ed89 (patch)
treee4f983980a5001792b90ed8f3dbd8fa241e43eb1 /cparser/pre_parser.mly
parent08b2b46f15e70b11c044e4e9a7c8438a96d57ed7 (diff)
parentca4aa822693f4d98de99fd3f13c1523d733e1cb0 (diff)
downloadcompcert-kvx-0bf99217426a44046ef0aaa7f84a9b2a3646ed89.tar.gz
compcert-kvx-0bf99217426a44046ef0aaa7f84a9b2a3646ed89.zip
Merge pull request #40 from AbsInt/inline-asm
GCC-style extended inline asm. The subset implemented is: - zero or one output - output constraints "=r" (to register) or "=m" (to memory) - zero, one or several inputs - input constraints "r" (in register), "m" (in memory), "i" and "n" (compile-time integer constant) - clobbered registers (the 3rd argument) - both anonymous (%3) and named (%[name]) operands - modifiers %R and %Q to refer to the most significant / least significant part of a register pair holding a 64-bit integer. (Undocumented GCC ARM feature.) All asm statements are treated as "volatile", possibly modifying memory and condition codes.
Diffstat (limited to 'cparser/pre_parser.mly')
-rw-r--r--cparser/pre_parser.mly38
1 files changed, 37 insertions, 1 deletions
diff --git a/cparser/pre_parser.mly b/cparser/pre_parser.mly
index ef356d3a..44a06f8a 100644
--- a/cparser/pre_parser.mly
+++ b/cparser/pre_parser.mly
@@ -616,7 +616,43 @@ jump_statement:
{}
asm_statement:
-| ASM VOLATILE? LPAREN string_literals_list RPAREN SEMICOLON
+| ASM asm_attributes LPAREN string_literals_list asm_arguments RPAREN SEMICOLON
+ {}
+
+asm_attributes:
+| /* empty */
+| CONST asm_attributes
+| VOLATILE asm_attributes
+ {}
+
+asm_arguments:
+| /* empty */
+| COLON asm_operands
+| COLON asm_operands COLON asm_operands
+| COLON asm_operands COLON asm_operands COLON asm_flags
+ {}
+
+asm_operands:
+| /* empty */
+| asm_operands_ne
+ {}
+
+asm_operands_ne:
+| asm_operands_ne COMMA asm_operand
+| asm_operand
+ {}
+
+asm_operand:
+| asm_op_name string_literals_list LPAREN expression RPAREN
+ {}
+
+asm_op_name:
+| /*empty*/ {}
+| LBRACK i = general_identifier RBRACK { set_id_type i OtherId }
+
+asm_flags:
+| string_literals_list
+| string_literals_list COMMA asm_flags
{}
translation_unit_file: