[llvm-commits] [llvm] r41155 - /llvm/trunk/lib/Target/Mips/MipsInstrInfo.h

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Fri Aug 17 18:59:45 PDT 2007


Author: bruno
Date: Fri Aug 17 20:59:45 2007
New Revision: 41155

URL: http://llvm.org/viewvc/llvm-project?rev=41155&view=rev
Log:
Branch Analysis and InsertNoop inserted into header files

Modified:
    llvm/trunk/lib/Target/Mips/MipsInstrInfo.h

Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.h?rev=41155&r1=41154&r2=41155&view=diff

==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsInstrInfo.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.h Fri Aug 17 20:59:45 2007
@@ -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 @@
   /// 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;
 };
 
 }





More information about the llvm-commits mailing list