#include "llvm/Type.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "Support/STLExtras.h"
+#include <alloca.h>
using std::cerr;
using std::vector;
{
opLabel = AllocaN; // Alloca(ptr, N) operation
}
- else if ((opLabel == Instruction::Load ||
- opLabel == Instruction::GetElementPtr) &&
- cast<MemAccessInst>(I)->hasIndices())
+ else if (opLabel == Instruction::GetElementPtr &&
+ cast<GetElementPtrInst>(I)->hasIndices())
{
- opLabel = opLabel + 100; // load/getElem with index vector
+ opLabel = opLabel + 100; // getElem with index vector
}
else if (opLabel == Instruction::Xor &&
BinaryOperator::isNot(I))
{
for (int i=0; i < indent; i++)
cerr << " ";
-
- cerr << getInstruction()->getOpcodeName();
- const MachineCodeForInstruction &mvec =
- MachineCodeForInstruction::get(getInstruction());
-
- if (!mvec.empty())
- cerr << "\tMachine Instructions: ";
-
- for (unsigned i = 0; i < mvec.size(); ++i) {
- mvec[i]->dump();
- if (i < mvec.size() - 1)
- cerr << "; ";
- }
-
- cerr << "\n";
+ cerr << getInstruction()->getOpcodeName()
+ << " [label " << getOpLabel() << "]" << "\n";
}
InstrForest::noteTreeNodeForInstr(Instruction *instr,
InstructionNode *treeNode)
{
- assert(treeNode->getNodeType() == InstrTreeNode::NTInstructionNode);
(*this)[instr] = treeNode;
treeRoots.push_back(treeNode); // mark node as root of a new tree
}
{
parent->LeftChild = child;
child->Parent = parent;
- if (child->getNodeType() == InstrTreeNode::NTInstructionNode)
- eraseRoot((InstructionNode*) child); // no longer a tree root
+ if (InstructionNode* instrNode = dyn_cast<InstructionNode>(child))
+ eraseRoot(instrNode); // no longer a tree root
}
inline void
{
parent->RightChild = child;
child->Parent = parent;
- if (child->getNodeType() == InstrTreeNode::NTInstructionNode)
- eraseRoot((InstructionNode*) child); // no longer a tree root
+ if (InstructionNode* instrNode = dyn_cast<InstructionNode>(child))
+ eraseRoot(instrNode); // no longer a tree root
}