From: Anton Korobeynikov Date: Wed, 21 Oct 2009 19:16:49 +0000 (+0000) Subject: Cosmetic changes, no functionality changes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3926fb63c24ceeefc0215b8e14eb81c85403639e;p=oota-llvm.git Cosmetic changes, no functionality changes git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84773 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp b/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp index 4f5879a3472..ace358e86d7 100644 --- a/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp +++ b/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp @@ -250,22 +250,22 @@ void MSP430AsmPrinter::printCCOperand(const MachineInstr *MI, int OpNum) { default: llvm_unreachable("Unsupported CC code"); break; - case MSP430::COND_E: + case MSP430CC::COND_E: O << "eq"; break; - case MSP430::COND_NE: + case MSP430CC::COND_NE: O << "ne"; break; - case MSP430::COND_HS: + case MSP430CC::COND_HS: O << "hs"; break; - case MSP430::COND_LO: + case MSP430CC::COND_LO: O << "lo"; break; - case MSP430::COND_GE: + case MSP430CC::COND_GE: O << "ge"; break; - case MSP430::COND_L: + case MSP430CC::COND_L: O << 'l'; break; } diff --git a/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp b/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp index 8f1ee81af04..a3ecc674dc4 100644 --- a/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp +++ b/lib/Target/MSP430/AsmPrinter/MSP430InstPrinter.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "asm-printer" +#include "MSP430.h" #include "MSP430InstrInfo.h" #include "MSP430InstPrinter.h" #include "llvm/MC/MCInst.h" @@ -19,7 +20,6 @@ #include "llvm/MC/MCExpr.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" -#include "MSP430GenInstrNames.inc" using namespace llvm; @@ -94,22 +94,22 @@ void MSP430InstPrinter::printCCOperand(const MCInst *MI, unsigned OpNo) { default: llvm_unreachable("Unsupported CC code"); break; - case MSP430::COND_E: + case MSP430CC::COND_E: O << "eq"; break; - case MSP430::COND_NE: + case MSP430CC::COND_NE: O << "ne"; break; - case MSP430::COND_HS: + case MSP430CC::COND_HS: O << "hs"; break; - case MSP430::COND_LO: + case MSP430CC::COND_LO: O << "lo"; break; - case MSP430::COND_GE: + case MSP430CC::COND_GE: O << "ge"; break; - case MSP430::COND_L: + case MSP430CC::COND_L: O << 'l'; break; } diff --git a/lib/Target/MSP430/MSP430.h b/lib/Target/MSP430/MSP430.h index d9f5f862954..1ff178d99d9 100644 --- a/lib/Target/MSP430/MSP430.h +++ b/lib/Target/MSP430/MSP430.h @@ -17,6 +17,20 @@ #include "llvm/Target/TargetMachine.h" +namespace MSP430CC { + // MSP430 specific condition code. + enum CondCodes { + COND_E = 0, // aka COND_Z + COND_NE = 1, // aka COND_NZ + COND_HS = 2, // aka COND_C + COND_LO = 3, // aka COND_NC + COND_GE = 4, + COND_L = 5, + + COND_INVALID = -1 + }; +} + namespace llvm { class MSP430TargetMachine; class FunctionPass; diff --git a/lib/Target/MSP430/MSP430ISelLowering.cpp b/lib/Target/MSP430/MSP430ISelLowering.cpp index b56f069b54d..34e6d2c948b 100644 --- a/lib/Target/MSP430/MSP430ISelLowering.cpp +++ b/lib/Target/MSP430/MSP430ISelLowering.cpp @@ -567,44 +567,45 @@ SDValue MSP430TargetLowering::LowerExternalSymbol(SDValue Op, return DAG.getNode(MSP430ISD::Wrapper, dl, getPointerTy(), Result);; } -static SDValue EmitCMP(SDValue &LHS, SDValue &RHS, unsigned &TargetCC, +static SDValue EmitCMP(SDValue &LHS, SDValue &RHS, SDValue &TargetCC, ISD::CondCode CC, DebugLoc dl, SelectionDAG &DAG) { // FIXME: Handle bittests someday assert(!LHS.getValueType().isFloatingPoint() && "We don't handle FP yet"); // FIXME: Handle jump negative someday - TargetCC = MSP430::COND_INVALID; + MSP430CC::CondCodes TCC = MSP430CC::COND_INVALID; switch (CC) { default: llvm_unreachable("Invalid integer condition!"); case ISD::SETEQ: - TargetCC = MSP430::COND_E; // aka COND_Z + TCC = MSP430CC::COND_E; // aka COND_Z break; case ISD::SETNE: - TargetCC = MSP430::COND_NE; // aka COND_NZ + TCC = MSP430CC::COND_NE; // aka COND_NZ break; case ISD::SETULE: std::swap(LHS, RHS); // FALLTHROUGH case ISD::SETUGE: - TargetCC = MSP430::COND_HS; // aka COND_C + TCC = MSP430CC::COND_HS; // aka COND_C break; case ISD::SETUGT: std::swap(LHS, RHS); // FALLTHROUGH case ISD::SETULT: - TargetCC = MSP430::COND_LO; // aka COND_NC + TCC = MSP430CC::COND_LO; // aka COND_NC break; case ISD::SETLE: std::swap(LHS, RHS); // FALLTHROUGH case ISD::SETGE: - TargetCC = MSP430::COND_GE; + TCC = MSP430CC::COND_GE; break; case ISD::SETGT: std::swap(LHS, RHS); // FALLTHROUGH case ISD::SETLT: - TargetCC = MSP430::COND_L; + TCC = MSP430CC::COND_L; break; } + TargetCC = DAG.getConstant(TCC, MVT::i8); return DAG.getNode(MSP430ISD::CMP, dl, MVT::Flag, LHS, RHS); } @@ -617,13 +618,11 @@ SDValue MSP430TargetLowering::LowerBR_CC(SDValue Op, SelectionDAG &DAG) { SDValue Dest = Op.getOperand(4); DebugLoc dl = Op.getDebugLoc(); - unsigned TargetCC = MSP430::COND_INVALID; + SDValue TargetCC; SDValue Flag = EmitCMP(LHS, RHS, TargetCC, CC, dl, DAG); return DAG.getNode(MSP430ISD::BR_CC, dl, Op.getValueType(), - Chain, - Dest, DAG.getConstant(TargetCC, MVT::i8), - Flag); + Chain, Dest, TargetCC, Flag); } SDValue MSP430TargetLowering::LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) { @@ -634,14 +633,14 @@ SDValue MSP430TargetLowering::LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) { ISD::CondCode CC = cast(Op.getOperand(4))->get(); DebugLoc dl = Op.getDebugLoc(); - unsigned TargetCC = MSP430::COND_INVALID; + SDValue TargetCC; SDValue Flag = EmitCMP(LHS, RHS, TargetCC, CC, dl, DAG); SDVTList VTs = DAG.getVTList(Op.getValueType(), MVT::Flag); SmallVector Ops; Ops.push_back(TrueV); Ops.push_back(FalseV); - Ops.push_back(DAG.getConstant(TargetCC, MVT::i8)); + Ops.push_back(TargetCC); Ops.push_back(Flag); return DAG.getNode(MSP430ISD::SELECT_CC, dl, VTs, &Ops[0], Ops.size()); diff --git a/lib/Target/MSP430/MSP430InstrInfo.h b/lib/Target/MSP430/MSP430InstrInfo.h index e07aacad9dc..06c0c712417 100644 --- a/lib/Target/MSP430/MSP430InstrInfo.h +++ b/lib/Target/MSP430/MSP430InstrInfo.h @@ -21,20 +21,6 @@ namespace llvm { class MSP430TargetMachine; -namespace MSP430 { - // MSP430 specific condition code. - enum CondCode { - COND_E = 0, // aka COND_Z - COND_NE = 1, // aka COND_NZ - COND_HS = 2, // aka COND_C - COND_LO = 3, // aka COND_NC - COND_GE = 4, - COND_L = 5, - - COND_INVALID - }; -} - class MSP430InstrInfo : public TargetInstrInfoImpl { const MSP430RegisterInfo RI; MSP430TargetMachine &TM;