-
Notifications
You must be signed in to change notification settings - Fork 5
Aslp generating control flow branches #188
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
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
06e1e8a
sort out lexprs
katrinafyi b351ec6
fix potential id clash because we were post-processing the unique IDs
katrinafyi e3f5545
fill out bv op gens
katrinafyi ba30114
has_pc_assign
katrinafyi f7d5ece
ensure pc consistcne
katrinafyi efcdda4
add_goto
katrinafyi b493102
a gen branch might split a block down the middle :(
katrinafyi 8b67661
noncrashing
katrinafyi bc9430d
propagate has_pc_assign
katrinafyi 37d6e65
shared entry+exit
katrinafyi 1b5253e
globalvar
katrinafyi 4dfd54b
fix scopes
katrinafyi b96f50a
add aslp_lexpr lol
katrinafyi 6ddb526
rename aslp_block to aslp_diamond
katrinafyi e343d08
rename to diamond
katrinafyi 85e154b
remove ~exit to avoid double increment
katrinafyi 693dc1e
use stringset and slightly smarter pc propagation
katrinafyi f5a7ec6
touch
katrinafyi 700ada1
touch
katrinafyi 45bc560
x
katrinafyi 15d8f33
match on `BranchTaken = true` to detect has_pc_assign
katrinafyi c219370
avoid `ref`
katrinafyi dbe34b4
simplify the branch types
katrinafyi af7fd51
match on any assigns to branchtaken
katrinafyi 9b0393a
" " PC
katrinafyi 84cd590
has_pc_assign assertion
katrinafyi 12103ae
fix silly bug and add double PC assumption
katrinafyi e4fbb19
%>
katrinafyi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| open Lang | ||
| open Common | ||
|
|
||
| (** A variable used by the ASLp lifter. Can be converted to a Bincaml {!Var.t}. | ||
| *) | ||
| type t = | ||
| | Local of string * Types.t | ||
| | PC | ||
| | R of int option | ||
| (** A 64-bit ordinary register. [None] is used to represent the virtual | ||
| "array" of registers, since ASLp uses [f_gen_array_load] to access | ||
| registers. *) | ||
| | Z of int option (** A 128-bit scalar register. *) | ||
| | SP_EL0 | ||
| | FPSR | ||
| | FPCR | ||
| | PSTATE_C | ||
| | PSTATE_Z | ||
| | PSTATE_V | ||
| | PSTATE_N | ||
| | PSTATE_A | ||
| | PSTATE_D | ||
| | PSTATE_DIT | ||
| | PSTATE_F | ||
| | PSTATE_I | ||
| | PSTATE_PAN | ||
| | PSTATE_SP | ||
| | PSTATE_SSBS | ||
| | PSTATE_TCO | ||
| | PSTATE_UAO | ||
| | PSTATE_BTYPE | ||
| | BTypeCompatible | ||
| | BranchTaken | ||
| | BTypeNext | ||
| | ExclusiveLocal | ||
| [@@deriving show { with_path = false }] | ||
|
|
||
| let typ (x : t) = | ||
| let bv = Types.bv in | ||
| match x with | ||
| | Local (_, t) -> t | ||
| | R (Some _) -> bv 64 | ||
| | Z (Some _) -> bv 128 | ||
| | PC -> bv 64 | ||
| | SP_EL0 -> bv 64 | ||
| | FPSR -> bv 64 | ||
| | FPCR -> bv 64 | ||
| | PSTATE_C | PSTATE_Z | PSTATE_V | PSTATE_N | PSTATE_A | PSTATE_I | PSTATE_F | ||
| | PSTATE_D | PSTATE_DIT | PSTATE_PAN | PSTATE_SP | PSTATE_SSBS | PSTATE_TCO | ||
| | PSTATE_UAO | PSTATE_BTYPE -> | ||
| bv 1 | ||
| | BTypeCompatible -> Types.Boolean | ||
| | BranchTaken -> Types.Boolean | ||
| | BTypeNext -> bv 2 | ||
| | ExclusiveLocal -> Types.Boolean | ||
| | R None | Z None -> failwith "typeof_lexpr: array lexpr has no bincaml type" | ||
|
|
||
| let name = function | ||
| | Local (v, _) -> v | ||
| | R (Some n) -> Printf.sprintf "R%d" n | ||
| | Z (Some n) -> Printf.sprintf "Z%d" n | ||
| | R None | Z None -> failwith "name_of_lexpr: array lexpr has no bincaml name" | ||
| | v -> show v | ||
|
|
||
| let scope = function | ||
| | Local _ -> Var.LocalVar | ||
| | BranchTaken | BTypeCompatible | BTypeNext -> LocalVar | ||
| | _ -> GlobalVar | ||
|
|
||
| let to_var x = | ||
| let ty = typ x and name = name x and scope = scope x in | ||
| let name = match scope with GlobalVar -> "$" ^ name | _ -> name in | ||
| Var.create ~scope name ty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Mention guarantee from lifter that it won't assign PC twice.