[llvm-commits] [llvm] r167050 - in /llvm/trunk: include/llvm/CodeGen/MachineInstr.h lib/CodeGen/SelectionDAG/InstrEmitter.cpp

Chad Rosier mcrosier at apple.com
Tue Oct 30 13:39:19 PDT 2012


Author: mcrosier
Date: Tue Oct 30 15:39:19 2012
New Revision: 167050

URL: http://llvm.org/viewvc/llvm-project?rev=167050&view=rev
Log:
[inline asm] Get the mayLoad/mayStore directly from the MIOp_ExtraInfo operand.

Modified:
    llvm/trunk/include/llvm/CodeGen/MachineInstr.h
    llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp

Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=167050&r1=167049&r2=167050&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Tue Oct 30 15:39:19 2012
@@ -58,10 +58,8 @@
     NoFlags      = 0,
     FrameSetup   = 1 << 0,              // Instruction is used as a part of
                                         // function frame setup code.
-    InsideBundle = 1 << 1,              // Instruction is inside a bundle (not
+    InsideBundle = 1 << 1               // Instruction is inside a bundle (not
                                         // the first MI in a bundle)
-    MayLoad      = 1 << 2,              // Instruction could possibly read memory.
-    MayStore     = 1 << 3               // Instruction could possibly modify memory.
   };
 private:
   const MCInstrDesc *MCID;              // Instruction descriptor.
@@ -447,7 +445,12 @@
   /// Instructions with this flag set are not necessarily simple load
   /// instructions, they may load a value and modify it, for example.
   bool mayLoad(QueryType Type = AnyInBundle) const {
-    return hasProperty(MCID::MayLoad, Type) || (Flags & MayLoad);
+    if (isInlineAsm()) {
+      unsigned ExtraInfo = getOperand(InlineAsm::MIOp_ExtraInfo).getImm();
+      if (ExtraInfo & InlineAsm::Extra_MayLoad)
+        return true;
+    }
+    return hasProperty(MCID::MayLoad, Type);
   }
 
 
@@ -456,7 +459,12 @@
   /// instructions, they may store a modified value based on their operands, or
   /// may not actually modify anything, for example.
   bool mayStore(QueryType Type = AnyInBundle) const {
-    return hasProperty(MCID::MayStore, Type) || (Flags & MayStore);
+    if (isInlineAsm()) {
+      unsigned ExtraInfo = getOperand(InlineAsm::MIOp_ExtraInfo).getImm();
+      if (ExtraInfo & InlineAsm::Extra_MayStore)
+        return true;
+    }
+    return hasProperty(MCID::MayStore, Type);
   }
 
   //===--------------------------------------------------------------------===//

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp?rev=167050&r1=167049&r2=167050&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp Tue Oct 30 15:39:19 2012
@@ -897,19 +897,13 @@
     const char *AsmStr = cast<ExternalSymbolSDNode>(AsmStrV)->getSymbol();
     MI->addOperand(MachineOperand::CreateES(AsmStr));
 
-    // Add the HasSideEffect and isAlignStack bits.
+    // Add the HasSideEffect, isAlignStack, AsmDialect, MayLoad and MayStore
+    // bits.
     int64_t ExtraInfo =
       cast<ConstantSDNode>(Node->getOperand(InlineAsm::Op_ExtraInfo))->
                           getZExtValue();
     MI->addOperand(MachineOperand::CreateImm(ExtraInfo));
 
-    // Set the MayLoad and MayStore flags.
-    if (ExtraInfo & InlineAsm::Extra_MayLoad)
-      MI->setFlag(MachineInstr::MayLoad);
-
-    if (ExtraInfo & InlineAsm::Extra_MayStore)
-      MI->setFlag(MachineInstr::MayStore);
-
     // Remember to operand index of the group flags.
     SmallVector<unsigned, 8> GroupIdx;
 





More information about the llvm-commits mailing list