[llvm] r255544 - [Hexagon] Add "const" to function parameters in HexagonInstrInfo

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 13:32:25 PST 2015


Author: kparzysz
Date: Mon Dec 14 15:32:25 2015
New Revision: 255544

URL: http://llvm.org/viewvc/llvm-project?rev=255544&view=rev
Log:
[Hexagon] Add "const" to function parameters in HexagonInstrInfo

Modified:
    llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp
    llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.h

Modified: llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp?rev=255544&r1=255543&r2=255544&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp Mon Dec 14 15:32:25 2015
@@ -1776,7 +1776,7 @@ bool HexagonInstrInfo::isDuplexPair(cons
 }
 
 
-bool HexagonInstrInfo::isEarlySourceInstr(MachineInstr *MI) const {
+bool HexagonInstrInfo::isEarlySourceInstr(const MachineInstr *MI) const {
   if (!MI)
     return false;
 
@@ -1850,7 +1850,7 @@ bool HexagonInstrInfo::isExtended(const
 }
 
 
-bool HexagonInstrInfo::isFloat(MachineInstr *MI) const {
+bool HexagonInstrInfo::isFloat(const MachineInstr *MI) const {
   unsigned Opcode = MI->getOpcode();
   const uint64_t F = get(Opcode).TSFlags;
   return (F >> HexagonII::FPPos) & HexagonII::FPMask;
@@ -1943,8 +1943,8 @@ bool HexagonInstrInfo::isJumpWithinBranc
 }
 
 
-bool HexagonInstrInfo::isLateInstrFeedsEarlyInstr(MachineInstr *LRMI,
-      MachineInstr *ESMI) const {
+bool HexagonInstrInfo::isLateInstrFeedsEarlyInstr(const MachineInstr *LRMI,
+      const MachineInstr *ESMI) const {
   if (!LRMI || !ESMI)
     return false;
 
@@ -1965,7 +1965,7 @@ bool HexagonInstrInfo::isLateInstrFeedsE
 }
 
 
-bool HexagonInstrInfo::isLateResultInstr(MachineInstr *MI) const {
+bool HexagonInstrInfo::isLateResultInstr(const MachineInstr *MI) const {
   if (!MI)
     return false;
 
@@ -2015,15 +2015,16 @@ bool HexagonInstrInfo::isLateSourceInstr
 }
 
 
-bool HexagonInstrInfo::isLoopN(unsigned Opcode) const {
-  return (Opcode == Hexagon::J2_loop0i ||
-          Opcode == Hexagon::J2_loop0r ||
-          Opcode == Hexagon::J2_loop0iext ||
-          Opcode == Hexagon::J2_loop0rext ||
-          Opcode == Hexagon::J2_loop1i ||
-          Opcode == Hexagon::J2_loop1r ||
-          Opcode == Hexagon::J2_loop1iext ||
-          Opcode == Hexagon::J2_loop1rext);
+bool HexagonInstrInfo::isLoopN(const MachineInstr *MI) const {
+  unsigned Opcode = MI->getOpcode();
+  return Opcode == Hexagon::J2_loop0i    ||
+         Opcode == Hexagon::J2_loop0r    ||
+         Opcode == Hexagon::J2_loop0iext ||
+         Opcode == Hexagon::J2_loop0rext ||
+         Opcode == Hexagon::J2_loop1i    ||
+         Opcode == Hexagon::J2_loop1r    ||
+         Opcode == Hexagon::J2_loop1iext ||
+         Opcode == Hexagon::J2_loop1rext;
 }
 
 
@@ -2537,7 +2538,7 @@ bool HexagonInstrInfo::hasNonExtEquivale
 }
 
 
-bool HexagonInstrInfo::hasPseudoInstrPair(MachineInstr *MI) const {
+bool HexagonInstrInfo::hasPseudoInstrPair(const MachineInstr *MI) const {
   return Hexagon::getRealHWInstr(MI->getOpcode(),
                                  Hexagon::InstrType_Pseudo) >= 0;
 }
@@ -2617,10 +2618,10 @@ bool HexagonInstrInfo::producesStall(con
 }
 
 
-bool HexagonInstrInfo::predCanBeUsedAsDotNew(MachineInstr *MI,
+bool HexagonInstrInfo::predCanBeUsedAsDotNew(const MachineInstr *MI,
       unsigned PredReg) const {
   for (unsigned opNum = 0; opNum < MI->getNumOperands(); opNum++) {
-    MachineOperand &MO = MI->getOperand(opNum);
+    const MachineOperand &MO = MI->getOperand(opNum);
     if (MO.isReg() && MO.isDef() && MO.isImplicit() && (MO.getReg() == PredReg))
       return false; // Predicate register must be explicitly defined.
   }
@@ -3067,13 +3068,13 @@ int HexagonInstrInfo::getDotNewOp(const
 // Returns the opcode to use when converting MI, which is a conditional jump,
 // into a conditional instruction which uses the .new value of the predicate.
 // We also use branch probabilities to add a hint to the jump.
-int HexagonInstrInfo::getDotNewPredJumpOp(MachineInstr *MI,
+int HexagonInstrInfo::getDotNewPredJumpOp(const MachineInstr *MI,
       const MachineBranchProbabilityInfo *MBPI) const {
   // We assume that block can have at most two successors.
   bool taken = false;
-  MachineBasicBlock *Src = MI->getParent();
-  MachineOperand *BrTarget = &MI->getOperand(1);
-  MachineBasicBlock *Dst = BrTarget->getMBB();
+  const MachineBasicBlock *Src = MI->getParent();
+  const MachineOperand *BrTarget = &MI->getOperand(1);
+  const MachineBasicBlock *Dst = BrTarget->getMBB();
 
   const BranchProbability Prediction = MBPI->getEdgeProbability(Src, Dst);
   if (Prediction >= BranchProbability(1,2))
@@ -3092,7 +3093,7 @@ int HexagonInstrInfo::getDotNewPredJumpO
 
 
 // Return .new predicate version for an instruction.
-int HexagonInstrInfo::getDotNewPredOp(MachineInstr *MI,
+int HexagonInstrInfo::getDotNewPredOp(const MachineInstr *MI,
       const MachineBranchProbabilityInfo *MBPI) const {
   int NewOpcode = Hexagon::getPredNewOpcode(MI->getOpcode());
   if (NewOpcode >= 0) // Valid predicate new instruction
@@ -3471,7 +3472,7 @@ HexagonII::SubInstructionGroup HexagonIn
 }
 
 
-short HexagonInstrInfo::getEquivalentHWInstr(MachineInstr *MI) const {
+short HexagonInstrInfo::getEquivalentHWInstr(const MachineInstr *MI) const {
   return Hexagon::getRealHWInstr(MI->getOpcode(), Hexagon::InstrType_Real);
 }
 
@@ -3618,7 +3619,7 @@ bool HexagonInstrInfo::getPredReg(ArrayR
 }
 
 
-short HexagonInstrInfo::getPseudoInstrPair(MachineInstr *MI) const {
+short HexagonInstrInfo::getPseudoInstrPair(const MachineInstr *MI) const {
   return Hexagon::getRealHWInstr(MI->getOpcode(), Hexagon::InstrType_Pseudo);
 }
 

Modified: llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.h?rev=255544&r1=255543&r2=255544&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.h (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.h Mon Dec 14 15:32:25 2015
@@ -274,20 +274,21 @@ public:
   bool isDotCurInst(const MachineInstr* MI) const;
   bool isDotNewInst(const MachineInstr* MI) const;
   bool isDuplexPair(const MachineInstr *MIa, const MachineInstr *MIb) const;
-  bool isEarlySourceInstr(MachineInstr *MI) const;
+  bool isEarlySourceInstr(const MachineInstr *MI) const;
   bool isEndLoopN(unsigned Opcode) const;
   bool isExpr(unsigned OpType) const;
   bool isExtendable(const MachineInstr* MI) const;
   bool isExtended(const MachineInstr* MI) const;
-  bool isFloat(MachineInstr *MI) const;
+  bool isFloat(const MachineInstr *MI) const;
   bool isIndirectCall(const MachineInstr *MI) const;
   bool isIndirectL4Return(const MachineInstr *MI) const;
   bool isJumpR(const MachineInstr *MI) const;
   bool isJumpWithinBranchRange(const MachineInstr *MI, unsigned offset) const;
-  bool isLateInstrFeedsEarlyInstr(MachineInstr *LRMI, MachineInstr *ESMI) const;
-  bool isLateResultInstr(MachineInstr *MI) const;
+  bool isLateInstrFeedsEarlyInstr(const MachineInstr *LRMI,
+                                  const MachineInstr *ESMI) const;
+  bool isLateResultInstr(const MachineInstr *MI) const;
   bool isLateSourceInstr(const MachineInstr *MI) const;
-  bool isLoopN(unsigned Opcode) const;
+  bool isLoopN(const MachineInstr *MI) const;
   bool isMemOp(const MachineInstr *MI) const;
   bool isNewValue(const MachineInstr* MI) const;
   bool isNewValue(unsigned Opcode) const;
@@ -323,7 +324,7 @@ public:
 
   bool hasEHLabel(const MachineBasicBlock *B) const;
   bool hasNonExtEquivalent(const MachineInstr *MI) const;
-  bool hasPseudoInstrPair(MachineInstr *MI) const;
+  bool hasPseudoInstrPair(const MachineInstr *MI) const;
   bool hasUncondBranch(const MachineBasicBlock *B) const;
   bool mayBeCurLoad(const MachineInstr* MI) const;
   bool mayBeNewStore(const MachineInstr* MI) const;
@@ -331,7 +332,7 @@ public:
                      const MachineInstr *ConsMI) const;
   bool producesStall(const MachineInstr *MI,
                      MachineBasicBlock::const_instr_iterator MII) const;
-  bool predCanBeUsedAsDotNew(MachineInstr *MI, unsigned PredReg) const;
+  bool predCanBeUsedAsDotNew(const MachineInstr *MI, unsigned PredReg) const;
   bool PredOpcodeHasJMP_c(unsigned Opcode) const;
   bool predOpcodeHasNot(ArrayRef<MachineOperand> Cond) const;
 
@@ -350,14 +351,14 @@ public:
   int getCondOpcode(int Opc, bool sense) const;
   int getDotCurOp(const MachineInstr* MI) const;
   int getDotNewOp(const MachineInstr* MI) const;
-  int getDotNewPredJumpOp(MachineInstr *MI,
+  int getDotNewPredJumpOp(const MachineInstr *MI,
                           const MachineBranchProbabilityInfo *MBPI) const;
-  int getDotNewPredOp(MachineInstr *MI,
+  int getDotNewPredOp(const MachineInstr *MI,
                       const MachineBranchProbabilityInfo *MBPI) const;
   int getDotOldOp(const int opc) const;
   HexagonII::SubInstructionGroup getDuplexCandidateGroup(const MachineInstr *MI)
                                                          const;
-  short getEquivalentHWInstr(MachineInstr *MI) const;
+  short getEquivalentHWInstr(const MachineInstr *MI) const;
   MachineInstr *getFirstNonDbgInst(MachineBasicBlock *BB) const;
   unsigned getInstrTimingClassLatency(const InstrItineraryData *ItinData,
                                       const MachineInstr *MI) const;
@@ -369,7 +370,7 @@ public:
   short getNonExtOpcode(const MachineInstr *MI) const;
   bool getPredReg(ArrayRef<MachineOperand> Cond, unsigned &PredReg,
                   unsigned &PredRegPos, unsigned &PredRegFlags) const;
-  short getPseudoInstrPair(MachineInstr *MI) const;
+  short getPseudoInstrPair(const MachineInstr *MI) const;
   short getRegForm(const MachineInstr *MI) const;
   unsigned getSize(const MachineInstr *MI) const;
   uint64_t getType(const MachineInstr* MI) const;




More information about the llvm-commits mailing list