MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / pp_cmp

Method pp_cmp

cranelift/codegen/src/ir/layout.rs:106–123  ·  view source on GitHub ↗

Compare the program points `a` and `b` in the same block relative to this program order. Return `Less` if `a` appears in the program before `b`. This is declared as a generic such that it can be called with `Inst` and `Block` arguments directly. Depending on the implementation, there is a good chance performance will be improved for those cases where the type of either argument is known statical

(&self, a: A, b: B)

Source from the content-addressed store, hash-verified

104 /// directly. Depending on the implementation, there is a good chance performance will be
105 /// improved for those cases where the type of either argument is known statically.
106 pub fn pp_cmp<A, B>(&self, a: A, b: B) -> cmp::Ordering
107 where
108 A: Into<ProgramPoint>,
109 B: Into<ProgramPoint>,
110 {
111 let a = a.into();
112 let b = b.into();
113 debug_assert_eq!(self.pp_block(a), self.pp_block(b));
114 let a_seq = match a {
115 ProgramPoint::Block(_block) => 0,
116 ProgramPoint::Inst(inst) => self.insts[inst].seq,
117 };
118 let b_seq = match b {
119 ProgramPoint::Block(_block) => 0,
120 ProgramPoint::Inst(inst) => self.insts[inst].seq,
121 };
122 a_seq.cmp(&b_seq)
123 }
124}
125
126// Private methods for dealing with sequence numbers.

Callers 3

dominatesMethod · 0.80
rpo_cmpMethod · 0.80
dominatesMethod · 0.80

Calls 1

cmpMethod · 0.45

Tested by

no test coverage detected