Class MetaOperation
- java.lang.Object
-
- ru.ispras.microtesk.model.metadata.MetaOperation
-
- All Implemented Interfaces:
MetaData
public class MetaOperation extends java.lang.Object implements MetaData
TheMetaOperation
class stores information on the given operation.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
MetaOperation(java.lang.String name, java.lang.String typeName, boolean isRoot, boolean branch, boolean conditionalBranch, boolean exception, boolean load, boolean store, int blockSize)
MetaOperation(java.lang.String name, java.lang.String typeName, boolean isRoot, java.util.Map<java.lang.String,MetaArgument> args, java.util.Map<java.lang.String,MetaShortcut> shortcuts, boolean branch, boolean conditionalBranch, boolean exception, boolean load, boolean store, int blockSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addArgument(MetaArgument argument)
protected void
addShortcut(java.lang.String contextName, MetaOperation operation)
boolean
canThrowException()
Checks whether the current operation can throw an exception.MetaArgument
getArgument(java.lang.String name)
Return an argument of the given operation that has the specified name.java.lang.Iterable<MetaArgument>
getArguments()
Returns a collection of operation arguments.int
getBlockSize()
Returns the size of block read or written to memory.Type
getDataType()
Returns the type associated with the metadata element ornull
if the element has no type.int
getDelaySlotSize()
Checks the operation has a delay slot.java.util.Collection<java.lang.String>
getExceptions()
Returns the list of operation exceptions.java.util.Collection<java.lang.String>
getMarks()
Returns the list of operation marks.java.lang.String
getName()
Returns the operation name.MetaShortcut
getShortcut(java.lang.String contextName)
Returns a shortcut for the given operation that can be used in the specified context.java.lang.Iterable<MetaShortcut>
getShortcuts()
Returns a collection of shortcuts applicable to the given operation in different contexts.java.lang.Object
getSignature()
Returns the operation arguments.java.lang.String
getTypeName()
Returns the type name of the operation.boolean
hasRootShortcuts()
Checks whether the current operation has root shortcuts.boolean
isBranch()
Checks whether the operation is a branch operation (causes control transfer).boolean
isConditionalBranch()
Checks whether the operation is a conditional branch operation (causes control transfer on some condition).boolean
isLoad()
Checks whether the operation performs a memory load action.boolean
isRoot()
Checks whether the current operation is a root.boolean
isStore()
Checks whether the operation performs a memory store action.
-
-
-
Constructor Detail
-
MetaOperation
public MetaOperation(java.lang.String name, java.lang.String typeName, boolean isRoot, java.util.Map<java.lang.String,MetaArgument> args, java.util.Map<java.lang.String,MetaShortcut> shortcuts, boolean branch, boolean conditionalBranch, boolean exception, boolean load, boolean store, int blockSize)
-
MetaOperation
protected MetaOperation(java.lang.String name, java.lang.String typeName, boolean isRoot, boolean branch, boolean conditionalBranch, boolean exception, boolean load, boolean store, int blockSize)
-
-
Method Detail
-
addArgument
protected final void addArgument(MetaArgument argument)
-
addShortcut
protected final void addShortcut(java.lang.String contextName, MetaOperation operation)
-
getName
public final java.lang.String getName()
Returns the operation name.
-
getTypeName
public final java.lang.String getTypeName()
Returns the type name of the operation. If a meta operation describes a shortcut the type name is different from the name. The name means the name of the target operation, while the type name means the name of the entry operation (that encapsulates the path to the target).- Returns:
- The operation type name (for composite operation the name of the topmost operation).
-
getDataType
public final Type getDataType()
Description copied from interface:MetaData
Returns the type associated with the metadata element ornull
if the element has no type.- Specified by:
getDataType
in interfaceMetaData
- Returns:
- type of the metadata element or
null
if the element has no type.
-
isRoot
public final boolean isRoot()
Checks whether the current operation is a root. An operation is a root if it does not have parents.- Returns:
true
if it is a root operation orfalse
otherwise.
-
getArguments
public final java.lang.Iterable<MetaArgument> getArguments()
Returns a collection of operation arguments.- Returns:
- Collection of operation arguments.
-
getArgument
public final MetaArgument getArgument(java.lang.String name)
Return an argument of the given operation that has the specified name.- Parameters:
name
- Argument name.- Returns:
- Argument with the specified name or
null
if no such argument is defined.
-
getShortcuts
public final java.lang.Iterable<MetaShortcut> getShortcuts()
Returns a collection of shortcuts applicable to the given operation in different contexts.- Returns:
- A collection of shortcuts.
-
getShortcut
public final MetaShortcut getShortcut(java.lang.String contextName)
Returns a shortcut for the given operation that can be used in the specified context.- Parameters:
contextName
- Context name.- Returns:
- Shortcut for the given context or
null
if no such shortcut exists.
-
hasRootShortcuts
public final boolean hasRootShortcuts()
Checks whether the current operation has root shortcuts. This means that the operation can be addressed directly in a test template to specify a complete instruction call (not as a part of a call specified as an argument for other operation).- Returns:
true
if it the operation has root shortcuts orfalse
otherwise.
-
isBranch
public final boolean isBranch()
Checks whether the operation is a branch operation (causes control transfer).- Returns:
true
if the operation is a branch operation orfalse
otherwise.
-
isConditionalBranch
public final boolean isConditionalBranch()
Checks whether the operation is a conditional branch operation (causes control transfer on some condition).- Returns:
true
if the operation is a conditional branch operation orfalse
otherwise.
-
getDelaySlotSize
public final int getDelaySlotSize()
Checks the operation has a delay slot.- Returns:
- count of delay slots.
-
canThrowException
public final boolean canThrowException()
Checks whether the current operation can throw an exception.- Returns:
true
if the operation can throw an exception orfalse
otherwise.
-
isLoad
public final boolean isLoad()
Checks whether the operation performs a memory load action.NOTE: This covers only situations when a load can be unambiguously defected by exploring operation attributes. For situations when a memory access is performed via parameters (other operation or addressing modes) which can be dynamically chosen (OR rules), these parameters (their meta data) must be examined additionally to make a conclusion.
- Returns:
true
if the operation performs a memory load action orfalse
otherwise.
-
isStore
public final boolean isStore()
Checks whether the operation performs a memory store action.NOTE: This covers only situations when a load can be unambiguously defected by exploring operation attributes. For situations when a memory access is performed via parameters (other operation or addressing modes) which can be dynamically chosen (OR rules), these parameters (their meta data) must be examined additionally to make a conclusion.
- Returns:
true
if the operation performs a memory store action orfalse
otherwise.
-
getBlockSize
public final int getBlockSize()
Returns the size of block read or written to memory. Applicable for load or store operations.- Returns:
- Size of memory block in bits.
-
getExceptions
public final java.util.Collection<java.lang.String> getExceptions()
Returns the list of operation exceptions.- Returns:
- a list of exceptions.
-
getMarks
public final java.util.Collection<java.lang.String> getMarks()
Returns the list of operation marks.- Returns:
- a list of marks.
-
getSignature
public final java.lang.Object getSignature()
Returns the operation arguments.- Returns:
- the operation signature.
-
-