MCPcopy Create free account
hub / github.com/diem/move / fmt

Method fmt

language/move-prover/bytecode/src/stackless_bytecode.rs:740–822  ·  view source on GitHub ↗
(&self, f: &mut Formatter<'_>)

Source from the content-addressed store, hash-verified

738
739impl<'env> fmt::Display for BytecodeDisplay<'env> {
740 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
741 use Bytecode::*;
742 match &self.bytecode {
743 Assign(_, dst, src, AssignKind::Copy) => {
744 write!(f, "{} := copy({})", self.lstr(*dst), self.lstr(*src))?
745 }
746 Assign(_, dst, src, AssignKind::Move) => {
747 write!(f, "{} := move({})", self.lstr(*dst), self.lstr(*src))?
748 }
749 Assign(_, dst, src, AssignKind::Store) => {
750 write!(f, "{} := {}", self.lstr(*dst), self.lstr(*src))?
751 }
752 Call(_, dsts, oper, args, aa) => {
753 if !dsts.is_empty() {
754 self.fmt_locals(f, dsts, false)?;
755 write!(f, " := ")?;
756 }
757 write!(f, "{}", oper.display(self.func_target))?;
758 self.fmt_locals(f, args, true)?;
759 if let Some(AbortAction(label, code)) = aa {
760 write!(
761 f,
762 " on_abort goto {} with {}",
763 self.label_str(*label),
764 self.lstr(*code)
765 )?;
766 }
767 }
768 Ret(_, srcs) => {
769 write!(f, "return ")?;
770 self.fmt_locals(f, srcs, false)?;
771 }
772 Load(_, dst, cons) => {
773 write!(f, "{} := {}", self.lstr(*dst), cons)?;
774 }
775 Branch(_, then_label, else_label, src) => {
776 write!(
777 f,
778 "if ({}) goto {} else goto {}",
779 self.lstr(*src),
780 self.label_str(*then_label),
781 self.label_str(*else_label),
782 )?;
783 }
784 Jump(_, label) => {
785 write!(f, "goto {}", self.label_str(*label))?;
786 }
787 Label(_, label) => {
788 write!(f, "label L{}", label.as_usize())?;
789 }
790 Abort(_, src) => {
791 write!(f, "abort({})", self.lstr(*src))?;
792 }
793 Nop(_) => {
794 write!(f, "nop")?;
795 }
796 SaveMem(_, label, qid) => {
797 let env = self.func_target.global_env();

Callers

nothing calls this directly

Calls 15

fmt_localsMethod · 0.80
get_spec_varMethod · 0.80
into_functionMethod · 0.80
fmt_type_argsMethod · 0.80
get_field_by_offsetMethod · 0.80
to_ownedMethod · 0.80
to_qualified_idMethod · 0.80
StructClass · 0.50
is_emptyMethod · 0.45
global_envMethod · 0.45
get_moduleMethod · 0.45
displayMethod · 0.45

Tested by

no test coverage detected