| 683 | } |
| 684 | |
| 685 | void X86CPU::GetClobbersForMnemonic(const StringImpl& mnemonic, int argCount, Array<int>& outImplicitClobberRegNums, int& outClobberArgCount, bool& outMayClobberMem) |
| 686 | { |
| 687 | outImplicitClobberRegNums.Clear(); |
| 688 | outClobberArgCount = 0; |
| 689 | outMayClobberMem = false; |
| 690 | |
| 691 | Array<int> opcodes; |
| 692 | if (!GetOpcodesForMnemonic(mnemonic, opcodes)) |
| 693 | return; |
| 694 | |
| 695 | HashSet<int> impRegs; |
| 696 | for (int op : opcodes) |
| 697 | { |
| 698 | const MCInstrDesc& desc = mInstrInfo->get(op); |
| 699 | //if ((desc.getNumOperands() != argCount) && !desc.isVariadic()) |
| 700 | //continue; // not an operand form that we care about |
| 701 | |
| 702 | outClobberArgCount = std::max(outClobberArgCount, (int)desc.getNumDefs()); |
| 703 | if (!outMayClobberMem && desc.mayStore()) |
| 704 | outMayClobberMem = true; |
| 705 | |
| 706 | int numImplicits = (int)desc.implicit_defs().size(); |
| 707 | auto impPtr = desc.implicit_defs(); |
| 708 | for (int iImp=0; iImp<numImplicits; ++iImp) |
| 709 | impRegs.Add(impPtr[iImp]); |
| 710 | } |
| 711 | |
| 712 | for (auto const& r : impRegs) |
| 713 | { |
| 714 | int regNum = ConvertRegNum(MCOperand::createReg(r)); |
| 715 | if (regNum != -1) |
| 716 | outImplicitClobberRegNums.push_back(regNum); |
| 717 | } |
| 718 | } |
| 719 | |
| 720 | bool X86CPU::ParseInlineAsmInstructionLLVM(const StringImpl&asmInst, String& outError) |
| 721 | { |