Go to the documentation of this file.
34 #include <boost/format.hpp>
65 parent_(NULL), insTemplate_(&instructionTemplate),
68 size_(1), hasRegisterAccesses_(
false), hasConditionalRegisterAccesses_(
false) {
81 parent_(NULL), insTemplate_(&instructionTemplate),
84 size_(size), hasRegisterAccesses_(
false), hasConditionalRegisterAccesses_(
false) {
86 "Instructions sizes other than 1 not supported in POM at the "
114 "Instruction is not registered.");
150 "Move is already added.");
164 "Instruction template already uses the move's slot");
194 if (i < 0 ||
static_cast<unsigned int>(i) >=
moves_.size()) {
196 "No move in instruction for given index: " +
215 std::shared_ptr<Move>
217 if (i < 0 ||
static_cast<unsigned int>(i) >=
moves_.size()) {
219 "No move in instruction for given index: " +
237 "Immediate is already added.");
240 imm->setParent(
this);
245 int requiredWidth = std::min(
247 imm->value().value().width());
252 "The immediate is wider than the instruction template can "
286 if (i < 0 ||
static_cast<unsigned int>(i) >=
immediates_.size()) {
288 "No immediate in instruction with index: " +
308 std::shared_ptr<Immediate>
310 if (i < 0 ||
static_cast<unsigned int>(i) >=
immediates_.size()) {
312 "No immediate in instruction with index: " +
334 TCEString msg =
"Instruction is not registered in a procedure: ";
351 parent().startAddress().space());
495 assert(
false &&
"Instruction template conflicts with the "
496 "instruction's slot layout: Both the new template and a move "
502 int requiredWidth = std::min(
504 immediate(i).value().value().unsignedValue()),
508 immediate(i).destination().immediateUnit())) {
509 assert(
false &&
"The instruction has an long immediate "
510 "not supported by the new instruction template.");
542 for (MoveList::iterator iter =
moves_.begin();
543 iter !=
moves_.end(); iter++) {
544 if ((iter->get()) == &
move) {
563 if ((*iter).get() == &imm) {
std::shared_ptr< Move > copy() const
void removeMove(Move &move)
void addMove(std::shared_ptr< Move > move)
UInt32 InstructionAddress
InstructionAddress finalAddress_
In case the final instruction address is known (due to program not modified anymore),...
virtual TCEString name() const
bool hasConditionalRegisterAccesses() const
bool isUnconditional() const
static NullProcedure & instance()
Terminal & destination() const
void removeImmediate(Immediate &imm)
std::string toString() const
const TTAMachine::Bus & bus() const
virtual Address startAddress() const
void copyAnnotationsFrom(const AnnotatedInstructionElement &other)
ImmList immediates_
Immediates contained in this instruction.
static std::string toString(const T &source)
void setParent(Instruction &ins)
#define assert(condition)
bool hasRegisterAccesses_
Set to true in case this instruction has moves that access registers.
const TTAMachine::InstructionTemplate * insTemplate_
Instruction template that is used for this instruction.
bool isControlFlowMove() const
Instruction * copy() const
CodeSnippet & parent() const
short size_
Size of instruction in MAU's.
virtual bool isGPR() const
virtual int supportedWidth() const
InstructionAddress location() const
static NullInstruction & instance()
std::shared_ptr< Immediate > immediatePtr(int i) const
Immediate & immediate(int i) const
bool hasRegisterAccesses() const
const TTAMachine::InstructionTemplate & instructionTemplate() const
void setParent(CodeSnippet &proc)
bool isInProcedure() const
InstructionAddress positionInProcedure_
Cache the instruction's index in the its procedure for faster address().
virtual Address address(const Instruction &ins) const
static std::string disassemble(const TTAProgram::Move &move)
static NullInstructionTemplate & instance()
MoveList moves_
Moves contained in this instruction.
Instruction & parent() const
find Finds info of the inner loops in the false
bool hasConditionalRegisterAccesses_
Set to true in case this instruction has moves that access registers and are conditional.
int immediateCount() const
void setInstructionTemplate(const TTAMachine::InstructionTemplate &insTemp)
Terminal & source() const
bool hasControlFlowMove() const
std::shared_ptr< Move > movePtr(int i) const
CodeSnippet * parent_
Parent procedure.
virtual bool usesSlot(const std::string &slotName) const
void addImmediate(std::shared_ptr< Immediate > imm)
Instruction(const TTAMachine::InstructionTemplate &instructionTemplate=TTAMachine::NullInstructionTemplate::instance())