TargetInstrInfo.h revision c98af3370f899a0d1570b1dff01a2e36632f884f
1075b4a066db31f48e0f6daec34b1ff463523cd3fChris Lattner//===-- llvm/Target/TargetInstrInfo.h - Instruction Info --------*- C++ -*-===// 234695381d626485a560594f162701088079589dfMisha Brukman// 36fbcc26f1460eaee4e0eb8b426fc1ff0c7af11beJohn Criswell// The LLVM Compiler Infrastructure 46fbcc26f1460eaee4e0eb8b426fc1ff0c7af11beJohn Criswell// 57ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// This file is distributed under the University of Illinois Open Source 67ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// License. See LICENSE.TXT for details. 734695381d626485a560594f162701088079589dfMisha Brukman// 86fbcc26f1460eaee4e0eb8b426fc1ff0c7af11beJohn Criswell//===----------------------------------------------------------------------===// 9a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve// 1061e804f22bde414b2e8a8da22daf575a7e8ad816Dan Gohman// This file describes the target machine instruction set to the code generator. 11a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve// 12f6d12fbd9cc0355978a739f5ab213eff85b75a19Chris Lattner//===----------------------------------------------------------------------===// 13a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve 143501feab811c86c9659248a4875fc31a3165f84dChris Lattner#ifndef LLVM_TARGET_TARGETINSTRINFO_H 153501feab811c86c9659248a4875fc31a3165f84dChris Lattner#define LLVM_TARGET_TARGETINSTRINFO_H 16a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve 17d3f99e2bbf5e62261c8948127aacfe9a7d3b2456Chris Lattner#include "llvm/Target/TargetInstrDesc.h" 186c14147d934bd644fc9d24a3b36f3c38799a3401Evan Cheng#include "llvm/CodeGen/MachineFunction.h" 19a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve 20d0fde30ce850b78371fd1386338350591f9ff494Brian Gaekenamespace llvm { 21d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke 22d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Andersonclass CalleeSavedInfo; 23729aab3dd3a6ea5ca23430936270154090fcc10bEvan Chengclass InstrItineraryData; 24506049f29f4f202a8e45feb916cc0264440a7f6dEvan Chengclass LiveVariables; 25506049f29f4f202a8e45feb916cc0264440a7f6dEvan Chengclass MCAsmInfo; 26506049f29f4f202a8e45feb916cc0264440a7f6dEvan Chengclass MachineMemOperand; 27962021bc7f6721c20c7dfe8ca809e2d98b1c554aEvan Chengclass MDNode; 28ee9eb411fffddbb8fe70418c05946a131889b487Chris Lattnerclass MCInst; 2943dbe05279b753aabda571d9c83eaeb36987001aOwen Andersonclass SDNode; 30729aab3dd3a6ea5ca23430936270154090fcc10bEvan Chengclass ScheduleHazardRecognizer; 3143dbe05279b753aabda571d9c83eaeb36987001aOwen Andersonclass SelectionDAG; 32506049f29f4f202a8e45feb916cc0264440a7f6dEvan Chengclass TargetRegisterClass; 33506049f29f4f202a8e45feb916cc0264440a7f6dEvan Chengclass TargetRegisterInfo; 34a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve 35f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Andersontemplate<class T> class SmallVectorImpl; 36f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson 37a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve 383501feab811c86c9659248a4875fc31a3165f84dChris Lattner//--------------------------------------------------------------------------- 3934695381d626485a560594f162701088079589dfMisha Brukman/// 4061e804f22bde414b2e8a8da22daf575a7e8ad816Dan Gohman/// TargetInstrInfo - Interface to description of machine instruction set 4134695381d626485a560594f162701088079589dfMisha Brukman/// 42075b4a066db31f48e0f6daec34b1ff463523cd3fChris Lattnerclass TargetInstrInfo { 43749c6f6b5ed301c84aac562e414486549d7b98ebChris Lattner const TargetInstrDesc *Descriptors; // Raw array to allow static init'n 44749c6f6b5ed301c84aac562e414486549d7b98ebChris Lattner unsigned NumOpcodes; // Number of entries in the desc array 4534695381d626485a560594f162701088079589dfMisha Brukman 46075b4a066db31f48e0f6daec34b1ff463523cd3fChris Lattner TargetInstrInfo(const TargetInstrInfo &); // DO NOT IMPLEMENT 47075b4a066db31f48e0f6daec34b1ff463523cd3fChris Lattner void operator=(const TargetInstrInfo &); // DO NOT IMPLEMENT 48a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Advepublic: 49749c6f6b5ed301c84aac562e414486549d7b98ebChris Lattner TargetInstrInfo(const TargetInstrDesc *desc, unsigned NumOpcodes); 50075b4a066db31f48e0f6daec34b1ff463523cd3fChris Lattner virtual ~TargetInstrInfo(); 5170535c608d88ce25fb992dba3b6d3d0176153a09Chris Lattner 52bceb68807fdb86c794bc8d8f8aef0940f12c2cebChris Lattner unsigned getNumOpcodes() const { return NumOpcodes; } 5334695381d626485a560594f162701088079589dfMisha Brukman 54e30eeaaf72b461aebf3dfcdd7c119eea76458561Chris Lattner /// get - Return the machine instruction descriptor that corresponds to the 55e30eeaaf72b461aebf3dfcdd7c119eea76458561Chris Lattner /// specified instruction opcode. 56e30eeaaf72b461aebf3dfcdd7c119eea76458561Chris Lattner /// 57749c6f6b5ed301c84aac562e414486549d7b98ebChris Lattner const TargetInstrDesc &get(unsigned Opcode) const { 58749c6f6b5ed301c84aac562e414486549d7b98ebChris Lattner assert(Opcode < NumOpcodes && "Invalid opcode!"); 59749c6f6b5ed301c84aac562e414486549d7b98ebChris Lattner return Descriptors[Opcode]; 60a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve } 614683f9bfb4dc2f5557e8a7a229912e7f2ed366caChris Lattner 62041b3f835682588cb63df7e609d726369dd6b7d3Bill Wendling /// isTriviallyReMaterializable - Return true if the instruction is trivially 63d45eddd214061bf12ad1e6b86497a41725e61d75Dan Gohman /// rematerializable, meaning it has no side effects and requires no operands 64d45eddd214061bf12ad1e6b86497a41725e61d75Dan Gohman /// that aren't always available. 65a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman bool isTriviallyReMaterializable(const MachineInstr *MI, 66a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman AliasAnalysis *AA = 0) const { 67518bb53485df640d7b7e3f6b0544099020c42aa7Chris Lattner return MI->getOpcode() == TargetOpcode::IMPLICIT_DEF || 68a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman (MI->getDesc().isRematerializable() && 693731bc026cc6c4fb7deb7ac67e2c3be0c22498beDan Gohman (isReallyTriviallyReMaterializable(MI, AA) || 70a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman isReallyTriviallyReMaterializableGeneric(MI, AA))); 71d45eddd214061bf12ad1e6b86497a41725e61d75Dan Gohman } 72d45eddd214061bf12ad1e6b86497a41725e61d75Dan Gohman 73d45eddd214061bf12ad1e6b86497a41725e61d75Dan Gohmanprotected: 74041b3f835682588cb63df7e609d726369dd6b7d3Bill Wendling /// isReallyTriviallyReMaterializable - For instructions with opcodes for 75a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman /// which the M_REMATERIALIZABLE flag is set, this hook lets the target 76a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman /// specify whether the instruction is actually trivially rematerializable, 77a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman /// taking into consideration its operands. This predicate must return false 78a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman /// if the instruction has any side effects other than producing a value, or 79a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman /// if it requres any address registers that are not always available. 803731bc026cc6c4fb7deb7ac67e2c3be0c22498beDan Gohman virtual bool isReallyTriviallyReMaterializable(const MachineInstr *MI, 813731bc026cc6c4fb7deb7ac67e2c3be0c22498beDan Gohman AliasAnalysis *AA) const { 82a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman return false; 83d45eddd214061bf12ad1e6b86497a41725e61d75Dan Gohman } 84d45eddd214061bf12ad1e6b86497a41725e61d75Dan Gohman 85a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohmanprivate: 86a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman /// isReallyTriviallyReMaterializableGeneric - For instructions with opcodes 87a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman /// for which the M_REMATERIALIZABLE flag is set and the target hook 88a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman /// isReallyTriviallyReMaterializable returns false, this function does 89a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman /// target-independent tests to determine if the instruction is really 90a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman /// trivially rematerializable. 91a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman bool isReallyTriviallyReMaterializableGeneric(const MachineInstr *MI, 92a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman AliasAnalysis *AA) const; 93a70dca156fa76d452f54829b5c5f962ddfd94ef2Dan Gohman 94d45eddd214061bf12ad1e6b86497a41725e61d75Dan Gohmanpublic: 957da9ecf9677b751d81515f95168ae3cb2df54160Evan Cheng /// isCoalescableExtInstr - Return true if the instruction is a "coalescable" 967da9ecf9677b751d81515f95168ae3cb2df54160Evan Cheng /// extension instruction. That is, it's like a copy where it's legal for the 977da9ecf9677b751d81515f95168ae3cb2df54160Evan Cheng /// source to overlap the destination. e.g. X86::MOVSX64rr32. If this returns 987da9ecf9677b751d81515f95168ae3cb2df54160Evan Cheng /// true, then it's expected the pre-extension value is available as a subreg 997da9ecf9677b751d81515f95168ae3cb2df54160Evan Cheng /// of the result register. This also returns the sub-register index in 1007da9ecf9677b751d81515f95168ae3cb2df54160Evan Cheng /// SubIdx. 1017da9ecf9677b751d81515f95168ae3cb2df54160Evan Cheng virtual bool isCoalescableExtInstr(const MachineInstr &MI, 1027da9ecf9677b751d81515f95168ae3cb2df54160Evan Cheng unsigned &SrcReg, unsigned &DstReg, 1037da9ecf9677b751d81515f95168ae3cb2df54160Evan Cheng unsigned &SubIdx) const { 104a5a81d70720a4ce6ac7538927c2a874b0dfa8bd2Evan Cheng return false; 105a5a81d70720a4ce6ac7538927c2a874b0dfa8bd2Evan Cheng } 106a5a81d70720a4ce6ac7538927c2a874b0dfa8bd2Evan Cheng 107af9fa2bd0c1ee25f3adda96b3e5d7129fbab393aChris Lattner /// isLoadFromStackSlot - If the specified machine instruction is a direct 108af9fa2bd0c1ee25f3adda96b3e5d7129fbab393aChris Lattner /// load from a stack slot, return the virtual or physical register number of 109af9fa2bd0c1ee25f3adda96b3e5d7129fbab393aChris Lattner /// the destination along with the FrameIndex of the loaded stack slot. If 110af9fa2bd0c1ee25f3adda96b3e5d7129fbab393aChris Lattner /// not, return 0. This predicate must return 0 if the instruction has 111af9fa2bd0c1ee25f3adda96b3e5d7129fbab393aChris Lattner /// any side effects other than loading from the stack slot. 112cbad42cfd1cc93a41ff26ea2e8895bfbc09f54f2Dan Gohman virtual unsigned isLoadFromStackSlot(const MachineInstr *MI, 113cbad42cfd1cc93a41ff26ea2e8895bfbc09f54f2Dan Gohman int &FrameIndex) const { 114af9fa2bd0c1ee25f3adda96b3e5d7129fbab393aChris Lattner return 0; 115af9fa2bd0c1ee25f3adda96b3e5d7129fbab393aChris Lattner } 116b87bc95db075dae3033a3c541b55b4cb711c332cDavid Greene 117dda3978d7877d2d60390833c73ed24857295e89cDavid Greene /// isLoadFromStackSlotPostFE - Check for post-frame ptr elimination 118dda3978d7877d2d60390833c73ed24857295e89cDavid Greene /// stack locations as well. This uses a heuristic so it isn't 119dda3978d7877d2d60390833c73ed24857295e89cDavid Greene /// reliable for correctness. 120dda3978d7877d2d60390833c73ed24857295e89cDavid Greene virtual unsigned isLoadFromStackSlotPostFE(const MachineInstr *MI, 121dda3978d7877d2d60390833c73ed24857295e89cDavid Greene int &FrameIndex) const { 122dda3978d7877d2d60390833c73ed24857295e89cDavid Greene return 0; 123dda3978d7877d2d60390833c73ed24857295e89cDavid Greene } 124dda3978d7877d2d60390833c73ed24857295e89cDavid Greene 125b87bc95db075dae3033a3c541b55b4cb711c332cDavid Greene /// hasLoadFromStackSlot - If the specified machine instruction has 126b87bc95db075dae3033a3c541b55b4cb711c332cDavid Greene /// a load from a stack slot, return true along with the FrameIndex 1275e3363255912c559e8251121491a2a9e901f07acDavid Greene /// of the loaded stack slot and the machine mem operand containing 1285e3363255912c559e8251121491a2a9e901f07acDavid Greene /// the reference. If not, return false. Unlike 129b87bc95db075dae3033a3c541b55b4cb711c332cDavid Greene /// isLoadFromStackSlot, this returns true for any instructions that 130b87bc95db075dae3033a3c541b55b4cb711c332cDavid Greene /// loads from the stack. This is just a hint, as some cases may be 131b87bc95db075dae3033a3c541b55b4cb711c332cDavid Greene /// missed. 132b87bc95db075dae3033a3c541b55b4cb711c332cDavid Greene virtual bool hasLoadFromStackSlot(const MachineInstr *MI, 1335e3363255912c559e8251121491a2a9e901f07acDavid Greene const MachineMemOperand *&MMO, 134b87bc95db075dae3033a3c541b55b4cb711c332cDavid Greene int &FrameIndex) const { 135b87bc95db075dae3033a3c541b55b4cb711c332cDavid Greene return 0; 136b87bc95db075dae3033a3c541b55b4cb711c332cDavid Greene } 137af9fa2bd0c1ee25f3adda96b3e5d7129fbab393aChris Lattner 138af9fa2bd0c1ee25f3adda96b3e5d7129fbab393aChris Lattner /// isStoreToStackSlot - If the specified machine instruction is a direct 139af9fa2bd0c1ee25f3adda96b3e5d7129fbab393aChris Lattner /// store to a stack slot, return the virtual or physical register number of 140af9fa2bd0c1ee25f3adda96b3e5d7129fbab393aChris Lattner /// the source reg along with the FrameIndex of the loaded stack slot. If 141af9fa2bd0c1ee25f3adda96b3e5d7129fbab393aChris Lattner /// not, return 0. This predicate must return 0 if the instruction has 142af9fa2bd0c1ee25f3adda96b3e5d7129fbab393aChris Lattner /// any side effects other than storing to the stack slot. 143cbad42cfd1cc93a41ff26ea2e8895bfbc09f54f2Dan Gohman virtual unsigned isStoreToStackSlot(const MachineInstr *MI, 144cbad42cfd1cc93a41ff26ea2e8895bfbc09f54f2Dan Gohman int &FrameIndex) const { 145af9fa2bd0c1ee25f3adda96b3e5d7129fbab393aChris Lattner return 0; 146af9fa2bd0c1ee25f3adda96b3e5d7129fbab393aChris Lattner } 1475e30002af70ef09a42cac155d9196f7f0f3b1695Alkis Evlogimenos 148dda3978d7877d2d60390833c73ed24857295e89cDavid Greene /// isStoreToStackSlotPostFE - Check for post-frame ptr elimination 149dda3978d7877d2d60390833c73ed24857295e89cDavid Greene /// stack locations as well. This uses a heuristic so it isn't 150dda3978d7877d2d60390833c73ed24857295e89cDavid Greene /// reliable for correctness. 151dda3978d7877d2d60390833c73ed24857295e89cDavid Greene virtual unsigned isStoreToStackSlotPostFE(const MachineInstr *MI, 1525e3363255912c559e8251121491a2a9e901f07acDavid Greene int &FrameIndex) const { 153dda3978d7877d2d60390833c73ed24857295e89cDavid Greene return 0; 154dda3978d7877d2d60390833c73ed24857295e89cDavid Greene } 155dda3978d7877d2d60390833c73ed24857295e89cDavid Greene 156b87bc95db075dae3033a3c541b55b4cb711c332cDavid Greene /// hasStoreToStackSlot - If the specified machine instruction has a 157b87bc95db075dae3033a3c541b55b4cb711c332cDavid Greene /// store to a stack slot, return true along with the FrameIndex of 1585e3363255912c559e8251121491a2a9e901f07acDavid Greene /// the loaded stack slot and the machine mem operand containing the 1595e3363255912c559e8251121491a2a9e901f07acDavid Greene /// reference. If not, return false. Unlike isStoreToStackSlot, 1602dbc8bdfe9191c2078daccbeefba9e69a690feb6Evan Cheng /// this returns true for any instructions that stores to the 1615e3363255912c559e8251121491a2a9e901f07acDavid Greene /// stack. This is just a hint, as some cases may be missed. 162b87bc95db075dae3033a3c541b55b4cb711c332cDavid Greene virtual bool hasStoreToStackSlot(const MachineInstr *MI, 1635e3363255912c559e8251121491a2a9e901f07acDavid Greene const MachineMemOperand *&MMO, 164b87bc95db075dae3033a3c541b55b4cb711c332cDavid Greene int &FrameIndex) const { 165b87bc95db075dae3033a3c541b55b4cb711c332cDavid Greene return 0; 166b87bc95db075dae3033a3c541b55b4cb711c332cDavid Greene } 167b87bc95db075dae3033a3c541b55b4cb711c332cDavid Greene 168ca1267c02b025cc719190b05f9e1a5d174a9caf7Evan Cheng /// reMaterialize - Re-issue the specified 'original' instruction at the 169ca1267c02b025cc719190b05f9e1a5d174a9caf7Evan Cheng /// specific location targeting a new destination register. 1709edf7deb37f0f97664f279040fa15d89f32e23d9Jakob Stoklund Olesen /// The register in Orig->getOperand(0).getReg() will be substituted by 1719edf7deb37f0f97664f279040fa15d89f32e23d9Jakob Stoklund Olesen /// DestReg:SubIdx. Any existing subreg index is preserved or composed with 1729edf7deb37f0f97664f279040fa15d89f32e23d9Jakob Stoklund Olesen /// SubIdx. 173ca1267c02b025cc719190b05f9e1a5d174a9caf7Evan Cheng virtual void reMaterialize(MachineBasicBlock &MBB, 174ca1267c02b025cc719190b05f9e1a5d174a9caf7Evan Cheng MachineBasicBlock::iterator MI, 175378445303b10b092a898a75131141a8259cff50bEvan Cheng unsigned DestReg, unsigned SubIdx, 176d57cdd5683ea926e489067364fb7ffe5fd5d35eeEvan Cheng const MachineInstr *Orig, 1779edf7deb37f0f97664f279040fa15d89f32e23d9Jakob Stoklund Olesen const TargetRegisterInfo &TRI) const = 0; 178ca1267c02b025cc719190b05f9e1a5d174a9caf7Evan Cheng 17968fc2daf8fa446be04d2ed2b3cbb1b00c382458fEvan Cheng /// scheduleTwoAddrSource - Schedule the copy / re-mat of the source of the 18068fc2daf8fa446be04d2ed2b3cbb1b00c382458fEvan Cheng /// two-addrss instruction inserted by two-address pass. 18168fc2daf8fa446be04d2ed2b3cbb1b00c382458fEvan Cheng virtual void scheduleTwoAddrSource(MachineInstr *SrcMI, 18268fc2daf8fa446be04d2ed2b3cbb1b00c382458fEvan Cheng MachineInstr *UseMI, 18368fc2daf8fa446be04d2ed2b3cbb1b00c382458fEvan Cheng const TargetRegisterInfo &TRI) const { 18468fc2daf8fa446be04d2ed2b3cbb1b00c382458fEvan Cheng // Do nothing. 18568fc2daf8fa446be04d2ed2b3cbb1b00c382458fEvan Cheng } 18668fc2daf8fa446be04d2ed2b3cbb1b00c382458fEvan Cheng 18730ac0467ced4627a9b84d8a1d3ca5e8706ddad63Jakob Stoklund Olesen /// duplicate - Create a duplicate of the Orig instruction in MF. This is like 18830ac0467ced4627a9b84d8a1d3ca5e8706ddad63Jakob Stoklund Olesen /// MachineFunction::CloneMachineInstr(), but the target may update operands 18930ac0467ced4627a9b84d8a1d3ca5e8706ddad63Jakob Stoklund Olesen /// that are required to be unique. 190d1862037f04954f00cd6e6066ee213cfdc292877Jakob Stoklund Olesen /// 191d1862037f04954f00cd6e6066ee213cfdc292877Jakob Stoklund Olesen /// The instruction must be duplicable as indicated by isNotDuplicable(). 19230ac0467ced4627a9b84d8a1d3ca5e8706ddad63Jakob Stoklund Olesen virtual MachineInstr *duplicate(MachineInstr *Orig, 19330ac0467ced4627a9b84d8a1d3ca5e8706ddad63Jakob Stoklund Olesen MachineFunction &MF) const = 0; 19430ac0467ced4627a9b84d8a1d3ca5e8706ddad63Jakob Stoklund Olesen 19515f63ad2e59998f0bf1a3a23547582074391f650Chris Lattner /// convertToThreeAddress - This method must be implemented by targets that 19615f63ad2e59998f0bf1a3a23547582074391f650Chris Lattner /// set the M_CONVERTIBLE_TO_3_ADDR flag. When this flag is set, the target 1972c8c3e2e31e641085060edce0ddde3833ffa53daDan Gohman /// may be able to convert a two-address instruction into one or more true 1986c14147d934bd644fc9d24a3b36f3c38799a3401Evan Cheng /// three-address instructions on demand. This allows the X86 target (for 19915f63ad2e59998f0bf1a3a23547582074391f650Chris Lattner /// example) to convert ADD and SHL instructions into LEA instructions if they 20015f63ad2e59998f0bf1a3a23547582074391f650Chris Lattner /// would require register copies due to two-addressness. 20115f63ad2e59998f0bf1a3a23547582074391f650Chris Lattner /// 20215f63ad2e59998f0bf1a3a23547582074391f650Chris Lattner /// This method returns a null pointer if the transformation cannot be 2036c14147d934bd644fc9d24a3b36f3c38799a3401Evan Cheng /// performed, otherwise it returns the last new instruction. 20415f63ad2e59998f0bf1a3a23547582074391f650Chris Lattner /// 2056c14147d934bd644fc9d24a3b36f3c38799a3401Evan Cheng virtual MachineInstr * 2066c14147d934bd644fc9d24a3b36f3c38799a3401Evan Cheng convertToThreeAddress(MachineFunction::iterator &MFI, 207f660c171c838793b87b7e58e91609cecf256378dOwen Anderson MachineBasicBlock::iterator &MBBI, LiveVariables *LV) const { 20815f63ad2e59998f0bf1a3a23547582074391f650Chris Lattner return 0; 20915f63ad2e59998f0bf1a3a23547582074391f650Chris Lattner } 21015f63ad2e59998f0bf1a3a23547582074391f650Chris Lattner 211f0e1b8942157f4344cce36e98c7dabb230d52bf8Bob Wilson /// commuteInstruction - If a target has any instructions that are 212f0e1b8942157f4344cce36e98c7dabb230d52bf8Bob Wilson /// commutable but require converting to different instructions or making 213f0e1b8942157f4344cce36e98c7dabb230d52bf8Bob Wilson /// non-trivial changes to commute them, this method can overloaded to do 214f0e1b8942157f4344cce36e98c7dabb230d52bf8Bob Wilson /// that. The default implementation simply swaps the commutable operands. 215f0e1b8942157f4344cce36e98c7dabb230d52bf8Bob Wilson /// If NewMI is false, MI is modified in place and returned; otherwise, a 216f0e1b8942157f4344cce36e98c7dabb230d52bf8Bob Wilson /// new machine instruction is created and returned. Do not call this 217f0e1b8942157f4344cce36e98c7dabb230d52bf8Bob Wilson /// method for a non-commutable instruction, but there may be some cases 218f0e1b8942157f4344cce36e98c7dabb230d52bf8Bob Wilson /// where this method fails and returns null. 21958dcb0e0cd3fa973b5fd005aecab1df6aeea5cd6Evan Cheng virtual MachineInstr *commuteInstruction(MachineInstr *MI, 22058dcb0e0cd3fa973b5fd005aecab1df6aeea5cd6Evan Cheng bool NewMI = false) const = 0; 221d7e2fe40e42dffa04a770191c3414446d5e8c30aChris Lattner 222261ce1d5f89155d2e6f914f281db2004c89ee839Evan Cheng /// findCommutedOpIndices - If specified MI is commutable, return the two 223f0e1b8942157f4344cce36e98c7dabb230d52bf8Bob Wilson /// operand indices that would swap value. Return false if the instruction 224261ce1d5f89155d2e6f914f281db2004c89ee839Evan Cheng /// is not in a form which this routine understands. 225261ce1d5f89155d2e6f914f281db2004c89ee839Evan Cheng virtual bool findCommutedOpIndices(MachineInstr *MI, unsigned &SrcOpIdx1, 226261ce1d5f89155d2e6f914f281db2004c89ee839Evan Cheng unsigned &SrcOpIdx2) const = 0; 227f20db159541bf27f5d2fdf8d4ba1c8b270b936dfEvan Cheng 228506049f29f4f202a8e45feb916cc0264440a7f6dEvan Cheng /// produceSameValue - Return true if two machine instructions would produce 229506049f29f4f202a8e45feb916cc0264440a7f6dEvan Cheng /// identical values. By default, this is only true when the two instructions 230506049f29f4f202a8e45feb916cc0264440a7f6dEvan Cheng /// are deemed identical except for defs. 231506049f29f4f202a8e45feb916cc0264440a7f6dEvan Cheng virtual bool produceSameValue(const MachineInstr *MI0, 232506049f29f4f202a8e45feb916cc0264440a7f6dEvan Cheng const MachineInstr *MI1) const = 0; 23312749db1503c2beed58ddcfba5f1b323611fb2ceEvan Cheng 234b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner /// AnalyzeBranch - Analyze the branching code at the end of MBB, returning 235b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner /// true if it cannot be understood (e.g. it's a switch dispatch or isn't 236b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner /// implemented for a target). Upon success, this returns false and returns 237b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner /// with the following information in various cases: 238b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner /// 23972dc5852684bd56af68b3f344b295d9ff5c3a13fChris Lattner /// 1. If this block ends with no branches (it just falls through to its succ) 24072dc5852684bd56af68b3f344b295d9ff5c3a13fChris Lattner /// just return false, leaving TBB/FBB null. 24172dc5852684bd56af68b3f344b295d9ff5c3a13fChris Lattner /// 2. If this block ends with only an unconditional branch, it sets TBB to be 242b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner /// the destination block. 24385de1e5bade2f3755e47ed6fd43c92fcf99ff08bBill Wendling /// 3. If this block ends with a conditional branch and it falls through to a 24485de1e5bade2f3755e47ed6fd43c92fcf99ff08bBill Wendling /// successor block, it sets TBB to be the branch destination block and a 24585de1e5bade2f3755e47ed6fd43c92fcf99ff08bBill Wendling /// list of operands that evaluate the condition. These operands can be 24685de1e5bade2f3755e47ed6fd43c92fcf99ff08bBill Wendling /// passed to other TargetInstrInfo methods to create new branches. 247a5595b02daae4641f7120b44ef05ba9c494bb461Dan Gohman /// 4. If this block ends with a conditional branch followed by an 248a5595b02daae4641f7120b44ef05ba9c494bb461Dan Gohman /// unconditional branch, it returns the 'true' destination in TBB, the 249a5595b02daae4641f7120b44ef05ba9c494bb461Dan Gohman /// 'false' destination in FBB, and a list of operands that evaluate the 250a5595b02daae4641f7120b44ef05ba9c494bb461Dan Gohman /// condition. These operands can be passed to other TargetInstrInfo 251a5595b02daae4641f7120b44ef05ba9c494bb461Dan Gohman /// methods to create new branches. 252b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner /// 253b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner /// Note that RemoveBranch and InsertBranch must be implemented to support 254b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner /// cases where this method returns success. 255b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner /// 256dc54d317e7a381ef8e4aca80d54ad1466bb85ddaEvan Cheng /// If AllowModify is true, then this routine is allowed to modify the basic 257dc54d317e7a381ef8e4aca80d54ad1466bb85ddaEvan Cheng /// block (e.g. delete instructions after the unconditional branch). 258dc54d317e7a381ef8e4aca80d54ad1466bb85ddaEvan Cheng /// 259b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, 260b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner MachineBasicBlock *&FBB, 261dc54d317e7a381ef8e4aca80d54ad1466bb85ddaEvan Cheng SmallVectorImpl<MachineOperand> &Cond, 262dc54d317e7a381ef8e4aca80d54ad1466bb85ddaEvan Cheng bool AllowModify = false) const { 263b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner return true; 264905f7af59cb85ea71b6c011f1e79f24f8db16efcAlkis Evlogimenos } 265a5595b02daae4641f7120b44ef05ba9c494bb461Dan Gohman 266b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner /// RemoveBranch - Remove the branching code at the end of the specific MBB. 2678c8b2a89f9173aaa06e91ff43c3a46276f23b355Dan Gohman /// This is only invoked in cases where AnalyzeBranch returns success. It 268b5cdaa257e167a08a8a54ea9249d847ccc415ce0Evan Cheng /// returns the number of instructions that were removed. 269b5cdaa257e167a08a8a54ea9249d847ccc415ce0Evan Cheng virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const { 270b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner assert(0 && "Target didn't implement TargetInstrInfo::RemoveBranch!"); 271b5cdaa257e167a08a8a54ea9249d847ccc415ce0Evan Cheng return 0; 272b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner } 273a5595b02daae4641f7120b44ef05ba9c494bb461Dan Gohman 274a5595b02daae4641f7120b44ef05ba9c494bb461Dan Gohman /// InsertBranch - Insert branch code into the end of the specified 275a5595b02daae4641f7120b44ef05ba9c494bb461Dan Gohman /// MachineBasicBlock. The operands to this method are the same as those 276a5595b02daae4641f7120b44ef05ba9c494bb461Dan Gohman /// returned by AnalyzeBranch. This is only invoked in cases where 277a5595b02daae4641f7120b44ef05ba9c494bb461Dan Gohman /// AnalyzeBranch returns success. It returns the number of instructions 278a5595b02daae4641f7120b44ef05ba9c494bb461Dan Gohman /// inserted. 279c1c9d7e6a95e2090d74f271209fc9337e74ab9bfDale Johannesen /// 280c1c9d7e6a95e2090d74f271209fc9337e74ab9bfDale Johannesen /// It is also invoked by tail merging to add unconditional branches in 281c1c9d7e6a95e2090d74f271209fc9337e74ab9bfDale Johannesen /// cases where AnalyzeBranch doesn't apply because there was no original 282c1c9d7e6a95e2090d74f271209fc9337e74ab9bfDale Johannesen /// branch to analyze. At least this much must be implemented, else tail 283c1c9d7e6a95e2090d74f271209fc9337e74ab9bfDale Johannesen /// merging needs to be disabled. 284b5cdaa257e167a08a8a54ea9249d847ccc415ce0Evan Cheng virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, 2853bf912593301152b65accb9d9c37a95172f1df5aStuart Hastings MachineBasicBlock *FBB, 2863bf912593301152b65accb9d9c37a95172f1df5aStuart Hastings const SmallVectorImpl<MachineOperand> &Cond, 2873bf912593301152b65accb9d9c37a95172f1df5aStuart Hastings DebugLoc DL) const { 28824321d7e23a482cbd0b7502f43e9026f87a3684dRafael Espindola assert(0 && "Target didn't implement TargetInstrInfo::InsertBranch!"); 289b5cdaa257e167a08a8a54ea9249d847ccc415ce0Evan Cheng return 0; 290b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner } 29186050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng 29286050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng /// ReplaceTailWithBranchTo - Delete the instruction OldInst and everything 29386050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng /// after it, replacing it with an unconditional branch to NewDest. This is 29486050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng /// used by the tail merging pass. 29586050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng virtual void ReplaceTailWithBranchTo(MachineBasicBlock::iterator Tail, 29686050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng MachineBasicBlock *NewDest) const = 0; 2974d54e5b2dd4a3d3bed38ff9c7aa57fc66adb5855Evan Cheng 2984d54e5b2dd4a3d3bed38ff9c7aa57fc66adb5855Evan Cheng /// isLegalToSplitMBBAt - Return true if it's legal to split the given basic 2994d54e5b2dd4a3d3bed38ff9c7aa57fc66adb5855Evan Cheng /// block at the specified instruction (i.e. instruction would be the start 3004d54e5b2dd4a3d3bed38ff9c7aa57fc66adb5855Evan Cheng /// of a new basic block). 3014d54e5b2dd4a3d3bed38ff9c7aa57fc66adb5855Evan Cheng virtual bool isLegalToSplitMBBAt(MachineBasicBlock &MBB, 3024d54e5b2dd4a3d3bed38ff9c7aa57fc66adb5855Evan Cheng MachineBasicBlock::iterator MBBI) const { 3034d54e5b2dd4a3d3bed38ff9c7aa57fc66adb5855Evan Cheng return true; 3044d54e5b2dd4a3d3bed38ff9c7aa57fc66adb5855Evan Cheng } 30513151432edace19ee867a93b5c14573df4f75d24Evan Cheng 30613151432edace19ee867a93b5c14573df4f75d24Evan Cheng /// isProfitableToIfCvt - Return true if it's profitable to first "NumInstrs" 30713151432edace19ee867a93b5c14573df4f75d24Evan Cheng /// of the specified basic block. 30813151432edace19ee867a93b5c14573df4f75d24Evan Cheng virtual 30913151432edace19ee867a93b5c14573df4f75d24Evan Cheng bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumInstrs) const { 31013151432edace19ee867a93b5c14573df4f75d24Evan Cheng return false; 31113151432edace19ee867a93b5c14573df4f75d24Evan Cheng } 31213151432edace19ee867a93b5c14573df4f75d24Evan Cheng 31313151432edace19ee867a93b5c14573df4f75d24Evan Cheng /// isProfitableToIfCvt - Second variant of isProfitableToIfCvt, this one 31413151432edace19ee867a93b5c14573df4f75d24Evan Cheng /// checks for the case where two basic blocks from true and false path 31513151432edace19ee867a93b5c14573df4f75d24Evan Cheng /// of a if-then-else (diamond) are predicated on mutally exclusive 31613151432edace19ee867a93b5c14573df4f75d24Evan Cheng /// predicates. 31713151432edace19ee867a93b5c14573df4f75d24Evan Cheng virtual bool 31813151432edace19ee867a93b5c14573df4f75d24Evan Cheng isProfitableToIfCvt(MachineBasicBlock &TMBB, unsigned NumTInstrs, 31913151432edace19ee867a93b5c14573df4f75d24Evan Cheng MachineBasicBlock &FMBB, unsigned NumFInstrs) const { 32013151432edace19ee867a93b5c14573df4f75d24Evan Cheng return false; 32113151432edace19ee867a93b5c14573df4f75d24Evan Cheng } 32213151432edace19ee867a93b5c14573df4f75d24Evan Cheng 32313151432edace19ee867a93b5c14573df4f75d24Evan Cheng /// isProfitableToDupForIfCvt - Return true if it's profitable for 32413151432edace19ee867a93b5c14573df4f75d24Evan Cheng /// if-converter to duplicate a specific number of instructions in the 32513151432edace19ee867a93b5c14573df4f75d24Evan Cheng /// specified MBB to enable if-conversion. 32613151432edace19ee867a93b5c14573df4f75d24Evan Cheng virtual bool 32713151432edace19ee867a93b5c14573df4f75d24Evan Cheng isProfitableToDupForIfCvt(MachineBasicBlock &MBB,unsigned NumInstrs) const { 32813151432edace19ee867a93b5c14573df4f75d24Evan Cheng return false; 32913151432edace19ee867a93b5c14573df4f75d24Evan Cheng } 330b2cd26127973b97c3ed8d74a063e70a259369e44Chris Lattner 3313651d92d91062ea4b1ee8b2a88eca03bd39e1968Jakob Stoklund Olesen /// copyPhysReg - Emit instructions to copy a pair of physical registers. 3323651d92d91062ea4b1ee8b2a88eca03bd39e1968Jakob Stoklund Olesen virtual void copyPhysReg(MachineBasicBlock &MBB, 3333651d92d91062ea4b1ee8b2a88eca03bd39e1968Jakob Stoklund Olesen MachineBasicBlock::iterator MI, DebugLoc DL, 3343651d92d91062ea4b1ee8b2a88eca03bd39e1968Jakob Stoklund Olesen unsigned DestReg, unsigned SrcReg, 335744b3a5acdbd4d0fac9c6a7c9ad702502cc3cc37Jakob Stoklund Olesen bool KillSrc) const { 336744b3a5acdbd4d0fac9c6a7c9ad702502cc3cc37Jakob Stoklund Olesen assert(0 && "Target didn't implement TargetInstrInfo::copyPhysReg!"); 337744b3a5acdbd4d0fac9c6a7c9ad702502cc3cc37Jakob Stoklund Olesen } 3383651d92d91062ea4b1ee8b2a88eca03bd39e1968Jakob Stoklund Olesen 33995a3f0d99e9551404c217f62d0991b922ead22a9Evan Cheng /// storeRegToStackSlot - Store the specified register of the given register 34095a3f0d99e9551404c217f62d0991b922ead22a9Evan Cheng /// class to the specified stack frame index. The store instruction is to be 34195a3f0d99e9551404c217f62d0991b922ead22a9Evan Cheng /// added to the given machine basic block before the specified machine 34295a3f0d99e9551404c217f62d0991b922ead22a9Evan Cheng /// instruction. If isKill is true, the register operand is the last use and 34395a3f0d99e9551404c217f62d0991b922ead22a9Evan Cheng /// must be marked kill. 344f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson virtual void storeRegToStackSlot(MachineBasicBlock &MBB, 345f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson MachineBasicBlock::iterator MI, 346f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson unsigned SrcReg, bool isKill, int FrameIndex, 347746ad69e088176819981b4b2c5ac8dcd49f5e60eEvan Cheng const TargetRegisterClass *RC, 348746ad69e088176819981b4b2c5ac8dcd49f5e60eEvan Cheng const TargetRegisterInfo *TRI) const { 3495a3eb8f0e1141825634be38165e40871ce60b3d5Eric Christopher assert(0 && "Target didn't implement TargetInstrInfo::storeRegToStackSlot!"); 350f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson } 351f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson 35295a3f0d99e9551404c217f62d0991b922ead22a9Evan Cheng /// loadRegFromStackSlot - Load the specified register of the given register 35395a3f0d99e9551404c217f62d0991b922ead22a9Evan Cheng /// class from the specified stack frame index. The load instruction is to be 35495a3f0d99e9551404c217f62d0991b922ead22a9Evan Cheng /// added to the given machine basic block before the specified machine 35595a3f0d99e9551404c217f62d0991b922ead22a9Evan Cheng /// instruction. 356f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, 357f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson MachineBasicBlock::iterator MI, 358f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson unsigned DestReg, int FrameIndex, 359746ad69e088176819981b4b2c5ac8dcd49f5e60eEvan Cheng const TargetRegisterClass *RC, 360746ad69e088176819981b4b2c5ac8dcd49f5e60eEvan Cheng const TargetRegisterInfo *TRI) const { 3615a3eb8f0e1141825634be38165e40871ce60b3d5Eric Christopher assert(0 && "Target didn't implement TargetInstrInfo::loadRegFromStackSlot!"); 362f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson } 363f6372aa1cc568df19da7c5023e83c75aa9404a07Owen Anderson 364d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson /// spillCalleeSavedRegisters - Issues instruction(s) to spill all callee 365d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson /// saved registers and returns true if it isn't possible / profitable to do 366d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson /// so by issuing a series of store instructions via 367d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson /// storeRegToStackSlot(). Returns false otherwise. 368d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson virtual bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, 369d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson MachineBasicBlock::iterator MI, 3705a3eb8f0e1141825634be38165e40871ce60b3d5Eric Christopher const std::vector<CalleeSavedInfo> &CSI, 3712457f2c66184e978d4ed8fa9e2128effff26cb0bEvan Cheng const TargetRegisterInfo *TRI) const { 372d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson return false; 373d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson } 374d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson 375d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson /// restoreCalleeSavedRegisters - Issues instruction(s) to restore all callee 376d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson /// saved registers and returns true if it isn't possible / profitable to do 377d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson /// so by issuing a series of load instructions via loadRegToStackSlot(). 378d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson /// Returns false otherwise. 379d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson virtual bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, 380d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson MachineBasicBlock::iterator MI, 3812457f2c66184e978d4ed8fa9e2128effff26cb0bEvan Cheng const std::vector<CalleeSavedInfo> &CSI, 3822457f2c66184e978d4ed8fa9e2128effff26cb0bEvan Cheng const TargetRegisterInfo *TRI) const { 383d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson return false; 384d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson } 385d94b6a16fec7d5021e3922b0e34f9ddb268d54b1Owen Anderson 386962021bc7f6721c20c7dfe8ca809e2d98b1c554aEvan Cheng /// emitFrameIndexDebugValue - Emit a target-dependent form of 387962021bc7f6721c20c7dfe8ca809e2d98b1c554aEvan Cheng /// DBG_VALUE encoding the address of a frame index. Addresses would 388962021bc7f6721c20c7dfe8ca809e2d98b1c554aEvan Cheng /// normally be lowered the same way as other addresses on the target, 389962021bc7f6721c20c7dfe8ca809e2d98b1c554aEvan Cheng /// e.g. in load instructions. For targets that do not support this 390962021bc7f6721c20c7dfe8ca809e2d98b1c554aEvan Cheng /// the debug info is simply lost. 391efc3a6348addd7c9158348fa01f4602e0e0b1688Dale Johannesen /// If you add this for a target you should handle this DBG_VALUE in the 392efc3a6348addd7c9158348fa01f4602e0e0b1688Dale Johannesen /// target-specific AsmPrinter code as well; you will probably get invalid 393efc3a6348addd7c9158348fa01f4602e0e0b1688Dale Johannesen /// assembly output if you don't. 394962021bc7f6721c20c7dfe8ca809e2d98b1c554aEvan Cheng virtual MachineInstr *emitFrameIndexDebugValue(MachineFunction &MF, 3958601a3d4decff0a380e059b037dabf71075497d3Evan Cheng int FrameIx, 396962021bc7f6721c20c7dfe8ca809e2d98b1c554aEvan Cheng uint64_t Offset, 397962021bc7f6721c20c7dfe8ca809e2d98b1c554aEvan Cheng const MDNode *MDPtr, 398962021bc7f6721c20c7dfe8ca809e2d98b1c554aEvan Cheng DebugLoc dl) const { 399962021bc7f6721c20c7dfe8ca809e2d98b1c554aEvan Cheng return 0; 400962021bc7f6721c20c7dfe8ca809e2d98b1c554aEvan Cheng } 401962021bc7f6721c20c7dfe8ca809e2d98b1c554aEvan Cheng 40243dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson /// foldMemoryOperand - Attempt to fold a load or store of the specified stack 40343dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson /// slot into the specified machine instruction for the specified operand(s). 40443dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson /// If this is possible, a new instruction is returned with the specified 405e05442d50806e2850eae1571958816028093df85Jakob Stoklund Olesen /// operand folded, otherwise NULL is returned. 406e05442d50806e2850eae1571958816028093df85Jakob Stoklund Olesen /// The new instruction is inserted before MI, and the client is responsible 407e05442d50806e2850eae1571958816028093df85Jakob Stoklund Olesen /// for removing the old instruction. 408e05442d50806e2850eae1571958816028093df85Jakob Stoklund Olesen MachineInstr* foldMemoryOperand(MachineBasicBlock::iterator MI, 409c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman const SmallVectorImpl<unsigned> &Ops, 410c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman int FrameIndex) const; 41143dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson 41243dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson /// foldMemoryOperand - Same as the previous version except it allows folding 41343dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson /// of any load and store from / to any address, not just from a specific 41443dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson /// stack slot. 415e05442d50806e2850eae1571958816028093df85Jakob Stoklund Olesen MachineInstr* foldMemoryOperand(MachineBasicBlock::iterator MI, 416c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman const SmallVectorImpl<unsigned> &Ops, 417c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman MachineInstr* LoadMI) const; 418c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman 419c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohmanprotected: 420c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman /// foldMemoryOperandImpl - Target-dependent implementation for 421c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman /// foldMemoryOperand. Target-independent code in foldMemoryOperand will 422c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman /// take care of adding a MachineMemOperand to the newly created instruction. 423c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF, 4245fd79d0560570fed977788a86fa038b898564dfaEvan Cheng MachineInstr* MI, 4258e8b8a223c2b0e69f44c0639f846260c8011668fDan Gohman const SmallVectorImpl<unsigned> &Ops, 426c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman int FrameIndex) const { 427c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman return 0; 428c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman } 429c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman 430c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman /// foldMemoryOperandImpl - Target-dependent implementation for 431c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman /// foldMemoryOperand. Target-independent code in foldMemoryOperand will 432c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman /// take care of adding a MachineMemOperand to the newly created instruction. 433c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF, 434c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman MachineInstr* MI, 4355a3eb8f0e1141825634be38165e40871ce60b3d5Eric Christopher const SmallVectorImpl<unsigned> &Ops, 436c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohman MachineInstr* LoadMI) const { 43743dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson return 0; 43843dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson } 43943dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson 440c54baa2d43730f1804acfb4f4e738fba72f966bdDan Gohmanpublic: 4412b00aebda9705b7d76e90e632a5de511e59c739dDan Gohman /// canFoldMemoryOperand - Returns true for the specified load / store if 44243dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson /// folding is possible. 44343dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson virtual 4448e8b8a223c2b0e69f44c0639f846260c8011668fDan Gohman bool canFoldMemoryOperand(const MachineInstr *MI, 4451f32340d95ac480bfc74bcfd00fd5cffbe078652Jakob Stoklund Olesen const SmallVectorImpl<unsigned> &Ops) const =0; 44643dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson 44743dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson /// unfoldMemoryOperand - Separate a single instruction which folded a load or 44843dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson /// a store or a load and a store into two or more instruction. If this is 44943dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson /// possible, returns true as well as the new instructions by reference. 45043dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson virtual bool unfoldMemoryOperand(MachineFunction &MF, MachineInstr *MI, 45143dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson unsigned Reg, bool UnfoldLoad, bool UnfoldStore, 452c781a243a3d17e7e763515794168d8fa6043f565Evan Cheng SmallVectorImpl<MachineInstr*> &NewMIs) const{ 45343dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson return false; 45443dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson } 45543dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson 45643dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson virtual bool unfoldMemoryOperand(SelectionDAG &DAG, SDNode *N, 45743dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson SmallVectorImpl<SDNode*> &NewNodes) const { 45843dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson return false; 45943dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson } 46043dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson 46143dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson /// getOpcodeAfterMemoryUnfold - Returns the opcode of the would be new 46243dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson /// instruction after load / store are unfolded from an instruction of the 46343dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson /// specified opcode. It returns zero if the specified unfolding is not 4640115e164bad632572e2cfbaf72f0f0882d5319deDan Gohman /// possible. If LoadRegIndex is non-null, it is filled in with the operand 4650115e164bad632572e2cfbaf72f0f0882d5319deDan Gohman /// index of the operand which will hold the register holding the loaded 4660115e164bad632572e2cfbaf72f0f0882d5319deDan Gohman /// value. 46743dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson virtual unsigned getOpcodeAfterMemoryUnfold(unsigned Opc, 4680115e164bad632572e2cfbaf72f0f0882d5319deDan Gohman bool UnfoldLoad, bool UnfoldStore, 4690115e164bad632572e2cfbaf72f0f0882d5319deDan Gohman unsigned *LoadRegIndex = 0) const { 47043dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson return 0; 47143dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson } 47296dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng 47396dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng /// areLoadsFromSameBasePtr - This is used by the pre-regalloc scheduler 47496dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng /// to determine if two loads are loading from the same base address. It 47596dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng /// should only return true if the base pointers are the same and the 47696dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng /// only differences between the two addresses are the offset. It also returns 47796dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng /// the offsets by reference. 47896dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng virtual bool areLoadsFromSameBasePtr(SDNode *Load1, SDNode *Load2, 4795a3eb8f0e1141825634be38165e40871ce60b3d5Eric Christopher int64_t &Offset1, int64_t &Offset2) const { 48096dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng return false; 48196dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng } 48296dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng 48396dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng /// shouldScheduleLoadsNear - This is a used by the pre-regalloc scheduler to 48496dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng /// determine (in conjuction with areLoadsFromSameBasePtr) if two loads should 48596dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng /// be scheduled togther. On some targets if two loads are loading from 48696dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng /// addresses in the same cache line, it's better if they are scheduled 48796dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng /// together. This function takes two integers that represent the load offsets 48896dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng /// from the common base address. It returns true if it decides it's desirable 48996dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng /// to schedule the two loads together. "NumLoads" is the number of loads that 49096dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng /// have already been scheduled after Load1. 49196dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng virtual bool shouldScheduleLoadsNear(SDNode *Load1, SDNode *Load2, 49296dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng int64_t Offset1, int64_t Offset2, 49396dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng unsigned NumLoads) const { 49496dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng return false; 49596dc115ef3ee019cb91d7c112358a77536c38a53Evan Cheng } 49643dbe05279b753aabda571d9c83eaeb36987001aOwen Anderson 4975f1e4dbdf77de6887441af20857967a3d24c01abChris Lattner /// ReverseBranchCondition - Reverses the branch condition of the specified 4985f1e4dbdf77de6887441af20857967a3d24c01abChris Lattner /// condition list, returning false on success and true if it cannot be 4995f1e4dbdf77de6887441af20857967a3d24c01abChris Lattner /// reversed. 50044eb65cf58e3ab9b5621ce72256d1621a18aeed7Owen Anderson virtual 50144eb65cf58e3ab9b5621ce72256d1621a18aeed7Owen Anderson bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const { 5025f1e4dbdf77de6887441af20857967a3d24c01abChris Lattner return true; 503905f7af59cb85ea71b6c011f1e79f24f8db16efcAlkis Evlogimenos } 5040271077eba5f62796f4c725baa8e7fc88bf97650Chris Lattner 50565e9f3969bec427f14d41f0aaef12ed689ca85b5Chris Lattner /// insertNoop - Insert a noop into the instruction stream at the specified 50665e9f3969bec427f14d41f0aaef12ed689ca85b5Chris Lattner /// point. 50765e9f3969bec427f14d41f0aaef12ed689ca85b5Chris Lattner virtual void insertNoop(MachineBasicBlock &MBB, 508b6bbfebdc683a6a123410bca1175e14d264d4bc2Chris Lattner MachineBasicBlock::iterator MI) const; 509b6bbfebdc683a6a123410bca1175e14d264d4bc2Chris Lattner 510ee9eb411fffddbb8fe70418c05946a131889b487Chris Lattner 511ee9eb411fffddbb8fe70418c05946a131889b487Chris Lattner /// getNoopForMachoTarget - Return the noop instruction to use for a noop. 512ee9eb411fffddbb8fe70418c05946a131889b487Chris Lattner virtual void getNoopForMachoTarget(MCInst &NopInst) const { 513ee9eb411fffddbb8fe70418c05946a131889b487Chris Lattner // Default to just using 'nop' string. 514ee9eb411fffddbb8fe70418c05946a131889b487Chris Lattner } 515ee9eb411fffddbb8fe70418c05946a131889b487Chris Lattner 516ee9eb411fffddbb8fe70418c05946a131889b487Chris Lattner 517bfd2ec4a8ef51ebe982363a7e8d7156fdb3827d8Evan Cheng /// isPredicated - Returns true if the instruction is already predicated. 5184f85cd77046d76bd9091aa6caa06e767bd22f64cEvan Cheng /// 519f277ee4be7edabb759a7f78138b693d72d0c263fEvan Cheng virtual bool isPredicated(const MachineInstr *MI) const { 5204f85cd77046d76bd9091aa6caa06e767bd22f64cEvan Cheng return false; 5214f85cd77046d76bd9091aa6caa06e767bd22f64cEvan Cheng } 5224f85cd77046d76bd9091aa6caa06e767bd22f64cEvan Cheng 523bfd2ec4a8ef51ebe982363a7e8d7156fdb3827d8Evan Cheng /// isUnpredicatedTerminator - Returns true if the instruction is a 524bfd2ec4a8ef51ebe982363a7e8d7156fdb3827d8Evan Cheng /// terminator instruction that has not been predicated. 525318093b6f8d21ac8eab34573b0526984895fe941Dale Johannesen virtual bool isUnpredicatedTerminator(const MachineInstr *MI) const; 526bfd2ec4a8ef51ebe982363a7e8d7156fdb3827d8Evan Cheng 5270402e170e8058cc5256e0c7b94ae37484253d73dEvan Cheng /// PredicateInstruction - Convert the instruction into a predicated 52802c602b333ed2a1a13a17981f3c3f2f5463d5e5cEvan Cheng /// instruction. It returns true if the operation was successful. 529f277ee4be7edabb759a7f78138b693d72d0c263fEvan Cheng virtual 530f277ee4be7edabb759a7f78138b693d72d0c263fEvan Cheng bool PredicateInstruction(MachineInstr *MI, 53144eb65cf58e3ab9b5621ce72256d1621a18aeed7Owen Anderson const SmallVectorImpl<MachineOperand> &Pred) const = 0; 5324f85cd77046d76bd9091aa6caa06e767bd22f64cEvan Cheng 533bfd2ec4a8ef51ebe982363a7e8d7156fdb3827d8Evan Cheng /// SubsumesPredicate - Returns true if the first specified predicate 5344f85cd77046d76bd9091aa6caa06e767bd22f64cEvan Cheng /// subsumes the second, e.g. GE subsumes GT. 535f277ee4be7edabb759a7f78138b693d72d0c263fEvan Cheng virtual 53644eb65cf58e3ab9b5621ce72256d1621a18aeed7Owen Anderson bool SubsumesPredicate(const SmallVectorImpl<MachineOperand> &Pred1, 53744eb65cf58e3ab9b5621ce72256d1621a18aeed7Owen Anderson const SmallVectorImpl<MachineOperand> &Pred2) const { 5384f85cd77046d76bd9091aa6caa06e767bd22f64cEvan Cheng return false; 5394f85cd77046d76bd9091aa6caa06e767bd22f64cEvan Cheng } 5400402e170e8058cc5256e0c7b94ae37484253d73dEvan Cheng 541ed80ef6089ef83bd1c79f1477d7a12a949474af5Evan Cheng /// DefinesPredicate - If the specified instruction defines any predicate 542ed80ef6089ef83bd1c79f1477d7a12a949474af5Evan Cheng /// or condition code register(s) used for predication, returns true as well 543ed80ef6089ef83bd1c79f1477d7a12a949474af5Evan Cheng /// as the definition predicate(s) by reference. 544ed80ef6089ef83bd1c79f1477d7a12a949474af5Evan Cheng virtual bool DefinesPredicate(MachineInstr *MI, 545ed80ef6089ef83bd1c79f1477d7a12a949474af5Evan Cheng std::vector<MachineOperand> &Pred) const { 546ed80ef6089ef83bd1c79f1477d7a12a949474af5Evan Cheng return false; 547ed80ef6089ef83bd1c79f1477d7a12a949474af5Evan Cheng } 548ed80ef6089ef83bd1c79f1477d7a12a949474af5Evan Cheng 549e54cb16308ad40d0f0b257de47efaa0ee5a47004Evan Cheng /// isPredicable - Return true if the specified instruction can be predicated. 550e54cb16308ad40d0f0b257de47efaa0ee5a47004Evan Cheng /// By default, this returns true for every instruction with a 551e54cb16308ad40d0f0b257de47efaa0ee5a47004Evan Cheng /// PredicateOperand. 552e54cb16308ad40d0f0b257de47efaa0ee5a47004Evan Cheng virtual bool isPredicable(MachineInstr *MI) const { 553e54cb16308ad40d0f0b257de47efaa0ee5a47004Evan Cheng return MI->getDesc().isPredicable(); 554e54cb16308ad40d0f0b257de47efaa0ee5a47004Evan Cheng } 555e54cb16308ad40d0f0b257de47efaa0ee5a47004Evan Cheng 5564350eb86a7cdc83fa6a5f4819a7f0534ace5cd58Evan Cheng /// isSafeToMoveRegClassDefs - Return true if it's safe to move a machine 5574350eb86a7cdc83fa6a5f4819a7f0534ace5cd58Evan Cheng /// instruction that defines the specified register class. 5584350eb86a7cdc83fa6a5f4819a7f0534ace5cd58Evan Cheng virtual bool isSafeToMoveRegClassDefs(const TargetRegisterClass *RC) const { 55923066288fdf4867f53f208f9aaf2952b1c049394Evan Cheng return true; 56023066288fdf4867f53f208f9aaf2952b1c049394Evan Cheng } 56123066288fdf4867f53f208f9aaf2952b1c049394Evan Cheng 56286050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng /// isSchedulingBoundary - Test if the given instruction should be 56386050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng /// considered a scheduling boundary. This primarily includes labels and 56486050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng /// terminators. 56586050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng virtual bool isSchedulingBoundary(const MachineInstr *MI, 56686050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng const MachineBasicBlock *MBB, 56786050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng const MachineFunction &MF) const = 0; 56886050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng 569d90183d25dcbc0eabde56319fed4e8d6ace2e6ebChris Lattner /// Measure the specified inline asm to determine an approximation of its 570d90183d25dcbc0eabde56319fed4e8d6ace2e6ebChris Lattner /// length. 571d90183d25dcbc0eabde56319fed4e8d6ace2e6ebChris Lattner virtual unsigned getInlineAsmLength(const char *Str, 57233adcfb4d217f5f23d9bde8ba02b8e48f9605fc5Chris Lattner const MCAsmInfo &MAI) const; 573729aab3dd3a6ea5ca23430936270154090fcc10bEvan Cheng 574729aab3dd3a6ea5ca23430936270154090fcc10bEvan Cheng /// CreateTargetHazardRecognizer - Allocate and return a hazard recognizer 575729aab3dd3a6ea5ca23430936270154090fcc10bEvan Cheng /// to use for this target when scheduling the machine instructions after 576729aab3dd3a6ea5ca23430936270154090fcc10bEvan Cheng /// register allocation. 577729aab3dd3a6ea5ca23430936270154090fcc10bEvan Cheng virtual ScheduleHazardRecognizer* 578729aab3dd3a6ea5ca23430936270154090fcc10bEvan Cheng CreateTargetPostRAHazardRecognizer(const InstrItineraryData&) const = 0; 579e4ddbdfd3cf031034020671d03626f0373fbd5caBill Wendling 580c98af3370f899a0d1570b1dff01a2e36632f884fBill Wendling /// AnalyzeCompare - For a comparison instruction, return the source register 581c98af3370f899a0d1570b1dff01a2e36632f884fBill Wendling /// in SrcReg and the value it compares against in CmpValue. Return true if 582c98af3370f899a0d1570b1dff01a2e36632f884fBill Wendling /// the comparison instruction can be analyzed. 583c98af3370f899a0d1570b1dff01a2e36632f884fBill Wendling virtual bool AnalyzeCompare(const MachineInstr *MI, 584e4ddbdfd3cf031034020671d03626f0373fbd5caBill Wendling unsigned &SrcReg, int &CmpValue) const { 585e4ddbdfd3cf031034020671d03626f0373fbd5caBill Wendling return false; 586e4ddbdfd3cf031034020671d03626f0373fbd5caBill Wendling } 587e4ddbdfd3cf031034020671d03626f0373fbd5caBill Wendling 588c98af3370f899a0d1570b1dff01a2e36632f884fBill Wendling /// ConvertToSetZeroFlag - Convert the instruction to set the zero flag so 589e4ddbdfd3cf031034020671d03626f0373fbd5caBill Wendling /// that we can remove a "comparison with zero". 590c98af3370f899a0d1570b1dff01a2e36632f884fBill Wendling virtual bool ConvertToSetZeroFlag(MachineInstr *Instr, 591e4ddbdfd3cf031034020671d03626f0373fbd5caBill Wendling MachineInstr *CmpInstr) const { 592e4ddbdfd3cf031034020671d03626f0373fbd5caBill Wendling return false; 593e4ddbdfd3cf031034020671d03626f0373fbd5caBill Wendling } 594a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve}; 595a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve 596641055225092833197efe8e5bce01d50bcf1daaeChris Lattner/// TargetInstrInfoImpl - This is the default implementation of 597641055225092833197efe8e5bce01d50bcf1daaeChris Lattner/// TargetInstrInfo, which just provides a couple of default implementations 598641055225092833197efe8e5bce01d50bcf1daaeChris Lattner/// for various methods. This separated out because it is implemented in 599641055225092833197efe8e5bce01d50bcf1daaeChris Lattner/// libcodegen, not in libtarget. 600641055225092833197efe8e5bce01d50bcf1daaeChris Lattnerclass TargetInstrInfoImpl : public TargetInstrInfo { 601641055225092833197efe8e5bce01d50bcf1daaeChris Lattnerprotected: 602749c6f6b5ed301c84aac562e414486549d7b98ebChris Lattner TargetInstrInfoImpl(const TargetInstrDesc *desc, unsigned NumOpcodes) 603641055225092833197efe8e5bce01d50bcf1daaeChris Lattner : TargetInstrInfo(desc, NumOpcodes) {} 604641055225092833197efe8e5bce01d50bcf1daaeChris Lattnerpublic: 60586050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng virtual void ReplaceTailWithBranchTo(MachineBasicBlock::iterator OldInst, 60686050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng MachineBasicBlock *NewDest) const; 60758dcb0e0cd3fa973b5fd005aecab1df6aeea5cd6Evan Cheng virtual MachineInstr *commuteInstruction(MachineInstr *MI, 60858dcb0e0cd3fa973b5fd005aecab1df6aeea5cd6Evan Cheng bool NewMI = false) const; 609261ce1d5f89155d2e6f914f281db2004c89ee839Evan Cheng virtual bool findCommutedOpIndices(MachineInstr *MI, unsigned &SrcOpIdx1, 610261ce1d5f89155d2e6f914f281db2004c89ee839Evan Cheng unsigned &SrcOpIdx2) const; 6111f32340d95ac480bfc74bcfd00fd5cffbe078652Jakob Stoklund Olesen virtual bool canFoldMemoryOperand(const MachineInstr *MI, 6121f32340d95ac480bfc74bcfd00fd5cffbe078652Jakob Stoklund Olesen const SmallVectorImpl<unsigned> &Ops) const; 613641055225092833197efe8e5bce01d50bcf1daaeChris Lattner virtual bool PredicateInstruction(MachineInstr *MI, 61444eb65cf58e3ab9b5621ce72256d1621a18aeed7Owen Anderson const SmallVectorImpl<MachineOperand> &Pred) const; 615ca1267c02b025cc719190b05f9e1a5d174a9caf7Evan Cheng virtual void reMaterialize(MachineBasicBlock &MBB, 616ca1267c02b025cc719190b05f9e1a5d174a9caf7Evan Cheng MachineBasicBlock::iterator MI, 617378445303b10b092a898a75131141a8259cff50bEvan Cheng unsigned DestReg, unsigned SubReg, 618d57cdd5683ea926e489067364fb7ffe5fd5d35eeEvan Cheng const MachineInstr *Orig, 6199edf7deb37f0f97664f279040fa15d89f32e23d9Jakob Stoklund Olesen const TargetRegisterInfo &TRI) const; 62030ac0467ced4627a9b84d8a1d3ca5e8706ddad63Jakob Stoklund Olesen virtual MachineInstr *duplicate(MachineInstr *Orig, 62130ac0467ced4627a9b84d8a1d3ca5e8706ddad63Jakob Stoklund Olesen MachineFunction &MF) const; 622506049f29f4f202a8e45feb916cc0264440a7f6dEvan Cheng virtual bool produceSameValue(const MachineInstr *MI0, 623506049f29f4f202a8e45feb916cc0264440a7f6dEvan Cheng const MachineInstr *MI1) const; 62486050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng virtual bool isSchedulingBoundary(const MachineInstr *MI, 62586050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng const MachineBasicBlock *MBB, 62686050dc8cc0aaea8c9dfeb89de02cafbd7f48d92Evan Cheng const MachineFunction &MF) const; 627729aab3dd3a6ea5ca23430936270154090fcc10bEvan Cheng 628729aab3dd3a6ea5ca23430936270154090fcc10bEvan Cheng virtual ScheduleHazardRecognizer * 629729aab3dd3a6ea5ca23430936270154090fcc10bEvan Cheng CreateTargetPostRAHazardRecognizer(const InstrItineraryData&) const; 630641055225092833197efe8e5bce01d50bcf1daaeChris Lattner}; 631641055225092833197efe8e5bce01d50bcf1daaeChris Lattner 632d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke} // End llvm namespace 633d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke 634a578a6d054e8219c730840700d8d5fd29f15a962Vikram S. Adve#endif 635