From 680b1bdd7e5d112ba4b95d6c81a43b65119b3b9c Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Wed, 7 Mar 2012 20:18:49 -0800 Subject: Unify branch flags, pretty printer for OpKind. LIR operand 0 is always an offset for a branch. This is clear in conditional branches that are binary and have the 2nd operand as the condition codes of the branch. This changes unconditional branches to be unary and therefore more intention revealing that the 1st operand will be used by the assembler to hold an offset. A << operator for OpKind allows easy pretty printing. Change-Id: I933b8e0bf43f5be3eff13f93c3fc1539ae526840 --- src/compiler/IntermediateRep.cc | 46 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'src/compiler/IntermediateRep.cc') diff --git a/src/compiler/IntermediateRep.cc b/src/compiler/IntermediateRep.cc index 1567fccf1a..662687777d 100644 --- a/src/compiler/IntermediateRep.cc +++ b/src/compiler/IntermediateRep.cc @@ -19,6 +19,52 @@ namespace art { +static const char* gOpKindNames[kOpInvalid + 1] = { + "OpMov", + "OpMvn", + "OpCmp", + "OpLsl", + "OpLsr", + "OpAsr", + "OpRor", + "OpNot", + "OpAnd", + "OpOr", + "OpXor", + "OpNeg", + "OpAdd", + "OpAdc", + "OpSub", + "OpSbc", + "OpRsub", + "OpMul", + "OpDiv", + "OpRem", + "OpBic", + "OpCmn", + "OpTst", + "OpBkpt", + "OpBlx", + "OpPush", + "OpPop", + "Op2Char", + "Op2Short", + "Op2Byte", + "OpCondBr", + "OpUncondBr", + "OpBx", + "OpInvalid", +}; + +std::ostream& operator<<(std::ostream& os, const OpKind& kind) { + if (kind >= kOpMov && kind <= kOpInvalid) { + os << gOpKindNames[kind]; + } else { + os << "Unknown Op " << static_cast(kind); + } + return os; +} + /* Allocate a new basic block */ BasicBlock* oatNewBB(CompilationUnit* cUnit, BBType blockType, int blockId) { -- cgit v1.2.3-59-g8ed1b