131d157ae1ac2cd9c787dc3c1d28e64c682803844Jia Liu//===-- PPCInstrInfo.h - PowerPC Instruction Information --------*- C++ -*-===//
2b5f662fa0314f7e7e690aae8ebff7136cc3a5ab0Misha Brukman//
3f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman//                     The LLVM Compiler Infrastructure
4f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman//
54ee451de366474b9c228b4e5fa573795a715216dChris Lattner// This file is distributed under the University of Illinois Open Source
64ee451de366474b9c228b4e5fa573795a715216dChris Lattner// License. See LICENSE.TXT for details.
7b5f662fa0314f7e7e690aae8ebff7136cc3a5ab0Misha Brukman//
8f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman//===----------------------------------------------------------------------===//
9f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman//
10f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman// This file contains the PowerPC implementation of the TargetInstrInfo class.
11f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman//
12f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman//===----------------------------------------------------------------------===//
13f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman
1431d157ae1ac2cd9c787dc3c1d28e64c682803844Jia Liu#ifndef POWERPC_INSTRUCTIONINFO_H
1531d157ae1ac2cd9c787dc3c1d28e64c682803844Jia Liu#define POWERPC_INSTRUCTIONINFO_H
16f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman
172668959b8879097db368aec7d76c455260abc75bChris Lattner#include "PPC.h"
1816e71f2f70811c69c56052dd146324fe20e31db5Chris Lattner#include "PPCRegisterInfo.h"
1979aa3417eb6f58d668aadfedf075240a41d35a26Craig Topper#include "llvm/Target/TargetInstrInfo.h"
20f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman
214db3cffe94a5285239cc0056f939c6b74a5ca0b6Evan Cheng#define GET_INSTRINFO_HEADER
224db3cffe94a5285239cc0056f939c6b74a5ca0b6Evan Cheng#include "PPCGenInstrInfo.inc"
234db3cffe94a5285239cc0056f939c6b74a5ca0b6Evan Cheng
24f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukmannamespace llvm {
2588d211f82304e53694ece666d4a2507b170e4582Chris Lattner
2688d211f82304e53694ece666d4a2507b170e4582Chris Lattner/// PPCII - This namespace holds all of the PowerPC target-specific
2788d211f82304e53694ece666d4a2507b170e4582Chris Lattner/// per-instruction flags.  These must match the corresponding definitions in
2888d211f82304e53694ece666d4a2507b170e4582Chris Lattner/// PPC.td and PPCInstrFormats.td.
2988d211f82304e53694ece666d4a2507b170e4582Chris Lattnernamespace PPCII {
3088d211f82304e53694ece666d4a2507b170e4582Chris Lattnerenum {
3188d211f82304e53694ece666d4a2507b170e4582Chris Lattner  // PPC970 Instruction Flags.  These flags describe the characteristics of the
3288d211f82304e53694ece666d4a2507b170e4582Chris Lattner  // PowerPC 970 (aka G5) dispatch groups and how they are formed out of
3388d211f82304e53694ece666d4a2507b170e4582Chris Lattner  // raw machine instructions.
3488d211f82304e53694ece666d4a2507b170e4582Chris Lattner
3588d211f82304e53694ece666d4a2507b170e4582Chris Lattner  /// PPC970_First - This instruction starts a new dispatch group, so it will
3688d211f82304e53694ece666d4a2507b170e4582Chris Lattner  /// always be the first one in the group.
3788d211f82304e53694ece666d4a2507b170e4582Chris Lattner  PPC970_First = 0x1,
386e8f4c404825b79f9b9176483653f1aa927dfbdeAndrew Trick
3988d211f82304e53694ece666d4a2507b170e4582Chris Lattner  /// PPC970_Single - This instruction starts a new dispatch group and
4088d211f82304e53694ece666d4a2507b170e4582Chris Lattner  /// terminates it, so it will be the sole instruction in the group.
4188d211f82304e53694ece666d4a2507b170e4582Chris Lattner  PPC970_Single = 0x2,
4288d211f82304e53694ece666d4a2507b170e4582Chris Lattner
43fd97734f3636f54a86890918096d3d692df0b939Chris Lattner  /// PPC970_Cracked - This instruction is cracked into two pieces, requiring
44fd97734f3636f54a86890918096d3d692df0b939Chris Lattner  /// two dispatch pipes to be available to issue.
45fd97734f3636f54a86890918096d3d692df0b939Chris Lattner  PPC970_Cracked = 0x4,
466e8f4c404825b79f9b9176483653f1aa927dfbdeAndrew Trick
4788d211f82304e53694ece666d4a2507b170e4582Chris Lattner  /// PPC970_Mask/Shift - This is a bitmask that selects the pipeline type that
4888d211f82304e53694ece666d4a2507b170e4582Chris Lattner  /// an instruction is issued to.
49fd97734f3636f54a86890918096d3d692df0b939Chris Lattner  PPC970_Shift = 3,
50d74ea2bbd8bb630331f35ead42d385249bd42af8Chris Lattner  PPC970_Mask = 0x07 << PPC970_Shift
5188d211f82304e53694ece666d4a2507b170e4582Chris Lattner};
5288d211f82304e53694ece666d4a2507b170e4582Chris Lattnerenum PPC970_Unit {
5388d211f82304e53694ece666d4a2507b170e4582Chris Lattner  /// These are the various PPC970 execution unit pipelines.  Each instruction
5488d211f82304e53694ece666d4a2507b170e4582Chris Lattner  /// is one of these.
5588d211f82304e53694ece666d4a2507b170e4582Chris Lattner  PPC970_Pseudo = 0 << PPC970_Shift,   // Pseudo instruction
5688d211f82304e53694ece666d4a2507b170e4582Chris Lattner  PPC970_FXU    = 1 << PPC970_Shift,   // Fixed Point (aka Integer/ALU) Unit
5788d211f82304e53694ece666d4a2507b170e4582Chris Lattner  PPC970_LSU    = 2 << PPC970_Shift,   // Load Store Unit
5888d211f82304e53694ece666d4a2507b170e4582Chris Lattner  PPC970_FPU    = 3 << PPC970_Shift,   // Floating Point Unit
5988d211f82304e53694ece666d4a2507b170e4582Chris Lattner  PPC970_CRU    = 4 << PPC970_Shift,   // Control Register Unit
6088d211f82304e53694ece666d4a2507b170e4582Chris Lattner  PPC970_VALU   = 5 << PPC970_Shift,   // Vector ALU
6188d211f82304e53694ece666d4a2507b170e4582Chris Lattner  PPC970_VPERM  = 6 << PPC970_Shift,   // Vector Permute Unit
62d74ea2bbd8bb630331f35ead42d385249bd42af8Chris Lattner  PPC970_BRU    = 7 << PPC970_Shift    // Branch Unit
6388d211f82304e53694ece666d4a2507b170e4582Chris Lattner};
64b908258d59745ab9f150c66f94541951cf9c9211Chris Lattner} // end namespace PPCII
656e8f4c404825b79f9b9176483653f1aa927dfbdeAndrew Trick
666e8f4c404825b79f9b9176483653f1aa927dfbdeAndrew Trick
674db3cffe94a5285239cc0056f939c6b74a5ca0b6Evan Chengclass PPCInstrInfo : public PPCGenInstrInfo {
68b1d26f66658cff3ceb7d44a72fbc8c8e975532f9Chris Lattner  PPCTargetMachine &TM;
6921e463b2bf864671a87ebe386cb100ef9349a540Nate Begeman  const PPCRegisterInfo RI;
704a66e9a57e679b4f3243bf2061daf53c70102030Bill Wendling
718e5f2c6f65841542e2a7092553fe42a00048e4c7Dan Gohman  bool StoreRegToStackSlot(MachineFunction &MF,
728e5f2c6f65841542e2a7092553fe42a00048e4c7Dan Gohman                           unsigned SrcReg, bool isKill, int FrameIdx,
734a66e9a57e679b4f3243bf2061daf53c70102030Bill Wendling                           const TargetRegisterClass *RC,
74324972904353594ad4a0cdfc79370f85e9fb9c8fHal Finkel                           SmallVectorImpl<MachineInstr*> &NewMIs,
753f2c047f32c9b488d9c49bb2dc87b979530dab3fHal Finkel                           bool &NonRI, bool &SpillsVRS) const;
76d21e930eac3d99dd77ee33ea5826700b4bc97ae8Hal Finkel  bool LoadRegFromStackSlot(MachineFunction &MF, DebugLoc DL,
778e5f2c6f65841542e2a7092553fe42a00048e4c7Dan Gohman                            unsigned DestReg, int FrameIdx,
784a66e9a57e679b4f3243bf2061daf53c70102030Bill Wendling                            const TargetRegisterClass *RC,
79324972904353594ad4a0cdfc79370f85e9fb9c8fHal Finkel                            SmallVectorImpl<MachineInstr*> &NewMIs,
803f2c047f32c9b488d9c49bb2dc87b979530dab3fHal Finkel                            bool &NonRI, bool &SpillsVRS) const;
81f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukmanpublic:
82950a4c40b823cd4f09dc71be635229246dfd6cacDan Gohman  explicit PPCInstrInfo(PPCTargetMachine &TM);
83f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman
84f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman  /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
85f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman  /// such, whenever a client has an instance of instruction info, it should
86f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman  /// always be able to get register info as well (through this method).
87f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman  ///
88c9f5f3f64f896d0a8c8fa35a1dd98bc57b8960f6Dan Gohman  virtual const PPCRegisterInfo &getRegisterInfo() const { return RI; }
89f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman
902da8bc8a5f7705ac131184cd247f48500da0d74eAndrew Trick  ScheduleHazardRecognizer *
912da8bc8a5f7705ac131184cd247f48500da0d74eAndrew Trick  CreateTargetHazardRecognizer(const TargetMachine *TM,
922da8bc8a5f7705ac131184cd247f48500da0d74eAndrew Trick                               const ScheduleDAG *DAG) const;
9364c34e253563a8ba6b41fbce2bb020632cf65961Hal Finkel  ScheduleHazardRecognizer *
9464c34e253563a8ba6b41fbce2bb020632cf65961Hal Finkel  CreateTargetPostRAHazardRecognizer(const InstrItineraryData *II,
9564c34e253563a8ba6b41fbce2bb020632cf65961Hal Finkel                                     const ScheduleDAG *DAG) const;
962da8bc8a5f7705ac131184cd247f48500da0d74eAndrew Trick
977164288c3eb52e20454fc757440f867f04eb13a4Jakob Stoklund Olesen  bool isCoalescableExtInstr(const MachineInstr &MI,
987164288c3eb52e20454fc757440f867f04eb13a4Jakob Stoklund Olesen                             unsigned &SrcReg, unsigned &DstReg,
997164288c3eb52e20454fc757440f867f04eb13a4Jakob Stoklund Olesen                             unsigned &SubIdx) const;
100cbad42cfd1cc93a41ff26ea2e8895bfbc09f54f2Dan Gohman  unsigned isLoadFromStackSlot(const MachineInstr *MI,
101cbad42cfd1cc93a41ff26ea2e8895bfbc09f54f2Dan Gohman                               int &FrameIndex) const;
102cbad42cfd1cc93a41ff26ea2e8895bfbc09f54f2Dan Gohman  unsigned isStoreToStackSlot(const MachineInstr *MI,
103cbad42cfd1cc93a41ff26ea2e8895bfbc09f54f2Dan Gohman                              int &FrameIndex) const;
104408396014742a05cad1c91949d2226169e3f9d80Chris Lattner
105043870dd85ea41e8972c304b122070a417c8a4bcChris Lattner  // commuteInstruction - We can commute rlwimi instructions, but only if the
106043870dd85ea41e8972c304b122070a417c8a4bcChris Lattner  // rotate amt is zero.  We also have to munge the immediates a bit.
10758dcb0e0cd3fa973b5fd005aecab1df6aeea5cd6Evan Cheng  virtual MachineInstr *commuteInstruction(MachineInstr *MI, bool NewMI) const;
1086e8f4c404825b79f9b9176483653f1aa927dfbdeAndrew Trick
1096e8f4c404825b79f9b9176483653f1aa927dfbdeAndrew Trick  virtual void insertNoop(MachineBasicBlock &MBB,
110bbf1c72d51a77bf54c9c684b90a78e59f0b70b2fChris Lattner                          MachineBasicBlock::iterator MI) const;
111bbf1c72d51a77bf54c9c684b90a78e59f0b70b2fChris Lattner
112c50e2bcdf7bff1f9681ab80e52691f274950fab5Chris Lattner
113c50e2bcdf7bff1f9681ab80e52691f274950fab5Chris Lattner  // Branch analysis.
114c50e2bcdf7bff1f9681ab80e52691f274950fab5Chris Lattner  virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
115c50e2bcdf7bff1f9681ab80e52691f274950fab5Chris Lattner                             MachineBasicBlock *&FBB,
116dc54d317e7a381ef8e4aca80d54ad1466bb85ddaEvan Cheng                             SmallVectorImpl<MachineOperand> &Cond,
117dc54d317e7a381ef8e4aca80d54ad1466bb85ddaEvan Cheng                             bool AllowModify) const;
118b5cdaa257e167a08a8a54ea9249d847ccc415ce0Evan Cheng  virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
119b5cdaa257e167a08a8a54ea9249d847ccc415ce0Evan Cheng  virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
120b5cdaa257e167a08a8a54ea9249d847ccc415ce0Evan Cheng                                MachineBasicBlock *FBB,
1213bf912593301152b65accb9d9c37a95172f1df5aStuart Hastings                                const SmallVectorImpl<MachineOperand> &Cond,
1223bf912593301152b65accb9d9c37a95172f1df5aStuart Hastings                                DebugLoc DL) const;
123ff56d1a2011f239e114267c13302ea26db4f8046Hal Finkel
124ff56d1a2011f239e114267c13302ea26db4f8046Hal Finkel  // Select analysis.
125ff56d1a2011f239e114267c13302ea26db4f8046Hal Finkel  virtual bool canInsertSelect(const MachineBasicBlock&,
126ff56d1a2011f239e114267c13302ea26db4f8046Hal Finkel                               const SmallVectorImpl<MachineOperand> &Cond,
127ff56d1a2011f239e114267c13302ea26db4f8046Hal Finkel                               unsigned, unsigned, int&, int&, int&) const;
128ff56d1a2011f239e114267c13302ea26db4f8046Hal Finkel  virtual void insertSelect(MachineBasicBlock &MBB,
129ff56d1a2011f239e114267c13302ea26db4f8046Hal Finkel                            MachineBasicBlock::iterator MI, DebugLoc DL,
130ff56d1a2011f239e114267c13302ea26db4f8046Hal Finkel                            unsigned DstReg,
131ff56d1a2011f239e114267c13302ea26db4f8046Hal Finkel                            const SmallVectorImpl<MachineOperand> &Cond,
132ff56d1a2011f239e114267c13302ea26db4f8046Hal Finkel                            unsigned TrueReg, unsigned FalseReg) const;
133ff56d1a2011f239e114267c13302ea26db4f8046Hal Finkel
13427689b0affee8fb1bfbef11dcc84287b7757cfe8Jakob Stoklund Olesen  virtual void copyPhysReg(MachineBasicBlock &MBB,
13527689b0affee8fb1bfbef11dcc84287b7757cfe8Jakob Stoklund Olesen                           MachineBasicBlock::iterator I, DebugLoc DL,
13627689b0affee8fb1bfbef11dcc84287b7757cfe8Jakob Stoklund Olesen                           unsigned DestReg, unsigned SrcReg,
13727689b0affee8fb1bfbef11dcc84287b7757cfe8Jakob Stoklund Olesen                           bool KillSrc) const;
1386e8f4c404825b79f9b9176483653f1aa927dfbdeAndrew Trick
139f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson  virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
140f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson                                   MachineBasicBlock::iterator MBBI,
141f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson                                   unsigned SrcReg, bool isKill, int FrameIndex,
142746ad69e088176819981b4b2c5ac8dcd49f5e60eEvan Cheng                                   const TargetRegisterClass *RC,
143746ad69e088176819981b4b2c5ac8dcd49f5e60eEvan Cheng                                   const TargetRegisterInfo *TRI) const;
144f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson
145f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson  virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
146f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson                                    MachineBasicBlock::iterator MBBI,
147f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson                                    unsigned DestReg, int FrameIndex,
148746ad69e088176819981b4b2c5ac8dcd49f5e60eEvan Cheng                                    const TargetRegisterClass *RC,
149746ad69e088176819981b4b2c5ac8dcd49f5e60eEvan Cheng                                    const TargetRegisterInfo *TRI) const;
1506e8f4c404825b79f9b9176483653f1aa927dfbdeAndrew Trick
15144eb65cf58e3ab9b5621ce72256d1621a18aeed7Owen Anderson  virtual
15244eb65cf58e3ab9b5621ce72256d1621a18aeed7Owen Anderson  bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const;
1536e8f4c404825b79f9b9176483653f1aa927dfbdeAndrew Trick
154839b9096538f790a2bb060547df24703807cb83bHal Finkel  virtual bool FoldImmediate(MachineInstr *UseMI, MachineInstr *DefMI,
155839b9096538f790a2bb060547df24703807cb83bHal Finkel                             unsigned Reg, MachineRegisterInfo *MRI) const;
156839b9096538f790a2bb060547df24703807cb83bHal Finkel
1577eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  // If conversion by predication (only supported by some branch instructions).
1587eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  // All of the profitability checks always return true; it is always
1597eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  // profitable to use the predicated branches.
1607eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  virtual bool isProfitableToIfCvt(MachineBasicBlock &MBB,
1617eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel                                   unsigned NumCycles, unsigned ExtraPredCycles,
1627eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel                                   const BranchProbability &Probability) const {
1637eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel    return true;
1647eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  }
1657eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel
1667eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  virtual bool isProfitableToIfCvt(MachineBasicBlock &TMBB,
1677eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel                                   unsigned NumT, unsigned ExtraT,
1687eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel                                   MachineBasicBlock &FMBB,
1697eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel                                   unsigned NumF, unsigned ExtraF,
170da47e17a6f58bb4dae22d3e79c69fcb1d254ba44Hal Finkel                                   const BranchProbability &Probability) const;
1717eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel
1727eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  virtual bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB,
1737eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel                                         unsigned NumCycles,
1747eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel                                         const BranchProbability
1757eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel                                         &Probability) const {
1767eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel    return true;
1777eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  }
1787eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel
1797eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  virtual bool isProfitableToUnpredicate(MachineBasicBlock &TMBB,
1807eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel                                         MachineBasicBlock &FMBB) const {
1817eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel    return false;
1827eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  }
1837eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel
1847eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  // Predication support.
1857eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  bool isPredicated(const MachineInstr *MI) const;
1867eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel
1877eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  virtual bool isUnpredicatedTerminator(const MachineInstr *MI) const;
1887eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel
1897eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  virtual
1907eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  bool PredicateInstruction(MachineInstr *MI,
1917eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel                            const SmallVectorImpl<MachineOperand> &Pred) const;
1927eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel
1937eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  virtual
1947eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  bool SubsumesPredicate(const SmallVectorImpl<MachineOperand> &Pred1,
1957eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel                         const SmallVectorImpl<MachineOperand> &Pred2) const;
1967eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel
1977eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  virtual bool DefinesPredicate(MachineInstr *MI,
1987eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel                                std::vector<MachineOperand> &Pred) const;
1997eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel
2007eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel  virtual bool isPredicable(MachineInstr *MI) const;
2017eb0d8148e1210d9e31ab471477de47b53bab117Hal Finkel
202860c08cad5b7c1359123bb2b0e74df4b6e48a15cHal Finkel  // Comparison optimization.
203860c08cad5b7c1359123bb2b0e74df4b6e48a15cHal Finkel
204860c08cad5b7c1359123bb2b0e74df4b6e48a15cHal Finkel
205860c08cad5b7c1359123bb2b0e74df4b6e48a15cHal Finkel  virtual bool analyzeCompare(const MachineInstr *MI,
206860c08cad5b7c1359123bb2b0e74df4b6e48a15cHal Finkel                              unsigned &SrcReg, unsigned &SrcReg2,
207860c08cad5b7c1359123bb2b0e74df4b6e48a15cHal Finkel                              int &Mask, int &Value) const;
208860c08cad5b7c1359123bb2b0e74df4b6e48a15cHal Finkel
209860c08cad5b7c1359123bb2b0e74df4b6e48a15cHal Finkel  virtual bool optimizeCompareInstr(MachineInstr *CmpInstr,
210860c08cad5b7c1359123bb2b0e74df4b6e48a15cHal Finkel                                    unsigned SrcReg, unsigned SrcReg2,
211860c08cad5b7c1359123bb2b0e74df4b6e48a15cHal Finkel                                    int Mask, int Value,
212860c08cad5b7c1359123bb2b0e74df4b6e48a15cHal Finkel                                    const MachineRegisterInfo *MRI) const;
213860c08cad5b7c1359123bb2b0e74df4b6e48a15cHal Finkel
21452e724ad7e679ee590f4bd763d55280586a8f1bcNicolas Geoffray  /// GetInstSize - Return the number of bytes of code the specified
21552e724ad7e679ee590f4bd763d55280586a8f1bcNicolas Geoffray  /// instruction may be.  This returns the maximum number of bytes.
21652e724ad7e679ee590f4bd763d55280586a8f1bcNicolas Geoffray  ///
21752e724ad7e679ee590f4bd763d55280586a8f1bcNicolas Geoffray  virtual unsigned GetInstSizeInBytes(const MachineInstr *MI) const;
218f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman};
219f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman
220f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman}
221f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman
222f2ccb77ee9d8ab35866dae111fa36929689c7511Misha Brukman#endif
223