Class StructuredSleigh.FreshLabel

java.lang.Object
ghidra.pcode.struct.StructuredSleigh.FreshLabel
All Implemented Interfaces:
StructuredSleigh.Label
Enclosing class:
StructuredSleigh

protected class StructuredSleigh.FreshLabel extends Object implements StructuredSleigh.Label
A fresh Sleigh label
  • Constructor Details

    • FreshLabel

      protected FreshLabel()
  • Method Details

    • freshOrBorrow

      public StructuredSleigh.Label freshOrBorrow()
      Description copied from interface: StructuredSleigh.Label
      Borrow this label

      This should be used whenever a statement (or its children) may need to generate a goto using the "next" label passed into it. If "next" is the fall-through label, this will generate a fresh label. If this label is already fresh, this will "borrow" the label, meaning references will be generated, but it will not produce another anchor. This is to prevent generation of duplicate anchors.

      Specified by:
      freshOrBorrow in interface StructuredSleigh.Label
      Returns:
      the resulting label
    • genAnchor

      public StringTree genAnchor()
      Description copied from interface: StructuredSleigh.Label
      Generate code for this label

      This must be the last method called on the label, because it relies on knowing whether or not the label is actually used. (The Sleigh compiler rejects code if it contains unused labels.)

      Specified by:
      genAnchor in interface StructuredSleigh.Label
      Returns:
      the Sleigh code
    • ref

      public StringTree ref()
      Description copied from interface: StructuredSleigh.Label
      Generate a reference to this label as it should appear in a Sleigh "goto" statement
      Specified by:
      ref in interface StructuredSleigh.Label
      Returns:
      the label's expression
    • genGoto

      public StringTree genGoto(StructuredSleigh.Label fall)
      Description copied from interface: StructuredSleigh.Label
      Generate a goto statement that targets this label
      Specified by:
      genGoto in interface StructuredSleigh.Label
      Parameters:
      fall - the label following the goto
      Returns:
      the Sleigh code
    • genGoto

      Description copied from interface: StructuredSleigh.Label
      Generate a conditional goto statement that targets this label
      Specified by:
      genGoto in interface StructuredSleigh.Label
      Parameters:
      cond - the condition value
      fall - the label following the goto
      Returns:
      the Sleigh code