Index: llvm/include/llvm/CodeGen/TargetInstrInfo.h =================================================================== --- llvm/include/llvm/CodeGen/TargetInstrInfo.h +++ llvm/include/llvm/CodeGen/TargetInstrInfo.h @@ -1505,6 +1505,9 @@ const char *Str, const MCAsmInfo &MAI, const TargetSubtargetInfo *STI = nullptr) const; + /// Return the target inline asm constraint name + virtual StringRef getInlineAsmMemConstraintName(unsigned Constraint) const; + /// Allocate and return a hazard recognizer to use for this target when /// scheduling the machine instructions before register allocation. virtual ScheduleHazardRecognizer * Index: llvm/include/llvm/IR/InlineAsm.h =================================================================== --- llvm/include/llvm/IR/InlineAsm.h +++ llvm/include/llvm/IR/InlineAsm.h @@ -315,7 +315,6 @@ static unsigned getFlagWordForMem(unsigned InputFlag, unsigned Constraint) { assert(isMemKind(InputFlag) && "InputFlag is not a memory constraint!"); assert(Constraint <= 0x7fff && "Too large a memory constraint ID"); - assert(Constraint <= Constraints_Max && "Unknown constraint ID"); assert((InputFlag & ~0xffff) == 0 && "High bits already contain data"); return InputFlag | (Constraint << Constraints_ShiftAmount); } Index: llvm/lib/CodeGen/MachineInstr.cpp =================================================================== --- llvm/lib/CodeGen/MachineInstr.cpp +++ llvm/lib/CodeGen/MachineInstr.cpp @@ -1757,7 +1757,10 @@ if (InlineAsm::isMemKind(Flag)) { unsigned MCID = InlineAsm::getMemoryConstraintID(Flag); - OS << ":" << InlineAsm::getMemConstraintName(MCID); + if (TII) + OS << ":" << TII -> getInlineAsmMemConstraintName(MCID); + else + OS << ":CONSTRAINT" << MCID; } unsigned TiedTo = 0; Index: llvm/lib/CodeGen/TargetInstrInfo.cpp =================================================================== --- llvm/lib/CodeGen/TargetInstrInfo.cpp +++ llvm/lib/CodeGen/TargetInstrInfo.cpp @@ -135,6 +135,12 @@ return Length; } +/// Return the target constraint name +StringRef +TargetInstrInfo::getInlineAsmMemConstraintName(unsigned Constraint) const { + return InlineAsm::getMemConstraintName(Constraint); +} + /// ReplaceTailWithBranchTo - Delete the instruction OldInst and everything /// after it, replacing it with an unconditional branch to NewDest. void @@ -1389,7 +1395,7 @@ if (InlineAsm::isMemKind(Flag)) { unsigned MCID = InlineAsm::getMemoryConstraintID(Flag); - OS << ":" << InlineAsm::getMemConstraintName(MCID); + OS << ":" << getInlineAsmMemConstraintName(MCID); } unsigned TiedTo = 0;