Skip to content

Commit

Permalink
refactor: rename accidentally-changed Extension::add_node_xxx back to…
Browse files Browse the repository at this point in the history
… add_op (#659)

Ooops, these were accidentally hit by renaming in #642 .

Driveby: change a couple of `add_op_custom_sig`'s in extension.rs to use
the `custom_sig_simple` variant
  • Loading branch information
acl-cqc authored Nov 8, 2023
1 parent 2269161 commit 5bcb185
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 88 deletions.
8 changes: 4 additions & 4 deletions src/extension/op_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ impl Extension {
}

/// Create an OpDef with custom binary code to compute the signature
pub fn add_node_custom_sig(
pub fn add_op_custom_sig(
&mut self,
name: SmolStr,
description: String,
Expand All @@ -291,14 +291,14 @@ impl Extension {

/// Create an OpDef with custom binary code to compute the signature, and no "misc" or "lowering
/// functions" defined.
pub fn add_node_custom_sig_simple(
pub fn add_op_custom_sig_simple(
&mut self,
name: SmolStr,
description: String,
params: Vec<TypeParam>,
signature_func: impl CustomSignatureFunc + 'static,
) -> Result<&OpDef, ExtensionBuildError> {
self.add_node_custom_sig(
self.add_op_custom_sig(
name,
description,
params,
Expand All @@ -310,7 +310,7 @@ impl Extension {

/// Create an OpDef with a signature (inputs+outputs) read from the
/// declarative YAML
pub fn add_node_decl_sig(
pub fn add_op_decl_sig(
&mut self,
name: SmolStr,
description: String,
Expand Down
2 changes: 1 addition & 1 deletion src/extension/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ lazy_static! {
.unwrap();

prelude
.add_node_custom_sig_simple(
.add_op_custom_sig_simple(
SmolStr::new_inline(NEW_ARRAY_OP_ID),
"Create a new array from elements".to_string(),
vec![TypeParam::Type(TypeBound::Any), TypeParam::max_nat()],
Expand Down
8 changes: 4 additions & 4 deletions src/std_extensions/arithmetic/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,31 @@ pub fn extension() -> Extension {
);

extension
.add_node_custom_sig_simple(
.add_op_custom_sig_simple(
"trunc_u".into(),
"float to unsigned int".to_owned(),
vec![LOG_WIDTH_TYPE_PARAM],
ftoi_sig,
)
.unwrap();
extension
.add_node_custom_sig_simple(
.add_op_custom_sig_simple(
"trunc_s".into(),
"float to signed int".to_owned(),
vec![LOG_WIDTH_TYPE_PARAM],
ftoi_sig,
)
.unwrap();
extension
.add_node_custom_sig_simple(
.add_op_custom_sig_simple(
"convert_u".into(),
"unsigned int to float".to_owned(),
vec![LOG_WIDTH_TYPE_PARAM],
itof_sig,
)
.unwrap();
extension
.add_node_custom_sig_simple(
.add_op_custom_sig_simple(
"convert_s".into(),
"signed int to float".to_owned(),
vec![LOG_WIDTH_TYPE_PARAM],
Expand Down
32 changes: 16 additions & 16 deletions src/std_extensions/arithmetic/float_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,77 +41,77 @@ pub fn extension() -> Extension {
);

extension
.add_node_custom_sig_simple("feq".into(), "equality test".to_owned(), vec![], fcmp_sig)
.add_op_custom_sig_simple("feq".into(), "equality test".to_owned(), vec![], fcmp_sig)
.unwrap();
extension
.add_node_custom_sig_simple("fne".into(), "inequality test".to_owned(), vec![], fcmp_sig)
.add_op_custom_sig_simple("fne".into(), "inequality test".to_owned(), vec![], fcmp_sig)
.unwrap();
extension
.add_node_custom_sig_simple("flt".into(), "\"less than\"".to_owned(), vec![], fcmp_sig)
.add_op_custom_sig_simple("flt".into(), "\"less than\"".to_owned(), vec![], fcmp_sig)
.unwrap();
extension
.add_node_custom_sig_simple(
.add_op_custom_sig_simple(
"fgt".into(),
"\"greater than\"".to_owned(),
vec![],
fcmp_sig,
)
.unwrap();
extension
.add_node_custom_sig_simple(
.add_op_custom_sig_simple(
"fle".into(),
"\"less than or equal\"".to_owned(),
vec![],
fcmp_sig,
)
.unwrap();
extension
.add_node_custom_sig_simple(
.add_op_custom_sig_simple(
"fge".into(),
"\"greater than or equal\"".to_owned(),
vec![],
fcmp_sig,
)
.unwrap();
extension
.add_node_custom_sig_simple("fmax".into(), "maximum".to_owned(), vec![], fbinop_sig)
.add_op_custom_sig_simple("fmax".into(), "maximum".to_owned(), vec![], fbinop_sig)
.unwrap();
extension
.add_node_custom_sig_simple("fmin".into(), "minimum".to_owned(), vec![], fbinop_sig)
.add_op_custom_sig_simple("fmin".into(), "minimum".to_owned(), vec![], fbinop_sig)
.unwrap();
extension
.add_node_custom_sig_simple("fadd".into(), "addition".to_owned(), vec![], fbinop_sig)
.add_op_custom_sig_simple("fadd".into(), "addition".to_owned(), vec![], fbinop_sig)
.unwrap();
extension
.add_node_custom_sig_simple("fsub".into(), "subtraction".to_owned(), vec![], fbinop_sig)
.add_op_custom_sig_simple("fsub".into(), "subtraction".to_owned(), vec![], fbinop_sig)
.unwrap();
extension
.add_node_custom_sig_simple("fneg".into(), "negation".to_owned(), vec![], funop_sig)
.add_op_custom_sig_simple("fneg".into(), "negation".to_owned(), vec![], funop_sig)
.unwrap();
extension
.add_node_custom_sig_simple(
.add_op_custom_sig_simple(
"fabs".into(),
"absolute value".to_owned(),
vec![],
funop_sig,
)
.unwrap();
extension
.add_node_custom_sig_simple(
.add_op_custom_sig_simple(
"fmul".into(),
"multiplication".to_owned(),
vec![],
fbinop_sig,
)
.unwrap();
extension
.add_node_custom_sig_simple("fdiv".into(), "division".to_owned(), vec![], fbinop_sig)
.add_op_custom_sig_simple("fdiv".into(), "division".to_owned(), vec![], fbinop_sig)
.unwrap();
extension
.add_node_custom_sig_simple("ffloor".into(), "floor".to_owned(), vec![], funop_sig)
.add_op_custom_sig_simple("ffloor".into(), "floor".to_owned(), vec![], funop_sig)
.unwrap();
extension
.add_node_custom_sig_simple("fceil".into(), "ceiling".to_owned(), vec![], funop_sig)
.add_op_custom_sig_simple("fceil".into(), "ceiling".to_owned(), vec![], funop_sig)
.unwrap();

extension
Expand Down
Loading

0 comments on commit 5bcb185

Please sign in to comment.