dspl.intermediate.instructions
Class CCallInstruction
java.lang.Object
dspl.intermediate.instructions.Instruction
dspl.intermediate.instructions.CCallInstruction
public class CCallInstruction
- extends Instruction
CCallInstruction is the insrtuction used for invoking external *presumably c-compiled*
functions.
Syntax: "ccall printf("hello %s\n", str1);
printf is the function name
"hello %s\n" and str1 are the two parameters
- Author:
- David
|
Constructor Summary |
CCallInstruction(java.lang.String funcName)
Constructor for CCallInstruction
Takes the function name to call |
|
Method Summary |
void |
addParameter(Variable v)
Adds a parameter to be passed (by pushing on the stack) to the function to be called |
int |
getInstType()
|
Variable[] |
getParameters()
Returns an arra of the parameters to be pased to the function. |
boolean |
usesVariable(Variable v)
Designed to be a recursive call to see if a given variable is used anymore
within a code block, after the current instruction. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
funcName
public java.lang.String funcName
parameters
public java.util.ArrayList parameters
CCallInstruction
public CCallInstruction(java.lang.String funcName)
- Constructor for CCallInstruction
Takes the function name to call
- Parameters:
funcName -
addParameter
public void addParameter(Variable v)
- Adds a parameter to be passed (by pushing on the stack) to the function to be called
- Parameters:
v - the variable to be pushed onto the stack
getParameters
public Variable[] getParameters()
- Returns an arra of the parameters to be pased to the function.
Assumed that parameters were added IN ORDER
- Returns:
usesVariable
public boolean usesVariable(Variable v)
- Description copied from class:
Instruction
- Designed to be a recursive call to see if a given variable is used anymore
within a code block, after the current instruction.
Intention is to allow a way to parse the Instruction tree to see if a
specific variable is used again.
NOTE: may not be necessary, or may need to be augmented to return a value
indicating how far away from the current instruction will it be used again
if desire to perform better register allocation.
- Specified by:
usesVariable in class Instruction
- Parameters:
v - the variable to search for to see if it is used
- Returns:
getInstType
public int getInstType()
- Specified by:
getInstType in class Instruction
- Returns:
- the instruction type of this instruction