MC: Merge MCSymbol and MCSymbolData
[oota-llvm.git] / include / llvm / MC / MCInstrAnalysis.h
index adca7b124d7c02134183fd2edab7b0c02172aa7e..8f5159e9e1c85319f73b1b0a8f516e7d19597559 100644 (file)
@@ -12,6 +12,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+#ifndef LLVM_MC_MCINSTRANALYSIS_H
+#define LLVM_MC_MCINSTRANALYSIS_H
+
 #include "llvm/MC/MCInst.h"
 #include "llvm/MC/MCInstrDesc.h"
 #include "llvm/MC/MCInstrInfo.h"
@@ -23,14 +26,17 @@ protected:
   friend class Target;
   const MCInstrInfo *Info;
 
-  MCInstrAnalysis(const MCInstrInfo *Info) : Info(Info) {}
 public:
+  MCInstrAnalysis(const MCInstrInfo *Info) : Info(Info) {}
+
+  virtual ~MCInstrAnalysis() {}
+
   virtual bool isBranch(const MCInst &Inst) const {
     return Info->get(Inst.getOpcode()).isBranch();
   }
 
   virtual bool isConditionalBranch(const MCInst &Inst) const {
-    return Info->get(Inst.getOpcode()).isBranch();
+    return Info->get(Inst.getOpcode()).isConditionalBranch();
   }
 
   virtual bool isUnconditionalBranch(const MCInst &Inst) const {
@@ -41,14 +47,25 @@ public:
     return Info->get(Inst.getOpcode()).isIndirectBranch();
   }
 
+  virtual bool isCall(const MCInst &Inst) const {
+    return Info->get(Inst.getOpcode()).isCall();
+  }
+
   virtual bool isReturn(const MCInst &Inst) const {
     return Info->get(Inst.getOpcode()).isReturn();
   }
 
-  /// evaluateBranch - Given a branch instruction try to get the address the
-  /// branch targets. Otherwise return -1.
-  virtual uint64_t
-  evaluateBranch(const MCInst &Inst, uint64_t Addr, uint64_t Size) const;
+  virtual bool isTerminator(const MCInst &Inst) const {
+    return Info->get(Inst.getOpcode()).isTerminator();
+  }
+
+  /// \brief Given a branch instruction try to get the address the branch
+  /// targets. Return true on success, and the address in Target.
+  virtual bool
+  evaluateBranch(const MCInst &Inst, uint64_t Addr, uint64_t Size,
+                 uint64_t &Target) const;
 };
 
-}
+} // End llvm namespace
+
+#endif