llvm.org GIT mirror llvm / daeec8f
[inline asm] Get the mayLoad/mayStore directly from the MIOp_ExtraInfo operand. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167050 91177308-0d34-0410-b5e6-96231b3b80d8 Chad Rosier 7 years ago
2 changed file(s) with 15 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
5757 NoFlags = 0,
5858 FrameSetup = 1 << 0, // Instruction is used as a part of
5959 // function frame setup code.
60 InsideBundle = 1 << 1, // Instruction is inside a bundle (not
60 InsideBundle = 1 << 1 // Instruction is inside a bundle (not
6161 // the first MI in a bundle)
62 MayLoad = 1 << 2, // Instruction could possibly read memory.
63 MayStore = 1 << 3 // Instruction could possibly modify memory.
6462 };
6563 private:
6664 const MCInstrDesc *MCID; // Instruction descriptor.
446444 /// Instructions with this flag set are not necessarily simple load
447445 /// instructions, they may load a value and modify it, for example.
448446 bool mayLoad(QueryType Type = AnyInBundle) const {
449 return hasProperty(MCID::MayLoad, Type) || (Flags & MayLoad);
447 if (isInlineAsm()) {
448 unsigned ExtraInfo = getOperand(InlineAsm::MIOp_ExtraInfo).getImm();
449 if (ExtraInfo & InlineAsm::Extra_MayLoad)
450 return true;
451 }
452 return hasProperty(MCID::MayLoad, Type);
450453 }
451454
452455
455458 /// instructions, they may store a modified value based on their operands, or
456459 /// may not actually modify anything, for example.
457460 bool mayStore(QueryType Type = AnyInBundle) const {
458 return hasProperty(MCID::MayStore, Type) || (Flags & MayStore);
461 if (isInlineAsm()) {
462 unsigned ExtraInfo = getOperand(InlineAsm::MIOp_ExtraInfo).getImm();
463 if (ExtraInfo & InlineAsm::Extra_MayStore)
464 return true;
465 }
466 return hasProperty(MCID::MayStore, Type);
459467 }
460468
461469 //===--------------------------------------------------------------------===//
896896 const char *AsmStr = cast(AsmStrV)->getSymbol();
897897 MI->addOperand(MachineOperand::CreateES(AsmStr));
898898
899 // Add the HasSideEffect and isAlignStack bits.
899 // Add the HasSideEffect, isAlignStack, AsmDialect, MayLoad and MayStore
900 // bits.
900901 int64_t ExtraInfo =
901902 cast(Node->getOperand(InlineAsm::Op_ExtraInfo))->
902903 getZExtValue();
903904 MI->addOperand(MachineOperand::CreateImm(ExtraInfo));
904
905 // Set the MayLoad and MayStore flags.
906 if (ExtraInfo & InlineAsm::Extra_MayLoad)
907 MI->setFlag(MachineInstr::MayLoad);
908
909 if (ExtraInfo & InlineAsm::Extra_MayStore)
910 MI->setFlag(MachineInstr::MayStore);
911905
912906 // Remember to operand index of the group flags.
913907 SmallVector GroupIdx;