Skip to content

Commit

Permalink
rename use_def_lists.rs to value.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
vaivaswatha committed Aug 16, 2024
1 parent 3c6a942 commit 2736a18
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pliron-llvm/src/from_llvm_ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use pliron::{
operation::Operation,
r#type::{TypeObj, TypePtr},
result::Result,
use_def_lists::Value,
value::Value,
};
use rustc_hash::{FxHashMap, FxHashSet};
use thiserror::Error;
Expand Down
2 changes: 1 addition & 1 deletion pliron-llvm/src/op_interfaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use pliron::{
operation::Operation,
r#type::{TypeObj, Typed},
result::Result,
use_def_lists::Value,
value::Value,
verify_err,
};

Expand Down
2 changes: 1 addition & 1 deletion pliron-llvm/src/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ use pliron::{
parsable::Parsable,
r#type::{TypeObj, TypePtr},
result::{Error, ErrorKind, Result},
use_def_lists::Value,
utils::vec_exns::VecExtns,
value::Value,
verify_err,
};

Expand Down
2 changes: 1 addition & 1 deletion pliron-llvm/src/to_llvm_ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use pliron::{
operation::Operation,
r#type::{type_cast, Type, TypeObj, TypePtr, Typed},
result::Result,
use_def_lists::Value,
value::Value,
};

use rustc_hash::FxHashMap;
Expand Down
2 changes: 1 addition & 1 deletion src/basic_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ use crate::{
r#type::{TypeObj, Typed},
region::Region,
result::Result,
use_def_lists::{DefNode, Value},
utils::vec_exns::VecExtns,
value::{DefNode, Value},
};

/// Argument to a [BasicBlock]
Expand Down
2 changes: 1 addition & 1 deletion src/builtin/op_interfaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{
r#type::{TypeObj, TypePtr, Typed},
region::Region,
result::Result,
use_def_lists::Value,
value::Value,
verify_err, verify_error,
};

Expand Down
2 changes: 1 addition & 1 deletion src/irfmt/parsers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
parsable::{Parsable, ParseResult, StateStream},
r#type::TypeObj,
result::Result,
use_def_lists::Value,
value::Value,
};
use combine::{
between, many1,
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ pub mod result;
pub mod storage_uniquer;
pub mod r#type;
pub mod uniqued_any;
pub mod use_def_lists;
pub mod utils;
pub mod value;
4 changes: 2 additions & 2 deletions src/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ use crate::{
r#type::{TypeObj, Typed},
region::Region,
result::Result,
use_def_lists::{DefNode, DefTrait, DefUseParticipant, Use, UseNode, Value},
utils::vec_exns::VecExtns,
value::{DefNode, DefTrait, DefUseParticipant, Use, UseNode, Value},
verify_err,
};

Expand Down Expand Up @@ -231,7 +231,7 @@ impl Operation {

/// Does any result of this operation have a use?
pub fn has_use(&self) -> bool {
self.results.iter().any(|res| res.def.has_use())
self.results.iter().any(|res| res.def.is_used())
}

/// Total number of uses (across all results).
Expand Down
2 changes: 1 addition & 1 deletion src/parsable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
op::op_impls,
operation::Operation,
result::{self, Result},
use_def_lists::Value,
value::Value,
};
use combine::{
easy::{self, Errors, ParseError},
Expand Down
12 changes: 6 additions & 6 deletions src/use_def_lists.rs → src/value.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! # Use-Def and Def-Use Graph.
//! Like in LLVM, at the core of the IR infrastructure are SSA use-def chains.
//! # SSA [Value]s: Use-Def and Def-Use Graph.
//! At the core of the IR infrastructure are SSA use-def chains.
//! Use-def and def-use chains are composed of four key structures:
//! - [Value] describes a value definition, either a block argument, or an operation result.
//! - [`Ptr<BasicBlock>`] describes a block definition.
Expand Down Expand Up @@ -46,7 +46,7 @@ impl<T: DefUseParticipant> DefNode<T> {
}

/// Does the definition have a use?
pub(crate) fn has_use(&self) -> bool {
pub(crate) fn is_used(&self) -> bool {
!self.uses.is_empty()
}

Expand Down Expand Up @@ -138,8 +138,8 @@ impl Value {
}

/// Does this definition have any [Use]?
pub fn has_use(&self, ctx: &Context) -> bool {
self.get_defnode_ref(ctx).has_use()
pub fn is_used(&self, ctx: &Context) -> bool {
self.get_defnode_ref(ctx).is_used()
}

/// Replace uses of the underlying definition, that satisfy `pred`, with `other`.
Expand Down Expand Up @@ -252,7 +252,7 @@ impl UseTrait for Value {
impl Ptr<BasicBlock> {
/// Does this block a predecessor?
pub fn has_pred(&self, ctx: &Context) -> bool {
self.deref(ctx).preds.has_use()
self.deref(ctx).preds.is_used()
}

/// Number of predecessors to this block.
Expand Down
2 changes: 1 addition & 1 deletion tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use pliron::{
parsable::{self, IntoParseResult, Parsable, ParseResult, StateStream},
printable::{self, Printable},
result::Result,
use_def_lists::Value,
value::Value,
};
use pliron_derive::def_op;

Expand Down

0 comments on commit 2736a18

Please sign in to comment.