Author: void Date: Mon Dec 17 15:53:30 2007 New Revision: 45126 URL: http://llvm.org/viewvc/llvm-project?rev=45126&view=rev Log: Add "hasSideEffects" method to MachineInstrInfo class.
Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=45126&r1=45125&r2=45126&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Mon Dec 17 15:53:30 2007 @@ -314,6 +314,15 @@ isReallyTriviallyReMaterializable(MI); } + /// hasSideEffects - Returns true if the instruction has side effects that are + /// not captured by any operands of the instruction or other flags. + bool hasSideEffects(MachineInstr *MI) const { + const TargetInstrDescriptor *TID = MI->getInstrDescriptor(); + if (!(TID->Flags & M_NEVER_HAS_SIDE_EFFECTS || + TID->Flags & M_MAY_HAVE_SIDE_EFFECTS)) return true; + if (TID->Flags & M_NEVER_HAS_SIDE_EFFECTS) return false; + return !isReallySideEffectFree(MI); // May have side effects + } protected: /// isReallyTriviallyReMaterializable - For instructions with opcodes for /// which the M_REMATERIALIZABLE flag is set, this function tests whether the @@ -329,7 +338,7 @@ /// isReallySideEffectFree - If the M_MAY_HAVE_SIDE_EFFECTS flag is set, this /// method is called to determine if the specific instance of this - /// instructions has side effects. This is useful in cases of instructions, + /// instruction has side effects. This is useful in cases of instructions, /// like loads, which generally always have side effects. A load from a /// constant pool doesn't have side effects, though. So we need to /// differentiate it from the general case. _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits