LLVM API Documentation

MachineInstr.h
Go to the documentation of this file.
00001 //===-- llvm/CodeGen/MachineInstr.h - MachineInstr class --------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file contains the declaration of the MachineInstr class, which is the
00011 // basic representation for all target dependent machine instructions used by
00012 // the back end.
00013 //
00014 //===----------------------------------------------------------------------===//
00015 
00016 #ifndef LLVM_CODEGEN_MACHINEINSTR_H
00017 #define LLVM_CODEGEN_MACHINEINSTR_H
00018 
00019 #include "llvm/ADT/ArrayRef.h"
00020 #include "llvm/ADT/DenseMapInfo.h"
00021 #include "llvm/ADT/STLExtras.h"
00022 #include "llvm/ADT/StringRef.h"
00023 #include "llvm/ADT/ilist.h"
00024 #include "llvm/ADT/ilist_node.h"
00025 #include "llvm/CodeGen/MachineOperand.h"
00026 #include "llvm/IR/InlineAsm.h"
00027 #include "llvm/MC/MCInstrDesc.h"
00028 #include "llvm/Support/ArrayRecycler.h"
00029 #include "llvm/Support/DebugLoc.h"
00030 #include "llvm/Target/TargetOpcodes.h"
00031 #include <vector>
00032 
00033 namespace llvm {
00034 
00035 template <typename T> class SmallVectorImpl;
00036 class AliasAnalysis;
00037 class TargetInstrInfo;
00038 class TargetRegisterClass;
00039 class TargetRegisterInfo;
00040 class MachineFunction;
00041 class MachineMemOperand;
00042 
00043 //===----------------------------------------------------------------------===//
00044 /// MachineInstr - Representation of each machine instruction.
00045 ///
00046 /// This class isn't a POD type, but it must have a trivial destructor. When a
00047 /// MachineFunction is deleted, all the contained MachineInstrs are deallocated
00048 /// without having their destructor called.
00049 ///
00050 class MachineInstr : public ilist_node<MachineInstr> {
00051 public:
00052   typedef MachineMemOperand **mmo_iterator;
00053 
00054   /// Flags to specify different kinds of comments to output in
00055   /// assembly code.  These flags carry semantic information not
00056   /// otherwise easily derivable from the IR text.
00057   ///
00058   enum CommentFlag {
00059     ReloadReuse = 0x1
00060   };
00061 
00062   enum MIFlag {
00063     NoFlags      = 0,
00064     FrameSetup   = 1 << 0,              // Instruction is used as a part of
00065                                         // function frame setup code.
00066     BundledPred  = 1 << 1,              // Instruction has bundled predecessors.
00067     BundledSucc  = 1 << 2               // Instruction has bundled successors.
00068   };
00069 private:
00070   const MCInstrDesc *MCID;              // Instruction descriptor.
00071   MachineBasicBlock *Parent;            // Pointer to the owning basic block.
00072 
00073   // Operands are allocated by an ArrayRecycler.
00074   MachineOperand *Operands;             // Pointer to the first operand.
00075   unsigned NumOperands;                 // Number of operands on instruction.
00076   typedef ArrayRecycler<MachineOperand>::Capacity OperandCapacity;
00077   OperandCapacity CapOperands;          // Capacity of the Operands array.
00078 
00079   uint8_t Flags;                        // Various bits of additional
00080                                         // information about machine
00081                                         // instruction.
00082 
00083   uint8_t AsmPrinterFlags;              // Various bits of information used by
00084                                         // the AsmPrinter to emit helpful
00085                                         // comments.  This is *not* semantic
00086                                         // information.  Do not use this for
00087                                         // anything other than to convey comment
00088                                         // information to AsmPrinter.
00089 
00090   uint8_t NumMemRefs;                   // Information on memory references.
00091   mmo_iterator MemRefs;
00092 
00093   DebugLoc debugLoc;                    // Source line information.
00094 
00095   MachineInstr(const MachineInstr&) LLVM_DELETED_FUNCTION;
00096   void operator=(const MachineInstr&) LLVM_DELETED_FUNCTION;
00097   // Use MachineFunction::DeleteMachineInstr() instead.
00098   ~MachineInstr() LLVM_DELETED_FUNCTION;
00099 
00100   // Intrusive list support
00101   friend struct ilist_traits<MachineInstr>;
00102   friend struct ilist_traits<MachineBasicBlock>;
00103   void setParent(MachineBasicBlock *P) { Parent = P; }
00104 
00105   /// MachineInstr ctor - This constructor creates a copy of the given
00106   /// MachineInstr in the given MachineFunction.
00107   MachineInstr(MachineFunction &, const MachineInstr &);
00108 
00109   /// MachineInstr ctor - This constructor create a MachineInstr and add the
00110   /// implicit operands.  It reserves space for number of operands specified by
00111   /// MCInstrDesc.  An explicit DebugLoc is supplied.
00112   MachineInstr(MachineFunction&, const MCInstrDesc &MCID,
00113                const DebugLoc dl, bool NoImp = false);
00114 
00115   // MachineInstrs are pool-allocated and owned by MachineFunction.
00116   friend class MachineFunction;
00117 
00118 public:
00119   const MachineBasicBlock* getParent() const { return Parent; }
00120   MachineBasicBlock* getParent() { return Parent; }
00121 
00122   /// getAsmPrinterFlags - Return the asm printer flags bitvector.
00123   ///
00124   uint8_t getAsmPrinterFlags() const { return AsmPrinterFlags; }
00125 
00126   /// clearAsmPrinterFlags - clear the AsmPrinter bitvector
00127   ///
00128   void clearAsmPrinterFlags() { AsmPrinterFlags = 0; }
00129 
00130   /// getAsmPrinterFlag - Return whether an AsmPrinter flag is set.
00131   ///
00132   bool getAsmPrinterFlag(CommentFlag Flag) const {
00133     return AsmPrinterFlags & Flag;
00134   }
00135 
00136   /// setAsmPrinterFlag - Set a flag for the AsmPrinter.
00137   ///
00138   void setAsmPrinterFlag(CommentFlag Flag) {
00139     AsmPrinterFlags |= (uint8_t)Flag;
00140   }
00141 
00142   /// clearAsmPrinterFlag - clear specific AsmPrinter flags
00143   ///
00144   void clearAsmPrinterFlag(CommentFlag Flag) {
00145     AsmPrinterFlags &= ~Flag;
00146   }
00147 
00148   /// getFlags - Return the MI flags bitvector.
00149   uint8_t getFlags() const {
00150     return Flags;
00151   }
00152 
00153   /// getFlag - Return whether an MI flag is set.
00154   bool getFlag(MIFlag Flag) const {
00155     return Flags & Flag;
00156   }
00157 
00158   /// setFlag - Set a MI flag.
00159   void setFlag(MIFlag Flag) {
00160     Flags |= (uint8_t)Flag;
00161   }
00162 
00163   void setFlags(unsigned flags) {
00164     // Filter out the automatically maintained flags.
00165     unsigned Mask = BundledPred | BundledSucc;
00166     Flags = (Flags & Mask) | (flags & ~Mask);
00167   }
00168 
00169   /// clearFlag - Clear a MI flag.
00170   void clearFlag(MIFlag Flag) {
00171     Flags &= ~((uint8_t)Flag);
00172   }
00173 
00174   /// isInsideBundle - Return true if MI is in a bundle (but not the first MI
00175   /// in a bundle).
00176   ///
00177   /// A bundle looks like this before it's finalized:
00178   ///   ----------------
00179   ///   |      MI      |
00180   ///   ----------------
00181   ///          |
00182   ///   ----------------
00183   ///   |      MI    * |
00184   ///   ----------------
00185   ///          |
00186   ///   ----------------
00187   ///   |      MI    * |
00188   ///   ----------------
00189   /// In this case, the first MI starts a bundle but is not inside a bundle, the
00190   /// next 2 MIs are considered "inside" the bundle.
00191   ///
00192   /// After a bundle is finalized, it looks like this:
00193   ///   ----------------
00194   ///   |    Bundle    |
00195   ///   ----------------
00196   ///          |
00197   ///   ----------------
00198   ///   |      MI    * |
00199   ///   ----------------
00200   ///          |
00201   ///   ----------------
00202   ///   |      MI    * |
00203   ///   ----------------
00204   ///          |
00205   ///   ----------------
00206   ///   |      MI    * |
00207   ///   ----------------
00208   /// The first instruction has the special opcode "BUNDLE". It's not "inside"
00209   /// a bundle, but the next three MIs are.
00210   bool isInsideBundle() const {
00211     return getFlag(BundledPred);
00212   }
00213 
00214   /// isBundled - Return true if this instruction part of a bundle. This is true
00215   /// if either itself or its following instruction is marked "InsideBundle".
00216   bool isBundled() const {
00217     return isBundledWithPred() || isBundledWithSucc();
00218   }
00219 
00220   /// Return true if this instruction is part of a bundle, and it is not the
00221   /// first instruction in the bundle.
00222   bool isBundledWithPred() const { return getFlag(BundledPred); }
00223 
00224   /// Return true if this instruction is part of a bundle, and it is not the
00225   /// last instruction in the bundle.
00226   bool isBundledWithSucc() const { return getFlag(BundledSucc); }
00227 
00228   /// Bundle this instruction with its predecessor. This can be an unbundled
00229   /// instruction, or it can be the first instruction in a bundle.
00230   void bundleWithPred();
00231 
00232   /// Bundle this instruction with its successor. This can be an unbundled
00233   /// instruction, or it can be the last instruction in a bundle.
00234   void bundleWithSucc();
00235 
00236   /// Break bundle above this instruction.
00237   void unbundleFromPred();
00238 
00239   /// Break bundle below this instruction.
00240   void unbundleFromSucc();
00241 
00242   /// getDebugLoc - Returns the debug location id of this MachineInstr.
00243   ///
00244   DebugLoc getDebugLoc() const { return debugLoc; }
00245 
00246   /// emitError - Emit an error referring to the source location of this
00247   /// instruction. This should only be used for inline assembly that is somehow
00248   /// impossible to compile. Other errors should have been handled much
00249   /// earlier.
00250   ///
00251   /// If this method returns, the caller should try to recover from the error.
00252   ///
00253   void emitError(StringRef Msg) const;
00254 
00255   /// getDesc - Returns the target instruction descriptor of this
00256   /// MachineInstr.
00257   const MCInstrDesc &getDesc() const { return *MCID; }
00258 
00259   /// getOpcode - Returns the opcode of this MachineInstr.
00260   ///
00261   int getOpcode() const { return MCID->Opcode; }
00262 
00263   /// Access to explicit operands of the instruction.
00264   ///
00265   unsigned getNumOperands() const { return NumOperands; }
00266 
00267   const MachineOperand& getOperand(unsigned i) const {
00268     assert(i < getNumOperands() && "getOperand() out of range!");
00269     return Operands[i];
00270   }
00271   MachineOperand& getOperand(unsigned i) {
00272     assert(i < getNumOperands() && "getOperand() out of range!");
00273     return Operands[i];
00274   }
00275 
00276   /// getNumExplicitOperands - Returns the number of non-implicit operands.
00277   ///
00278   unsigned getNumExplicitOperands() const;
00279 
00280   /// iterator/begin/end - Iterate over all operands of a machine instruction.
00281   typedef MachineOperand *mop_iterator;
00282   typedef const MachineOperand *const_mop_iterator;
00283 
00284   mop_iterator operands_begin() { return Operands; }
00285   mop_iterator operands_end() { return Operands + NumOperands; }
00286 
00287   const_mop_iterator operands_begin() const { return Operands; }
00288   const_mop_iterator operands_end() const { return Operands + NumOperands; }
00289 
00290   /// Access to memory operands of the instruction
00291   mmo_iterator memoperands_begin() const { return MemRefs; }
00292   mmo_iterator memoperands_end() const { return MemRefs + NumMemRefs; }
00293   bool memoperands_empty() const { return NumMemRefs == 0; }
00294 
00295   /// hasOneMemOperand - Return true if this instruction has exactly one
00296   /// MachineMemOperand.
00297   bool hasOneMemOperand() const {
00298     return NumMemRefs == 1;
00299   }
00300 
00301   /// API for querying MachineInstr properties. They are the same as MCInstrDesc
00302   /// queries but they are bundle aware.
00303 
00304   enum QueryType {
00305     IgnoreBundle,    // Ignore bundles
00306     AnyInBundle,     // Return true if any instruction in bundle has property
00307     AllInBundle      // Return true if all instructions in bundle have property
00308   };
00309 
00310   /// hasProperty - Return true if the instruction (or in the case of a bundle,
00311   /// the instructions inside the bundle) has the specified property.
00312   /// The first argument is the property being queried.
00313   /// The second argument indicates whether the query should look inside
00314   /// instruction bundles.
00315   bool hasProperty(unsigned MCFlag, QueryType Type = AnyInBundle) const {
00316     // Inline the fast path for unbundled or bundle-internal instructions.
00317     if (Type == IgnoreBundle || !isBundled() || isBundledWithPred())
00318       return getDesc().getFlags() & (1 << MCFlag);
00319 
00320     // If this is the first instruction in a bundle, take the slow path.
00321     return hasPropertyInBundle(1 << MCFlag, Type);
00322   }
00323 
00324   /// isVariadic - Return true if this instruction can have a variable number of
00325   /// operands.  In this case, the variable operands will be after the normal
00326   /// operands but before the implicit definitions and uses (if any are
00327   /// present).
00328   bool isVariadic(QueryType Type = IgnoreBundle) const {
00329     return hasProperty(MCID::Variadic, Type);
00330   }
00331 
00332   /// hasOptionalDef - Set if this instruction has an optional definition, e.g.
00333   /// ARM instructions which can set condition code if 's' bit is set.
00334   bool hasOptionalDef(QueryType Type = IgnoreBundle) const {
00335     return hasProperty(MCID::HasOptionalDef, Type);
00336   }
00337 
00338   /// isPseudo - Return true if this is a pseudo instruction that doesn't
00339   /// correspond to a real machine instruction.
00340   ///
00341   bool isPseudo(QueryType Type = IgnoreBundle) const {
00342     return hasProperty(MCID::Pseudo, Type);
00343   }
00344 
00345   bool isReturn(QueryType Type = AnyInBundle) const {
00346     return hasProperty(MCID::Return, Type);
00347   }
00348 
00349   bool isCall(QueryType Type = AnyInBundle) const {
00350     return hasProperty(MCID::Call, Type);
00351   }
00352 
00353   /// isBarrier - Returns true if the specified instruction stops control flow
00354   /// from executing the instruction immediately following it.  Examples include
00355   /// unconditional branches and return instructions.
00356   bool isBarrier(QueryType Type = AnyInBundle) const {
00357     return hasProperty(MCID::Barrier, Type);
00358   }
00359 
00360   /// isTerminator - Returns true if this instruction part of the terminator for
00361   /// a basic block.  Typically this is things like return and branch
00362   /// instructions.
00363   ///
00364   /// Various passes use this to insert code into the bottom of a basic block,
00365   /// but before control flow occurs.
00366   bool isTerminator(QueryType Type = AnyInBundle) const {
00367     return hasProperty(MCID::Terminator, Type);
00368   }
00369 
00370   /// isBranch - Returns true if this is a conditional, unconditional, or
00371   /// indirect branch.  Predicates below can be used to discriminate between
00372   /// these cases, and the TargetInstrInfo::AnalyzeBranch method can be used to
00373   /// get more information.
00374   bool isBranch(QueryType Type = AnyInBundle) const {
00375     return hasProperty(MCID::Branch, Type);
00376   }
00377 
00378   /// isIndirectBranch - Return true if this is an indirect branch, such as a
00379   /// branch through a register.
00380   bool isIndirectBranch(QueryType Type = AnyInBundle) const {
00381     return hasProperty(MCID::IndirectBranch, Type);
00382   }
00383 
00384   /// isConditionalBranch - Return true if this is a branch which may fall
00385   /// through to the next instruction or may transfer control flow to some other
00386   /// block.  The TargetInstrInfo::AnalyzeBranch method can be used to get more
00387   /// information about this branch.
00388   bool isConditionalBranch(QueryType Type = AnyInBundle) const {
00389     return isBranch(Type) & !isBarrier(Type) & !isIndirectBranch(Type);
00390   }
00391 
00392   /// isUnconditionalBranch - Return true if this is a branch which always
00393   /// transfers control flow to some other block.  The
00394   /// TargetInstrInfo::AnalyzeBranch method can be used to get more information
00395   /// about this branch.
00396   bool isUnconditionalBranch(QueryType Type = AnyInBundle) const {
00397     return isBranch(Type) & isBarrier(Type) & !isIndirectBranch(Type);
00398   }
00399 
00400   // isPredicable - Return true if this instruction has a predicate operand that
00401   // controls execution.  It may be set to 'always', or may be set to other
00402   /// values.   There are various methods in TargetInstrInfo that can be used to
00403   /// control and modify the predicate in this instruction.
00404   bool isPredicable(QueryType Type = AllInBundle) const {
00405     // If it's a bundle than all bundled instructions must be predicable for this
00406     // to return true.
00407     return hasProperty(MCID::Predicable, Type);
00408   }
00409 
00410   /// isCompare - Return true if this instruction is a comparison.
00411   bool isCompare(QueryType Type = IgnoreBundle) const {
00412     return hasProperty(MCID::Compare, Type);
00413   }
00414 
00415   /// isMoveImmediate - Return true if this instruction is a move immediate
00416   /// (including conditional moves) instruction.
00417   bool isMoveImmediate(QueryType Type = IgnoreBundle) const {
00418     return hasProperty(MCID::MoveImm, Type);
00419   }
00420 
00421   /// isBitcast - Return true if this instruction is a bitcast instruction.
00422   ///
00423   bool isBitcast(QueryType Type = IgnoreBundle) const {
00424     return hasProperty(MCID::Bitcast, Type);
00425   }
00426 
00427   /// isSelect - Return true if this instruction is a select instruction.
00428   ///
00429   bool isSelect(QueryType Type = IgnoreBundle) const {
00430     return hasProperty(MCID::Select, Type);
00431   }
00432 
00433   /// isNotDuplicable - Return true if this instruction cannot be safely
00434   /// duplicated.  For example, if the instruction has a unique labels attached
00435   /// to it, duplicating it would cause multiple definition errors.
00436   bool isNotDuplicable(QueryType Type = AnyInBundle) const {
00437     return hasProperty(MCID::NotDuplicable, Type);
00438   }
00439 
00440   /// hasDelaySlot - Returns true if the specified instruction has a delay slot
00441   /// which must be filled by the code generator.
00442   bool hasDelaySlot(QueryType Type = AnyInBundle) const {
00443     return hasProperty(MCID::DelaySlot, Type);
00444   }
00445 
00446   /// canFoldAsLoad - Return true for instructions that can be folded as
00447   /// memory operands in other instructions. The most common use for this
00448   /// is instructions that are simple loads from memory that don't modify
00449   /// the loaded value in any way, but it can also be used for instructions
00450   /// that can be expressed as constant-pool loads, such as V_SETALLONES
00451   /// on x86, to allow them to be folded when it is beneficial.
00452   /// This should only be set on instructions that return a value in their
00453   /// only virtual register definition.
00454   bool canFoldAsLoad(QueryType Type = IgnoreBundle) const {
00455     return hasProperty(MCID::FoldableAsLoad, Type);
00456   }
00457 
00458   //===--------------------------------------------------------------------===//
00459   // Side Effect Analysis
00460   //===--------------------------------------------------------------------===//
00461 
00462   /// mayLoad - Return true if this instruction could possibly read memory.
00463   /// Instructions with this flag set are not necessarily simple load
00464   /// instructions, they may load a value and modify it, for example.
00465   bool mayLoad(QueryType Type = AnyInBundle) const {
00466     if (isInlineAsm()) {
00467       unsigned ExtraInfo = getOperand(InlineAsm::MIOp_ExtraInfo).getImm();
00468       if (ExtraInfo & InlineAsm::Extra_MayLoad)
00469         return true;
00470     }
00471     return hasProperty(MCID::MayLoad, Type);
00472   }
00473 
00474 
00475   /// mayStore - Return true if this instruction could possibly modify memory.
00476   /// Instructions with this flag set are not necessarily simple store
00477   /// instructions, they may store a modified value based on their operands, or
00478   /// may not actually modify anything, for example.
00479   bool mayStore(QueryType Type = AnyInBundle) const {
00480     if (isInlineAsm()) {
00481       unsigned ExtraInfo = getOperand(InlineAsm::MIOp_ExtraInfo).getImm();
00482       if (ExtraInfo & InlineAsm::Extra_MayStore)
00483         return true;
00484     }
00485     return hasProperty(MCID::MayStore, Type);
00486   }
00487 
00488   //===--------------------------------------------------------------------===//
00489   // Flags that indicate whether an instruction can be modified by a method.
00490   //===--------------------------------------------------------------------===//
00491 
00492   /// isCommutable - Return true if this may be a 2- or 3-address
00493   /// instruction (of the form "X = op Y, Z, ..."), which produces the same
00494   /// result if Y and Z are exchanged.  If this flag is set, then the
00495   /// TargetInstrInfo::commuteInstruction method may be used to hack on the
00496   /// instruction.
00497   ///
00498   /// Note that this flag may be set on instructions that are only commutable
00499   /// sometimes.  In these cases, the call to commuteInstruction will fail.
00500   /// Also note that some instructions require non-trivial modification to
00501   /// commute them.
00502   bool isCommutable(QueryType Type = IgnoreBundle) const {
00503     return hasProperty(MCID::Commutable, Type);
00504   }
00505 
00506   /// isConvertibleTo3Addr - Return true if this is a 2-address instruction
00507   /// which can be changed into a 3-address instruction if needed.  Doing this
00508   /// transformation can be profitable in the register allocator, because it
00509   /// means that the instruction can use a 2-address form if possible, but
00510   /// degrade into a less efficient form if the source and dest register cannot
00511   /// be assigned to the same register.  For example, this allows the x86
00512   /// backend to turn a "shl reg, 3" instruction into an LEA instruction, which
00513   /// is the same speed as the shift but has bigger code size.
00514   ///
00515   /// If this returns true, then the target must implement the
00516   /// TargetInstrInfo::convertToThreeAddress method for this instruction, which
00517   /// is allowed to fail if the transformation isn't valid for this specific
00518   /// instruction (e.g. shl reg, 4 on x86).
00519   ///
00520   bool isConvertibleTo3Addr(QueryType Type = IgnoreBundle) const {
00521     return hasProperty(MCID::ConvertibleTo3Addr, Type);
00522   }
00523 
00524   /// usesCustomInsertionHook - Return true if this instruction requires
00525   /// custom insertion support when the DAG scheduler is inserting it into a
00526   /// machine basic block.  If this is true for the instruction, it basically
00527   /// means that it is a pseudo instruction used at SelectionDAG time that is
00528   /// expanded out into magic code by the target when MachineInstrs are formed.
00529   ///
00530   /// If this is true, the TargetLoweringInfo::InsertAtEndOfBasicBlock method
00531   /// is used to insert this into the MachineBasicBlock.
00532   bool usesCustomInsertionHook(QueryType Type = IgnoreBundle) const {
00533     return hasProperty(MCID::UsesCustomInserter, Type);
00534   }
00535 
00536   /// hasPostISelHook - Return true if this instruction requires *adjustment*
00537   /// after instruction selection by calling a target hook. For example, this
00538   /// can be used to fill in ARM 's' optional operand depending on whether
00539   /// the conditional flag register is used.
00540   bool hasPostISelHook(QueryType Type = IgnoreBundle) const {
00541     return hasProperty(MCID::HasPostISelHook, Type);
00542   }
00543 
00544   /// isRematerializable - Returns true if this instruction is a candidate for
00545   /// remat.  This flag is deprecated, please don't use it anymore.  If this
00546   /// flag is set, the isReallyTriviallyReMaterializable() method is called to
00547   /// verify the instruction is really rematable.
00548   bool isRematerializable(QueryType Type = AllInBundle) const {
00549     // It's only possible to re-mat a bundle if all bundled instructions are
00550     // re-materializable.
00551     return hasProperty(MCID::Rematerializable, Type);
00552   }
00553 
00554   /// isAsCheapAsAMove - Returns true if this instruction has the same cost (or
00555   /// less) than a move instruction. This is useful during certain types of
00556   /// optimizations (e.g., remat during two-address conversion or machine licm)
00557   /// where we would like to remat or hoist the instruction, but not if it costs
00558   /// more than moving the instruction into the appropriate register. Note, we
00559   /// are not marking copies from and to the same register class with this flag.
00560   bool isAsCheapAsAMove(QueryType Type = AllInBundle) const {
00561     // Only returns true for a bundle if all bundled instructions are cheap.
00562     // FIXME: This probably requires a target hook.
00563     return hasProperty(MCID::CheapAsAMove, Type);
00564   }
00565 
00566   /// hasExtraSrcRegAllocReq - Returns true if this instruction source operands
00567   /// have special register allocation requirements that are not captured by the
00568   /// operand register classes. e.g. ARM::STRD's two source registers must be an
00569   /// even / odd pair, ARM::STM registers have to be in ascending order.
00570   /// Post-register allocation passes should not attempt to change allocations
00571   /// for sources of instructions with this flag.
00572   bool hasExtraSrcRegAllocReq(QueryType Type = AnyInBundle) const {
00573     return hasProperty(MCID::ExtraSrcRegAllocReq, Type);
00574   }
00575 
00576   /// hasExtraDefRegAllocReq - Returns true if this instruction def operands
00577   /// have special register allocation requirements that are not captured by the
00578   /// operand register classes. e.g. ARM::LDRD's two def registers must be an
00579   /// even / odd pair, ARM::LDM registers have to be in ascending order.
00580   /// Post-register allocation passes should not attempt to change allocations
00581   /// for definitions of instructions with this flag.
00582   bool hasExtraDefRegAllocReq(QueryType Type = AnyInBundle) const {
00583     return hasProperty(MCID::ExtraDefRegAllocReq, Type);
00584   }
00585 
00586 
00587   enum MICheckType {
00588     CheckDefs,      // Check all operands for equality
00589     CheckKillDead,  // Check all operands including kill / dead markers
00590     IgnoreDefs,     // Ignore all definitions
00591     IgnoreVRegDefs  // Ignore virtual register definitions
00592   };
00593 
00594   /// isIdenticalTo - Return true if this instruction is identical to (same
00595   /// opcode and same operands as) the specified instruction.
00596   bool isIdenticalTo(const MachineInstr *Other,
00597                      MICheckType Check = CheckDefs) const;
00598 
00599   /// Unlink 'this' from the containing basic block, and return it without
00600   /// deleting it.
00601   ///
00602   /// This function can not be used on bundled instructions, use
00603   /// removeFromBundle() to remove individual instructions from a bundle.
00604   MachineInstr *removeFromParent();
00605 
00606   /// Unlink this instruction from its basic block and return it without
00607   /// deleting it.
00608   ///
00609   /// If the instruction is part of a bundle, the other instructions in the
00610   /// bundle remain bundled.
00611   MachineInstr *removeFromBundle();
00612 
00613   /// Unlink 'this' from the containing basic block and delete it.
00614   ///
00615   /// If this instruction is the header of a bundle, the whole bundle is erased.
00616   /// This function can not be used for instructions inside a bundle, use
00617   /// eraseFromBundle() to erase individual bundled instructions.
00618   void eraseFromParent();
00619 
00620   /// Unlink 'this' form its basic block and delete it.
00621   ///
00622   /// If the instruction is part of a bundle, the other instructions in the
00623   /// bundle remain bundled.
00624   void eraseFromBundle();
00625 
00626   /// isLabel - Returns true if the MachineInstr represents a label.
00627   ///
00628   bool isLabel() const {
00629     return getOpcode() == TargetOpcode::PROLOG_LABEL ||
00630            getOpcode() == TargetOpcode::EH_LABEL ||
00631            getOpcode() == TargetOpcode::GC_LABEL;
00632   }
00633 
00634   bool isPrologLabel() const {
00635     return getOpcode() == TargetOpcode::PROLOG_LABEL;
00636   }
00637   bool isEHLabel() const { return getOpcode() == TargetOpcode::EH_LABEL; }
00638   bool isGCLabel() const { return getOpcode() == TargetOpcode::GC_LABEL; }
00639   bool isDebugValue() const { return getOpcode() == TargetOpcode::DBG_VALUE; }
00640 
00641   bool isPHI() const { return getOpcode() == TargetOpcode::PHI; }
00642   bool isKill() const { return getOpcode() == TargetOpcode::KILL; }
00643   bool isImplicitDef() const { return getOpcode()==TargetOpcode::IMPLICIT_DEF; }
00644   bool isInlineAsm() const { return getOpcode() == TargetOpcode::INLINEASM; }
00645   bool isMSInlineAsm() const { 
00646     return getOpcode() == TargetOpcode::INLINEASM && getInlineAsmDialect();
00647   }
00648   bool isStackAligningInlineAsm() const;
00649   InlineAsm::AsmDialect getInlineAsmDialect() const;
00650   bool isInsertSubreg() const {
00651     return getOpcode() == TargetOpcode::INSERT_SUBREG;
00652   }
00653   bool isSubregToReg() const {
00654     return getOpcode() == TargetOpcode::SUBREG_TO_REG;
00655   }
00656   bool isRegSequence() const {
00657     return getOpcode() == TargetOpcode::REG_SEQUENCE;
00658   }
00659   bool isBundle() const {
00660     return getOpcode() == TargetOpcode::BUNDLE;
00661   }
00662   bool isCopy() const {
00663     return getOpcode() == TargetOpcode::COPY;
00664   }
00665   bool isFullCopy() const {
00666     return isCopy() && !getOperand(0).getSubReg() && !getOperand(1).getSubReg();
00667   }
00668 
00669   /// isCopyLike - Return true if the instruction behaves like a copy.
00670   /// This does not include native copy instructions.
00671   bool isCopyLike() const {
00672     return isCopy() || isSubregToReg();
00673   }
00674 
00675   /// isIdentityCopy - Return true is the instruction is an identity copy.
00676   bool isIdentityCopy() const {
00677     return isCopy() && getOperand(0).getReg() == getOperand(1).getReg() &&
00678       getOperand(0).getSubReg() == getOperand(1).getSubReg();
00679   }
00680 
00681   /// isTransient - Return true if this is a transient instruction that is
00682   /// either very likely to be eliminated during register allocation (such as
00683   /// copy-like instructions), or if this instruction doesn't have an
00684   /// execution-time cost.
00685   bool isTransient() const {
00686     switch(getOpcode()) {
00687     default: return false;
00688     // Copy-like instructions are usually eliminated during register allocation.
00689     case TargetOpcode::PHI:
00690     case TargetOpcode::COPY:
00691     case TargetOpcode::INSERT_SUBREG:
00692     case TargetOpcode::SUBREG_TO_REG:
00693     case TargetOpcode::REG_SEQUENCE:
00694     // Pseudo-instructions that don't produce any real output.
00695     case TargetOpcode::IMPLICIT_DEF:
00696     case TargetOpcode::KILL:
00697     case TargetOpcode::PROLOG_LABEL:
00698     case TargetOpcode::EH_LABEL:
00699     case TargetOpcode::GC_LABEL:
00700     case TargetOpcode::DBG_VALUE:
00701       return true;
00702     }
00703   }
00704 
00705   /// Return the number of instructions inside the MI bundle, excluding the
00706   /// bundle header.
00707   ///
00708   /// This is the number of instructions that MachineBasicBlock::iterator
00709   /// skips, 0 for unbundled instructions.
00710   unsigned getBundleSize() const;
00711 
00712   /// readsRegister - Return true if the MachineInstr reads the specified
00713   /// register. If TargetRegisterInfo is passed, then it also checks if there
00714   /// is a read of a super-register.
00715   /// This does not count partial redefines of virtual registers as reads:
00716   ///   %reg1024:6 = OP.
00717   bool readsRegister(unsigned Reg, const TargetRegisterInfo *TRI = NULL) const {
00718     return findRegisterUseOperandIdx(Reg, false, TRI) != -1;
00719   }
00720 
00721   /// readsVirtualRegister - Return true if the MachineInstr reads the specified
00722   /// virtual register. Take into account that a partial define is a
00723   /// read-modify-write operation.
00724   bool readsVirtualRegister(unsigned Reg) const {
00725     return readsWritesVirtualRegister(Reg).first;
00726   }
00727 
00728   /// readsWritesVirtualRegister - Return a pair of bools (reads, writes)
00729   /// indicating if this instruction reads or writes Reg. This also considers
00730   /// partial defines.
00731   /// If Ops is not null, all operand indices for Reg are added.
00732   std::pair<bool,bool> readsWritesVirtualRegister(unsigned Reg,
00733                                       SmallVectorImpl<unsigned> *Ops = 0) const;
00734 
00735   /// killsRegister - Return true if the MachineInstr kills the specified
00736   /// register. If TargetRegisterInfo is passed, then it also checks if there is
00737   /// a kill of a super-register.
00738   bool killsRegister(unsigned Reg, const TargetRegisterInfo *TRI = NULL) const {
00739     return findRegisterUseOperandIdx(Reg, true, TRI) != -1;
00740   }
00741 
00742   /// definesRegister - Return true if the MachineInstr fully defines the
00743   /// specified register. If TargetRegisterInfo is passed, then it also checks
00744   /// if there is a def of a super-register.
00745   /// NOTE: It's ignoring subreg indices on virtual registers.
00746   bool definesRegister(unsigned Reg, const TargetRegisterInfo *TRI=NULL) const {
00747     return findRegisterDefOperandIdx(Reg, false, false, TRI) != -1;
00748   }
00749 
00750   /// modifiesRegister - Return true if the MachineInstr modifies (fully define
00751   /// or partially define) the specified register.
00752   /// NOTE: It's ignoring subreg indices on virtual registers.
00753   bool modifiesRegister(unsigned Reg, const TargetRegisterInfo *TRI) const {
00754     return findRegisterDefOperandIdx(Reg, false, true, TRI) != -1;
00755   }
00756 
00757   /// registerDefIsDead - Returns true if the register is dead in this machine
00758   /// instruction. If TargetRegisterInfo is passed, then it also checks
00759   /// if there is a dead def of a super-register.
00760   bool registerDefIsDead(unsigned Reg,
00761                          const TargetRegisterInfo *TRI = NULL) const {
00762     return findRegisterDefOperandIdx(Reg, true, false, TRI) != -1;
00763   }
00764 
00765   /// findRegisterUseOperandIdx() - Returns the operand index that is a use of
00766   /// the specific register or -1 if it is not found. It further tightens
00767   /// the search criteria to a use that kills the register if isKill is true.
00768   int findRegisterUseOperandIdx(unsigned Reg, bool isKill = false,
00769                                 const TargetRegisterInfo *TRI = NULL) const;
00770 
00771   /// findRegisterUseOperand - Wrapper for findRegisterUseOperandIdx, it returns
00772   /// a pointer to the MachineOperand rather than an index.
00773   MachineOperand *findRegisterUseOperand(unsigned Reg, bool isKill = false,
00774                                          const TargetRegisterInfo *TRI = NULL) {
00775     int Idx = findRegisterUseOperandIdx(Reg, isKill, TRI);
00776     return (Idx == -1) ? NULL : &getOperand(Idx);
00777   }
00778 
00779   /// findRegisterDefOperandIdx() - Returns the operand index that is a def of
00780   /// the specified register or -1 if it is not found. If isDead is true, defs
00781   /// that are not dead are skipped. If Overlap is true, then it also looks for
00782   /// defs that merely overlap the specified register. If TargetRegisterInfo is
00783   /// non-null, then it also checks if there is a def of a super-register.
00784   /// This may also return a register mask operand when Overlap is true.
00785   int findRegisterDefOperandIdx(unsigned Reg,
00786                                 bool isDead = false, bool Overlap = false,
00787                                 const TargetRegisterInfo *TRI = NULL) const;
00788 
00789   /// findRegisterDefOperand - Wrapper for findRegisterDefOperandIdx, it returns
00790   /// a pointer to the MachineOperand rather than an index.
00791   MachineOperand *findRegisterDefOperand(unsigned Reg, bool isDead = false,
00792                                          const TargetRegisterInfo *TRI = NULL) {
00793     int Idx = findRegisterDefOperandIdx(Reg, isDead, false, TRI);
00794     return (Idx == -1) ? NULL : &getOperand(Idx);
00795   }
00796 
00797   /// findFirstPredOperandIdx() - Find the index of the first operand in the
00798   /// operand list that is used to represent the predicate. It returns -1 if
00799   /// none is found.
00800   int findFirstPredOperandIdx() const;
00801 
00802   /// findInlineAsmFlagIdx() - Find the index of the flag word operand that
00803   /// corresponds to operand OpIdx on an inline asm instruction.  Returns -1 if
00804   /// getOperand(OpIdx) does not belong to an inline asm operand group.
00805   ///
00806   /// If GroupNo is not NULL, it will receive the number of the operand group
00807   /// containing OpIdx.
00808   ///
00809   /// The flag operand is an immediate that can be decoded with methods like
00810   /// InlineAsm::hasRegClassConstraint().
00811   ///
00812   int findInlineAsmFlagIdx(unsigned OpIdx, unsigned *GroupNo = 0) const;
00813 
00814   /// getRegClassConstraint - Compute the static register class constraint for
00815   /// operand OpIdx.  For normal instructions, this is derived from the
00816   /// MCInstrDesc.  For inline assembly it is derived from the flag words.
00817   ///
00818   /// Returns NULL if the static register classs constraint cannot be
00819   /// determined.
00820   ///
00821   const TargetRegisterClass*
00822   getRegClassConstraint(unsigned OpIdx,
00823                         const TargetInstrInfo *TII,
00824                         const TargetRegisterInfo *TRI) const;
00825 
00826   /// tieOperands - Add a tie between the register operands at DefIdx and
00827   /// UseIdx. The tie will cause the register allocator to ensure that the two
00828   /// operands are assigned the same physical register.
00829   ///
00830   /// Tied operands are managed automatically for explicit operands in the
00831   /// MCInstrDesc. This method is for exceptional cases like inline asm.
00832   void tieOperands(unsigned DefIdx, unsigned UseIdx);
00833 
00834   /// findTiedOperandIdx - Given the index of a tied register operand, find the
00835   /// operand it is tied to. Defs are tied to uses and vice versa. Returns the
00836   /// index of the tied operand which must exist.
00837   unsigned findTiedOperandIdx(unsigned OpIdx) const;
00838 
00839   /// isRegTiedToUseOperand - Given the index of a register def operand,
00840   /// check if the register def is tied to a source operand, due to either
00841   /// two-address elimination or inline assembly constraints. Returns the
00842   /// first tied use operand index by reference if UseOpIdx is not null.
00843   bool isRegTiedToUseOperand(unsigned DefOpIdx, unsigned *UseOpIdx = 0) const {
00844     const MachineOperand &MO = getOperand(DefOpIdx);
00845     if (!MO.isReg() || !MO.isDef() || !MO.isTied())
00846       return false;
00847     if (UseOpIdx)
00848       *UseOpIdx = findTiedOperandIdx(DefOpIdx);
00849     return true;
00850   }
00851 
00852   /// isRegTiedToDefOperand - Return true if the use operand of the specified
00853   /// index is tied to an def operand. It also returns the def operand index by
00854   /// reference if DefOpIdx is not null.
00855   bool isRegTiedToDefOperand(unsigned UseOpIdx, unsigned *DefOpIdx = 0) const {
00856     const MachineOperand &MO = getOperand(UseOpIdx);
00857     if (!MO.isReg() || !MO.isUse() || !MO.isTied())
00858       return false;
00859     if (DefOpIdx)
00860       *DefOpIdx = findTiedOperandIdx(UseOpIdx);
00861     return true;
00862   }
00863 
00864   /// clearKillInfo - Clears kill flags on all operands.
00865   ///
00866   void clearKillInfo();
00867 
00868   /// substituteRegister - Replace all occurrences of FromReg with ToReg:SubIdx,
00869   /// properly composing subreg indices where necessary.
00870   void substituteRegister(unsigned FromReg, unsigned ToReg, unsigned SubIdx,
00871                           const TargetRegisterInfo &RegInfo);
00872 
00873   /// addRegisterKilled - We have determined MI kills a register. Look for the
00874   /// operand that uses it and mark it as IsKill. If AddIfNotFound is true,
00875   /// add a implicit operand if it's not found. Returns true if the operand
00876   /// exists / is added.
00877   bool addRegisterKilled(unsigned IncomingReg,
00878                          const TargetRegisterInfo *RegInfo,
00879                          bool AddIfNotFound = false);
00880 
00881   /// clearRegisterKills - Clear all kill flags affecting Reg.  If RegInfo is
00882   /// provided, this includes super-register kills.
00883   void clearRegisterKills(unsigned Reg, const TargetRegisterInfo *RegInfo);
00884 
00885   /// addRegisterDead - We have determined MI defined a register without a use.
00886   /// Look for the operand that defines it and mark it as IsDead. If
00887   /// AddIfNotFound is true, add a implicit operand if it's not found. Returns
00888   /// true if the operand exists / is added.
00889   bool addRegisterDead(unsigned IncomingReg, const TargetRegisterInfo *RegInfo,
00890                        bool AddIfNotFound = false);
00891 
00892   /// addRegisterDefined - We have determined MI defines a register. Make sure
00893   /// there is an operand defining Reg.
00894   void addRegisterDefined(unsigned IncomingReg,
00895                           const TargetRegisterInfo *RegInfo = 0);
00896 
00897   /// setPhysRegsDeadExcept - Mark every physreg used by this instruction as
00898   /// dead except those in the UsedRegs list.
00899   ///
00900   /// On instructions with register mask operands, also add implicit-def
00901   /// operands for all registers in UsedRegs.
00902   void setPhysRegsDeadExcept(ArrayRef<unsigned> UsedRegs,
00903                              const TargetRegisterInfo &TRI);
00904 
00905   /// isSafeToMove - Return true if it is safe to move this instruction. If
00906   /// SawStore is set to true, it means that there is a store (or call) between
00907   /// the instruction's location and its intended destination.
00908   bool isSafeToMove(const TargetInstrInfo *TII, AliasAnalysis *AA,
00909                     bool &SawStore) const;
00910 
00911   /// isSafeToReMat - Return true if it's safe to rematerialize the specified
00912   /// instruction which defined the specified register instead of copying it.
00913   bool isSafeToReMat(const TargetInstrInfo *TII, AliasAnalysis *AA,
00914                      unsigned DstReg) const;
00915 
00916   /// hasOrderedMemoryRef - Return true if this instruction may have an ordered
00917   /// or volatile memory reference, or if the information describing the memory
00918   /// reference is not available. Return false if it is known to have no
00919   /// ordered or volatile memory references.
00920   bool hasOrderedMemoryRef() const;
00921 
00922   /// isInvariantLoad - Return true if this instruction is loading from a
00923   /// location whose value is invariant across the function.  For example,
00924   /// loading a value from the constant pool or from the argument area of
00925   /// a function if it does not change.  This should only return true of *all*
00926   /// loads the instruction does are invariant (if it does multiple loads).
00927   bool isInvariantLoad(AliasAnalysis *AA) const;
00928 
00929   /// isConstantValuePHI - If the specified instruction is a PHI that always
00930   /// merges together the same virtual register, return the register, otherwise
00931   /// return 0.
00932   unsigned isConstantValuePHI() const;
00933 
00934   /// hasUnmodeledSideEffects - Return true if this instruction has side
00935   /// effects that are not modeled by mayLoad / mayStore, etc.
00936   /// For all instructions, the property is encoded in MCInstrDesc::Flags
00937   /// (see MCInstrDesc::hasUnmodeledSideEffects(). The only exception is
00938   /// INLINEASM instruction, in which case the side effect property is encoded
00939   /// in one of its operands (see InlineAsm::Extra_HasSideEffect).
00940   ///
00941   bool hasUnmodeledSideEffects() const;
00942 
00943   /// allDefsAreDead - Return true if all the defs of this instruction are dead.
00944   ///
00945   bool allDefsAreDead() const;
00946 
00947   /// copyImplicitOps - Copy implicit register operands from specified
00948   /// instruction to this instruction.
00949   void copyImplicitOps(MachineFunction &MF, const MachineInstr *MI);
00950 
00951   //
00952   // Debugging support
00953   //
00954   void print(raw_ostream &OS, const TargetMachine *TM = 0,
00955              bool SkipOpers = false) const;
00956   void dump() const;
00957 
00958   //===--------------------------------------------------------------------===//
00959   // Accessors used to build up machine instructions.
00960 
00961   /// Add the specified operand to the instruction.  If it is an implicit
00962   /// operand, it is added to the end of the operand list.  If it is an
00963   /// explicit operand it is added at the end of the explicit operand list
00964   /// (before the first implicit operand).
00965   ///
00966   /// MF must be the machine function that was used to allocate this
00967   /// instruction.
00968   ///
00969   /// MachineInstrBuilder provides a more convenient interface for creating
00970   /// instructions and adding operands.
00971   void addOperand(MachineFunction &MF, const MachineOperand &Op);
00972 
00973   /// Add an operand without providing an MF reference. This only works for
00974   /// instructions that are inserted in a basic block.
00975   ///
00976   /// MachineInstrBuilder and the two-argument addOperand(MF, MO) should be
00977   /// preferred.
00978   void addOperand(const MachineOperand &Op);
00979 
00980   /// setDesc - Replace the instruction descriptor (thus opcode) of
00981   /// the current instruction with a new one.
00982   ///
00983   void setDesc(const MCInstrDesc &tid) { MCID = &tid; }
00984 
00985   /// setDebugLoc - Replace current source information with new such.
00986   /// Avoid using this, the constructor argument is preferable.
00987   ///
00988   void setDebugLoc(const DebugLoc dl) { debugLoc = dl; }
00989 
00990   /// RemoveOperand - Erase an operand  from an instruction, leaving it with one
00991   /// fewer operand than it started with.
00992   ///
00993   void RemoveOperand(unsigned i);
00994 
00995   /// addMemOperand - Add a MachineMemOperand to the machine instruction.
00996   /// This function should be used only occasionally. The setMemRefs function
00997   /// is the primary method for setting up a MachineInstr's MemRefs list.
00998   void addMemOperand(MachineFunction &MF, MachineMemOperand *MO);
00999 
01000   /// setMemRefs - Assign this MachineInstr's memory reference descriptor
01001   /// list. This does not transfer ownership.
01002   void setMemRefs(mmo_iterator NewMemRefs, mmo_iterator NewMemRefsEnd) {
01003     MemRefs = NewMemRefs;
01004     NumMemRefs = uint8_t(NewMemRefsEnd - NewMemRefs);
01005     assert(NumMemRefs == NewMemRefsEnd - NewMemRefs && "Too many memrefs");
01006   }
01007 
01008 private:
01009   /// getRegInfo - If this instruction is embedded into a MachineFunction,
01010   /// return the MachineRegisterInfo object for the current function, otherwise
01011   /// return null.
01012   MachineRegisterInfo *getRegInfo();
01013 
01014   /// untieRegOperand - Break any tie involving OpIdx.
01015   void untieRegOperand(unsigned OpIdx) {
01016     MachineOperand &MO = getOperand(OpIdx);
01017     if (MO.isReg() && MO.isTied()) {
01018       getOperand(findTiedOperandIdx(OpIdx)).TiedTo = 0;
01019       MO.TiedTo = 0;
01020     }
01021   }
01022 
01023   /// addImplicitDefUseOperands - Add all implicit def and use operands to
01024   /// this instruction.
01025   void addImplicitDefUseOperands(MachineFunction &MF);
01026 
01027   /// RemoveRegOperandsFromUseLists - Unlink all of the register operands in
01028   /// this instruction from their respective use lists.  This requires that the
01029   /// operands already be on their use lists.
01030   void RemoveRegOperandsFromUseLists(MachineRegisterInfo&);
01031 
01032   /// AddRegOperandsToUseLists - Add all of the register operands in
01033   /// this instruction from their respective use lists.  This requires that the
01034   /// operands not be on their use lists yet.
01035   void AddRegOperandsToUseLists(MachineRegisterInfo&);
01036 
01037   /// hasPropertyInBundle - Slow path for hasProperty when we're dealing with a
01038   /// bundle.
01039   bool hasPropertyInBundle(unsigned Mask, QueryType Type) const;
01040 };
01041 
01042 /// MachineInstrExpressionTrait - Special DenseMapInfo traits to compare
01043 /// MachineInstr* by *value* of the instruction rather than by pointer value.
01044 /// The hashing and equality testing functions ignore definitions so this is
01045 /// useful for CSE, etc.
01046 struct MachineInstrExpressionTrait : DenseMapInfo<MachineInstr*> {
01047   static inline MachineInstr *getEmptyKey() {
01048     return 0;
01049   }
01050 
01051   static inline MachineInstr *getTombstoneKey() {
01052     return reinterpret_cast<MachineInstr*>(-1);
01053   }
01054 
01055   static unsigned getHashValue(const MachineInstr* const &MI);
01056 
01057   static bool isEqual(const MachineInstr* const &LHS,
01058                       const MachineInstr* const &RHS) {
01059     if (RHS == getEmptyKey() || RHS == getTombstoneKey() ||
01060         LHS == getEmptyKey() || LHS == getTombstoneKey())
01061       return LHS == RHS;
01062     return LHS->isIdenticalTo(RHS, MachineInstr::IgnoreVRegDefs);
01063   }
01064 };
01065 
01066 //===----------------------------------------------------------------------===//
01067 // Debugging Support
01068 
01069 inline raw_ostream& operator<<(raw_ostream &OS, const MachineInstr &MI) {
01070   MI.print(OS);
01071   return OS;
01072 }
01073 
01074 } // End llvm namespace
01075 
01076 #endif