diff options
author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2007-08-18 01:59:45 +0000 |
---|---|---|
committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2007-08-18 01:59:45 +0000 |
commit | 0b2cd89a397b54d318f53848b7b4f9292b09b752 (patch) | |
tree | 44078738fdc4fa1543931d8e5488a8e7db61aab3 /lib/Target | |
parent | aff42dcf5d221bf2e94f209a2ef8b548cbbb9aeb (diff) | |
download | external_llvm-0b2cd89a397b54d318f53848b7b4f9292b09b752.zip external_llvm-0b2cd89a397b54d318f53848b7b4f9292b09b752.tar.gz external_llvm-0b2cd89a397b54d318f53848b7b4f9292b09b752.tar.bz2 |
Branch Analysis and InsertNoop inserted into header files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41155 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/Mips/MipsInstrInfo.h | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/lib/Target/Mips/MipsInstrInfo.h b/lib/Target/Mips/MipsInstrInfo.h index 356cf3d..b120f23 100644 --- a/lib/Target/Mips/MipsInstrInfo.h +++ b/lib/Target/Mips/MipsInstrInfo.h @@ -20,6 +20,29 @@ namespace llvm { +namespace Mips { + + // All CC branch operations on Mips I are turned + // into BEQ and BNE CC branches instructions. + enum CondCode { + COND_E, + COND_GZ, + COND_GEZ, + COND_LZ, + COND_LEZ, + COND_NE, + COND_INVALID + }; + + // Turn condition code into conditional branch opcode. + unsigned GetCondBranchFromCond(CondCode CC); + + /// GetOppositeBranchCondition - Return the inverse of the specified cond, + /// e.g. turning COND_E to COND_NE. + CondCode GetOppositeBranchCondition(Mips::CondCode CC); + +} + class MipsInstrInfo : public TargetInstrInfo { MipsTargetMachine &TM; @@ -52,10 +75,21 @@ public: /// not, return 0. This predicate must return 0 if the instruction has /// any side effects other than storing to the stack slot. virtual unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const; - + + /// Branch Analysis + virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, + MachineBasicBlock *&FBB, + std::vector<MachineOperand> &Cond) const; + virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const; virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, - MachineBasicBlock *FBB, + MachineBasicBlock *FBB, const std::vector<MachineOperand> &Cond) const; + virtual bool BlockHasNoFallThrough(MachineBasicBlock &MBB) const; + virtual bool ReverseBranchCondition(std::vector<MachineOperand> &Cond) const; + + /// Insert nop instruction when hazard condition is found + virtual void insertNoop(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MI) const; }; } |