Commit d701731b by Enkelmann Committed by Enkelmann

cargo fmt

parent 5343432e
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
use super::interprocedural_fixpoint::{Computation, NodeValue}; use super::interprocedural_fixpoint::{Computation, NodeValue};
use crate::abstract_domain::{BitvectorDomain, DataDomain}; use crate::abstract_domain::{BitvectorDomain, DataDomain};
use crate::analysis::graph::{Graph, Node}; use crate::analysis::graph::{Graph, Node};
use crate::prelude::*;
use crate::term::*; use crate::term::*;
use crate::utils::log::*; use crate::utils::log::*;
use petgraph::graph::NodeIndex; use petgraph::graph::NodeIndex;
use petgraph::visit::IntoNodeReferences; use petgraph::visit::IntoNodeReferences;
use petgraph::Direction; use petgraph::Direction;
use std::collections::HashMap; use std::collections::HashMap;
use crate::prelude::*;
mod context; mod context;
mod object; mod object;
......
...@@ -33,10 +33,7 @@ pub enum Expression { ...@@ -33,10 +33,7 @@ pub enum Expression {
rhs: Box<Expression>, rhs: Box<Expression>,
}, },
/// A unary operation /// A unary operation
UnOp { UnOp { op: UnOpType, arg: Box<Expression> },
op: UnOpType,
arg: Box<Expression>,
},
/// A cast operation for type cast between integer and floating point types of different byte lengths. /// A cast operation for type cast between integer and floating point types of different byte lengths.
Cast { Cast {
op: CastOpType, op: CastOpType,
...@@ -46,10 +43,7 @@ pub enum Expression { ...@@ -46,10 +43,7 @@ pub enum Expression {
/// An unknown value but with known size. /// An unknown value but with known size.
/// This may be generated for e.g. unsupported assembly instructions. /// This may be generated for e.g. unsupported assembly instructions.
/// Note that computation of an unknown value is still required to be side-effect-free! /// Note that computation of an unknown value is still required to be side-effect-free!
Unknown { Unknown { description: String, size: ByteSize },
description: String,
size: ByteSize,
},
/// Extracting a sub-bitvector from the argument expression. /// Extracting a sub-bitvector from the argument expression.
Subpiece { Subpiece {
low_byte: ByteSize, low_byte: ByteSize,
......
...@@ -53,10 +53,7 @@ pub enum Def { ...@@ -53,10 +53,7 @@ pub enum Def {
/// ///
/// The size of `var` also determines the number of bytes read from memory. /// The size of `var` also determines the number of bytes read from memory.
/// The size of `address` is required to match the pointer size of the corresponding CPU architecture. /// The size of `address` is required to match the pointer size of the corresponding CPU architecture.
Load { Load { var: Variable, address: Expression },
var: Variable,
address: Expression,
},
/// A memory store operation. /// A memory store operation.
/// ///
/// The size of `value` determines the number of bytes written. /// The size of `value` determines the number of bytes written.
...@@ -66,10 +63,7 @@ pub enum Def { ...@@ -66,10 +63,7 @@ pub enum Def {
value: Expression, value: Expression,
}, },
/// A register assignment, assigning the result of the expression `value` to the register `var`. /// A register assignment, assigning the result of the expression `value` to the register `var`.
Assign { Assign { var: Variable, value: Expression },
var: Variable,
value: Expression,
},
} }
/// A `Jmp` instruction affects the control flow of a program, i.e. it may change the instruction pointer. /// A `Jmp` instruction affects the control flow of a program, i.e. it may change the instruction pointer.
...@@ -87,18 +81,12 @@ pub enum Jmp { ...@@ -87,18 +81,12 @@ pub enum Jmp {
/// An indirect intraprocedural jump to the address that the given expression evaluates to. /// An indirect intraprocedural jump to the address that the given expression evaluates to.
BranchInd(Expression), BranchInd(Expression),
/// A direct intraprocedural jump that is only taken if the condition evaluates to true (i.e. not zero). /// A direct intraprocedural jump that is only taken if the condition evaluates to true (i.e. not zero).
CBranch { CBranch { target: Tid, condition: Expression },
target: Tid,
condition: Expression,
},
/// A direct interprocedural jump representing a subroutine call. /// A direct interprocedural jump representing a subroutine call.
/// ///
/// Note that this is syntactically equivalent to a `Jmp::Branch`. /// Note that this is syntactically equivalent to a `Jmp::Branch`.
/// If the `return_` is `None`, then the called function does not return to its caller. /// If the `return_` is `None`, then the called function does not return to its caller.
Call { Call { target: Tid, return_: Option<Tid> },
target: Tid,
return_: Option<Tid>,
},
/// An indirect interprocedural jump to the address the `target` expression evaluates to /// An indirect interprocedural jump to the address the `target` expression evaluates to
/// and representing a subroutine call. /// and representing a subroutine call.
/// ///
......
...@@ -7,8 +7,8 @@ use crate::intermediate_representation::Jmp as IrJmp; ...@@ -7,8 +7,8 @@ use crate::intermediate_representation::Jmp as IrJmp;
use crate::intermediate_representation::Program as IrProgram; use crate::intermediate_representation::Program as IrProgram;
use crate::intermediate_representation::Project as IrProject; use crate::intermediate_representation::Project as IrProject;
use crate::intermediate_representation::Sub as IrSub; use crate::intermediate_representation::Sub as IrSub;
use serde::{Deserialize, Serialize};
use crate::intermediate_representation::{Term, Tid}; use crate::intermediate_representation::{Term, Tid};
use serde::{Deserialize, Serialize};
pub mod symbol; pub mod symbol;
use symbol::ExternSymbol; use symbol::ExternSymbol;
...@@ -207,7 +207,10 @@ impl From<Blk> for IrBlk { ...@@ -207,7 +207,10 @@ impl From<Blk> for IrBlk {
} else { } else {
for (counter, ir_def) in ir_defs.into_iter().enumerate() { for (counter, ir_def) in ir_defs.into_iter().enumerate() {
ir_def_terms.push(Term { ir_def_terms.push(Term {
tid: def_term.tid.clone().with_id_suffix(&format!("_{}", counter)), tid: def_term
.tid
.clone()
.with_id_suffix(&format!("_{}", counter)),
term: ir_def, term: ir_def,
}); });
} }
...@@ -224,7 +227,10 @@ impl From<Blk> for IrBlk { ...@@ -224,7 +227,10 @@ impl From<Blk> for IrBlk {
} }
for (counter, ir_def) in ir_defs.into_iter().enumerate() { for (counter, ir_def) in ir_defs.into_iter().enumerate() {
ir_def_terms.push(Term { ir_def_terms.push(Term {
tid: jmp_term.tid.clone().with_id_suffix(&format!("_{}", counter)), tid: jmp_term
.tid
.clone()
.with_id_suffix(&format!("_{}", counter)),
term: ir_def, term: ir_def,
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment