[llvm] ddcb3cf - [TargetInstrInfo] add override function setSpecialOperandAttr - NFC

Chen Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon May 18 18:34:23 PDT 2020


Author: Chen Zheng
Date: 2020-05-18T21:20:52-04:00
New Revision: ddcb3cf213e826a1597917002864eaf514ca4726

URL: https://github.com/llvm/llvm-project/commit/ddcb3cf213e826a1597917002864eaf514ca4726
DIFF: https://github.com/llvm/llvm-project/commit/ddcb3cf213e826a1597917002864eaf514ca4726.diff

LOG: [TargetInstrInfo] add override function setSpecialOperandAttr - NFC

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/TargetInstrInfo.h
    llvm/lib/Target/PowerPC/PPCInstrInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/TargetInstrInfo.h b/llvm/include/llvm/CodeGen/TargetInstrInfo.h
index f36385d7df79..30ab1039bef0 100644
--- a/llvm/include/llvm/CodeGen/TargetInstrInfo.h
+++ b/llvm/include/llvm/CodeGen/TargetInstrInfo.h
@@ -1101,6 +1101,8 @@ class TargetInstrInfo : public MCInstrInfo {
                                      MachineInstr &NewMI1,
                                      MachineInstr &NewMI2) const {}
 
+  virtual void setSpecialOperandAttr(MachineInstr &MI, uint16_t Flags) const {}
+
   /// Return true when a target supports MachineCombiner.
   virtual bool useMachineCombiner() const { return false; }
 

diff  --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
index 5a329ec4f852..b09804c7eaf0 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -245,6 +245,14 @@ void PPCInstrInfo::setSpecialOperandAttr(MachineInstr &OldMI1,
   NewMI2.clearFlag(MachineInstr::MIFlag::IsExact);
 }
 
+void PPCInstrInfo::setSpecialOperandAttr(MachineInstr &MI,
+                                         uint16_t Flags) const {
+  MI.setFlags(Flags);
+  MI.clearFlag(MachineInstr::MIFlag::NoSWrap);
+  MI.clearFlag(MachineInstr::MIFlag::NoUWrap);
+  MI.clearFlag(MachineInstr::MIFlag::IsExact);
+}
+
 // This function does not list all associative and commutative operations, but
 // only those worth feeding through the machine combiner in an attempt to
 // reduce the critical path. Mostly, this means floating-point operations,


        


More information about the llvm-commits mailing list