-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dataflow): Untested reaching definitions analysis
- Loading branch information
1 parent
985e65e
commit 9fda4eb
Showing
8 changed files
with
351 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 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,8 @@ | ||
[package] | ||
name = "bril-util" | ||
version.workspace = true | ||
edition.workspace = true | ||
license-file.workspace = true | ||
|
||
[dependencies] | ||
bril-rs.workspace = true |
This file contains 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,49 @@ | ||
use bril_rs::{Instruction, Literal}; | ||
|
||
#[derive(PartialEq, Eq, Hash, Clone, Debug)] | ||
pub enum InstructionValue { | ||
Argument, | ||
/// literal string + is float | ||
Constant(String, bool), | ||
Op(String, Vec<String>, Vec<String>, Vec<String>), | ||
} | ||
|
||
pub trait InstructionExt { | ||
fn kill(&self) -> Option<&String>; | ||
|
||
fn value(&self) -> Option<InstructionValue>; | ||
} | ||
|
||
impl InstructionExt for Instruction { | ||
fn kill(&self) -> Option<&String> { | ||
match self { | ||
Instruction::Constant { dest, .. } | ||
| Instruction::Value { dest, .. } => Some(dest), | ||
Instruction::Effect { .. } => None, | ||
} | ||
} | ||
|
||
fn value(&self) -> Option<InstructionValue> { | ||
match self { | ||
Instruction::Constant { value, .. } => { | ||
Some(InstructionValue::Constant( | ||
value.to_string(), | ||
matches!(value, Literal::Float(_)), | ||
)) | ||
} | ||
Instruction::Value { | ||
op, | ||
args, | ||
funcs, | ||
labels, | ||
.. | ||
} => Some(InstructionValue::Op( | ||
op.to_string(), | ||
args.clone(), | ||
funcs.clone(), | ||
labels.clone(), | ||
)), | ||
Instruction::Effect { .. } => None, | ||
} | ||
} | ||
} |
This file contains 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,13 @@ | ||
[package] | ||
name = "dataflow" | ||
version.workspace = true | ||
edition.workspace = true | ||
license-file.workspace = true | ||
|
||
[dependencies] | ||
argh.workspace = true | ||
snafu.workspace = true | ||
bril-rs.workspace = true | ||
serde_json.workspace = true | ||
build-cfg = { path = "../../lesson2/build-cfg" } | ||
bril-util = { path = "../bril-util/" } |
Oops, something went wrong.