edu.cmu.cs.crystal.tac
Interface LoadLiteralInstruction

All Superinterfaces:
AssignmentInstruction, LoadInstruction, TACInstruction

public interface LoadLiteralInstruction
extends LoadInstruction

x = l, an assignment of a literal value to a variable. Example:
a = 4;

Author:
Kevin Bierhoff

Method Summary
 java.lang.Object getLiteral()
          This method returns the literal node that is being assigned in this 3 address code statement.
 ASTNode getNode()
          Returns the node this instruction is for.
 boolean isNonNullString()
          Indicates whether this loads a string literal.
 boolean isNull()
          Indicates whether this loads the null literal.
 boolean isNumber()
          Indicates the load of a number such as an int.
 boolean isPrimitive()
          Indicates the load of a primitive value.
 
Methods inherited from interface edu.cmu.cs.crystal.tac.AssignmentInstruction
getTarget
 
Methods inherited from interface edu.cmu.cs.crystal.tac.TACInstruction
transfer, transfer
 

Method Detail

getNode

ASTNode getNode()
Returns the node this instruction is for. Should be of type Expression. Usually, one instruction exists per AST node, but can be more when AST nodes are desugared, such as for post-increment.

Specified by:
getNode in interface TACInstruction
Returns:
the node this instruction is for.
See Also:
TACInstruction.getNode()

getLiteral

java.lang.Object getLiteral()
This method returns the literal node that is being assigned in this 3 address code statement. (The isPrimitive() isNull() methods may be helpful here if you are trying to do something clever based on which literal is actually being assigned.
Note also that if you want to otherwise find out what the literal value is, you are probably going to have to use instanceof tests on the return type and cast it into something that is actually helpful.

Returns:
the literal node that is being assigned in this 3 address code statement.

isPrimitive

boolean isPrimitive()
Indicates the load of a primitive value.

Returns:
true if this is a load of a primitive value, false otherwise.

isNumber

boolean isNumber()
Indicates the load of a number such as an int. Implies isPrimitive()

Returns:
true if this is a load of a number, false otherwise.

isNull

boolean isNull()
Indicates whether this loads the null literal.

Returns:
true if this loads the null literal, false otherwise.

isNonNullString

boolean isNonNullString()
Indicates whether this loads a string literal.

Returns:
true if this loads a string, false otherwise.