-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for parsing asm goto
#92
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,7 +102,7 @@ class usedDefsCollectorClass = object(self) | |
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commenting here since I can only comment on the diff: We should check if these Nevertheless, let's add comments that make it clear we have not patched them to support these new constructs. |
||
method! vinst i = | ||
let handle_inst iosh i = match i with | ||
| Asm(_,_,slvl,_,_,_) -> List.iter (fun (_,s,lv) -> | ||
| Asm(_,_,Some(slvl,_,_,_),_) -> List.iter (fun (_,s,lv) -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is just ignoring the |
||
match lv with (Var v, off) -> | ||
if s.[0] = '+' then | ||
self#add_defids iosh (Lval(Var v, off)) (UD.VS.singleton v) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1644,6 +1644,7 @@ asmattr: | |
/* empty */ { [] } | ||
| VOLATILE asmattr { ("volatile", []) :: $2 } | ||
| CONST asmattr { ("const", []) :: $2 } | ||
| GOTO asmattr { ("goto", []) :: $2 } | ||
; | ||
asmtemplate: | ||
one_string_constant { [$1] } | ||
|
@@ -1652,8 +1653,8 @@ asmtemplate: | |
asmoutputs: | ||
/* empty */ { None } | ||
| COLON asmoperands asminputs | ||
{ let (ins, clobs) = $3 in | ||
Some {aoutputs = $2; ainputs = ins; aclobbers = clobs} } | ||
{ let (ins, (clobs, gotos)) = $3 in | ||
Some {aoutputs = $2; ainputs = ins; aclobbers = clobs; agotos = gotos} } | ||
; | ||
asmoperands: | ||
/* empty */ { [] } | ||
|
@@ -1670,7 +1671,7 @@ asmoperand: | |
; | ||
|
||
asminputs: | ||
/* empty */ { ([], []) } | ||
/* empty */ { ([], ([], [])) } | ||
| COLON asmoperands asmclobber | ||
{ ($2, $3) } | ||
; | ||
|
@@ -1680,8 +1681,8 @@ asmopname: | |
; | ||
|
||
asmclobber: | ||
/* empty */ { [] } | ||
| COLON asmcloberlst { $2 } | ||
/* empty */ { ([], []) } | ||
| COLON asmcloberlst asmgoto { ($2, $3) } | ||
; | ||
asmcloberlst: | ||
/* empty */ { [] } | ||
|
@@ -1692,4 +1693,17 @@ asmcloberlst_ne: | |
| one_string_constant COMMA asmcloberlst_ne { $1 :: $3 } | ||
; | ||
|
||
asmgoto: | ||
/* empty */ { [] } | ||
| COLON asmgotolst { $2 } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is just |
||
; | ||
asmgotolst: | ||
/* empty */ { [] } | ||
| asmgotolst_ne { $1 } | ||
; | ||
asmgotolst_ne: | ||
IDENT { [ fst $1 ] } | ||
| IDENT COMMA asmgotolst_ne { ( fst $1 ) :: $3 } | ||
; | ||
|
||
%% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear from here, why this additional
option
wrapping is necessary or what theNone
then means.