|
|
@ -124,10 +124,11 @@
|
|
|
|
(*%token FCMP*)
|
|
|
|
(*%token FCMP*)
|
|
|
|
(*%token PHI*)
|
|
|
|
(*%token PHI*)
|
|
|
|
(*%token SELECT*)
|
|
|
|
(*%token SELECT*)
|
|
|
|
(*%token CALL*)
|
|
|
|
%token CALL
|
|
|
|
(*%token VA_ARG*)
|
|
|
|
(*%token VA_ARG*)
|
|
|
|
(*%token LANDINGPAD*)
|
|
|
|
(*%token LANDINGPAD*)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%token DBG_DECLARE
|
|
|
|
%token <string> NAMED_GLOBAL
|
|
|
|
%token <string> NAMED_GLOBAL
|
|
|
|
%token <string> NAMED_LOCAL
|
|
|
|
%token <string> NAMED_LOCAL
|
|
|
|
%token <int> NUMBERED_GLOBAL
|
|
|
|
%token <int> NUMBERED_GLOBAL
|
|
|
@ -235,20 +236,21 @@ ptr_typ:
|
|
|
|
| tp = typ STAR { tp }
|
|
|
|
| tp = typ STAR { tp }
|
|
|
|
|
|
|
|
|
|
|
|
block:
|
|
|
|
block:
|
|
|
|
| LBRACE annotated_instrs = annotated_instr* RBRACE { annotated_instrs }
|
|
|
|
| LBRACE annotated_instrs = annotated_instr* RBRACE { Utils.list_flatten_options annotated_instrs }
|
|
|
|
|
|
|
|
|
|
|
|
annotated_instr:
|
|
|
|
annotated_instr:
|
|
|
|
| instruction=instr anno=annotation? { (instruction, anno) }
|
|
|
|
| instruction = real_instr anno = annotation? { Some (instruction, anno) }
|
|
|
|
|
|
|
|
| debug_instr annotation? { None }
|
|
|
|
|
|
|
|
|
|
|
|
annotation:
|
|
|
|
annotation:
|
|
|
|
| COMMA DEBUG_ANNOTATION i=NUMBERED_METADATA { Annotation i }
|
|
|
|
| COMMA DEBUG_ANNOTATION i = NUMBERED_METADATA { Annotation i }
|
|
|
|
|
|
|
|
|
|
|
|
instr:
|
|
|
|
real_instr:
|
|
|
|
(* terminator instructions *)
|
|
|
|
(* terminator instructions *)
|
|
|
|
| RET tp = typ op = operand { Ret (Some (tp, op)) }
|
|
|
|
| RET tp = typ op = operand { Ret (Some (tp, op)) }
|
|
|
|
| RET VOID { Ret None }
|
|
|
|
| RET VOID { Ret None }
|
|
|
|
| BR LABEL lbl = variable { UncondBranch lbl }
|
|
|
|
| BR LABEL lbl = variable { UncondBranch lbl }
|
|
|
|
| BR i=INT op = operand COMMA LABEL lbl1 = variable COMMA LABEL lbl2 = variable { CondBranch (op, lbl1, lbl2) }
|
|
|
|
| BR i = INT op = operand COMMA LABEL lbl1 = variable COMMA LABEL lbl2 = variable { CondBranch (op, lbl1, lbl2) }
|
|
|
|
(* Memory access operations *)
|
|
|
|
(* Memory access operations *)
|
|
|
|
| var = variable EQUALS ALLOCA tp = typ align? { Alloc (var, tp, 1) }
|
|
|
|
| var = variable EQUALS ALLOCA tp = typ align? { Alloc (var, tp, 1) }
|
|
|
|
| var = variable EQUALS LOAD tp = ptr_typ ptr = variable align? { Load (var, tp, ptr) }
|
|
|
|
| var = variable EQUALS LOAD tp = ptr_typ ptr = variable align? { Load (var, tp, ptr) }
|
|
|
@ -256,6 +258,9 @@ instr:
|
|
|
|
(* don't yet know why val_tp and ptr_tp would be different *)
|
|
|
|
(* don't yet know why val_tp and ptr_tp would be different *)
|
|
|
|
| variable EQUALS binop { Binop }
|
|
|
|
| variable EQUALS binop { Binop }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
debug_instr:
|
|
|
|
|
|
|
|
| CALL VOID DBG_DECLARE LPAREN separated_list(COMMA, metadata_component) RPAREN { () }
|
|
|
|
|
|
|
|
|
|
|
|
align:
|
|
|
|
align:
|
|
|
|
| COMMA ALIGN sz = CONSTANT_INT { sz }
|
|
|
|
| COMMA ALIGN sz = CONSTANT_INT { sz }
|
|
|
|
|
|
|
|
|
|
|
|