Class Label
java.lang.Object
EDU.purdue.cs.bloat.editor.Label
Label is used to label an instruction. Labels are used
to preserve the location of branch targets. A Label consists of an
index into the code array and a boolean that determines whether or
not it starts a basic block.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if an object is equal to this label.inthashCode()Hash the label.intindex()Get the index of the label.voidsetComment(String comment) Sets the comment associated with this Label.voidsetStartsBlock(boolean startsBlock) Set if the label starts a block.booleanCheck if the label starts a block.toString()Convert the label to a string.
-
Field Details
-
TRACE
public static boolean TRACE
-
-
Constructor Details
-
Label
public Label(int index) Constructor.- Parameters:
index- A unique index for the label. For instance, its offset in the instruction array.
-
Label
public Label(int index, boolean startsBlock) Constructor.- Parameters:
index- The index of this label into the instruction arraystartsBlock- True if the label is the first instruction in a basic block, false if not.
-
-
Method Details
-
setComment
Sets the comment associated with this Label. -
setStartsBlock
public void setStartsBlock(boolean startsBlock) Set if the label starts a block.- Parameters:
startsBlock- True if the label starts a block, false if not.
-
startsBlock
public boolean startsBlock()Check if the label starts a block.- Returns:
- True if the label starts a block, false if not.
-
index
public int index()Get the index of the label.- Returns:
- The index of the label.
-
hashCode
-
equals
-
toString
-