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: " +
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: " +
308std::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) {
#define assert(condition)
UInt32 InstructionAddress
find Finds info of the inner loops in the false
static std::string toString(const T &source)
static std::string disassemble(const TTAProgram::Move &move)
virtual TCEString name() const
virtual bool usesSlot(const std::string &slotName) const
virtual int supportedWidth() const
static NullInstructionTemplate & instance()
InstructionAddress location() const
void copyAnnotationsFrom(const AnnotatedInstructionElement &other)
virtual Address address(const Instruction &ins) const
virtual Address startAddress() const
CodeSnippet * parent_
Parent procedure.
const TTAMachine::InstructionTemplate * insTemplate_
Instruction template that is used for this instruction.
Instruction * copy() const
bool hasConditionalRegisterAccesses_
Set to true in case this instruction has moves that access registers and are conditional.
MoveList moves_
Moves contained in this instruction.
void removeImmediate(Immediate &imm)
Instruction(const TTAMachine::InstructionTemplate &instructionTemplate=TTAMachine::NullInstructionTemplate::instance())
std::string toString() const
void addImmediate(std::shared_ptr< Immediate > imm)
short size_
Size of instruction in MAU's.
std::shared_ptr< Move > movePtr(int i) const
InstructionAddress positionInProcedure_
Cache the instruction's index in the its procedure for faster address().
std::shared_ptr< Immediate > immediatePtr(int i) const
ImmList immediates_
Immediates contained in this instruction.
int immediateCount() const
bool hasControlFlowMove() const
bool hasConditionalRegisterAccesses() const
Immediate & immediate(int i) const
void addMove(std::shared_ptr< Move > move)
InstructionAddress finalAddress_
In case the final instruction address is known (due to program not modified anymore),...
void removeMove(Move &move)
void setInstructionTemplate(const TTAMachine::InstructionTemplate &insTemp)
CodeSnippet & parent() const
const TTAMachine::InstructionTemplate & instructionTemplate() const
void setParent(CodeSnippet &proc)
bool hasRegisterAccesses_
Set to true in case this instruction has moves that access registers.
bool hasRegisterAccesses() const
bool isInProcedure() const
bool isControlFlowMove() const
bool isUnconditional() const
Instruction & parent() const
Terminal & source() const
std::shared_ptr< Move > copy() const
void setParent(Instruction &ins)
Terminal & destination() const
const TTAMachine::Bus & bus() const
static NullInstruction & instance()
static NullProcedure & instance()
virtual bool isGPR() const