mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-11 00:39:36 +00:00
Check register class matching instead of width of type matching
when determining validity of matching constraint. Allow i1 types access to the GR8 reg class for x86. Fixes PR10352 and rdar://9777108 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135180 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c83d504085
commit
5427edeb68
@ -5706,10 +5706,13 @@ void SelectionDAGBuilder::visitInlineAsm(ImmutableCallSite CS) {
|
||||
SDISelAsmOperandInfo &Input = ConstraintOperands[OpInfo.MatchingInput];
|
||||
|
||||
if (OpInfo.ConstraintVT != Input.ConstraintVT) {
|
||||
std::pair<unsigned, const TargetRegisterClass*> MatchRC =
|
||||
TLI.getRegForInlineAsmConstraint(OpInfo.ConstraintCode, OpInfo.ConstraintVT);
|
||||
std::pair<unsigned, const TargetRegisterClass*> InputRC =
|
||||
TLI.getRegForInlineAsmConstraint(Input.ConstraintCode, Input.ConstraintVT);
|
||||
if ((OpInfo.ConstraintVT.isInteger() !=
|
||||
Input.ConstraintVT.isInteger()) ||
|
||||
(OpInfo.ConstraintVT.getSizeInBits() !=
|
||||
Input.ConstraintVT.getSizeInBits())) {
|
||||
(MatchRC.second != InputRC.second)) {
|
||||
report_fatal_error("Unsupported asm: input constraint"
|
||||
" with a matching output constraint of"
|
||||
" incompatible type!");
|
||||
@ -5972,8 +5975,7 @@ void SelectionDAGBuilder::visitInlineAsm(ImmutableCallSite CS) {
|
||||
"Don't know how to handle indirect register inputs yet!");
|
||||
|
||||
// Copy the input into the appropriate registers.
|
||||
if (OpInfo.AssignedRegs.Regs.empty() ||
|
||||
!OpInfo.AssignedRegs.areValueTypesLegal(TLI))
|
||||
if (OpInfo.AssignedRegs.Regs.empty())
|
||||
report_fatal_error("Couldn't allocate input reg for constraint '" +
|
||||
Twine(OpInfo.ConstraintCode) + "'!");
|
||||
|
||||
|
@ -2966,10 +2966,13 @@ TargetLowering::AsmOperandInfoVector TargetLowering::ParseConstraints(
|
||||
AsmOperandInfo &Input = ConstraintOperands[OpInfo.MatchingInput];
|
||||
|
||||
if (OpInfo.ConstraintVT != Input.ConstraintVT) {
|
||||
std::pair<unsigned, const TargetRegisterClass*> MatchRC =
|
||||
getRegForInlineAsmConstraint(OpInfo.ConstraintCode, OpInfo.ConstraintVT);
|
||||
std::pair<unsigned, const TargetRegisterClass*> InputRC =
|
||||
getRegForInlineAsmConstraint(Input.ConstraintCode, Input.ConstraintVT);
|
||||
if ((OpInfo.ConstraintVT.isInteger() !=
|
||||
Input.ConstraintVT.isInteger()) ||
|
||||
(OpInfo.ConstraintVT.getSizeInBits() !=
|
||||
Input.ConstraintVT.getSizeInBits())) {
|
||||
(MatchRC.second != InputRC.second)) {
|
||||
report_fatal_error("Unsupported asm: input constraint"
|
||||
" with a matching output constraint of"
|
||||
" incompatible type!");
|
||||
|
@ -12971,7 +12971,7 @@ X86TargetLowering::getRegForInlineAsmConstraint(const std::string &Constraint,
|
||||
return std::make_pair(0U, X86::GR32RegisterClass);
|
||||
else if (VT == MVT::i16)
|
||||
return std::make_pair(0U, X86::GR16RegisterClass);
|
||||
else if (VT == MVT::i8)
|
||||
else if (VT == MVT::i8 || VT == MVT::i1)
|
||||
return std::make_pair(0U, X86::GR8RegisterClass);
|
||||
else if (VT == MVT::i64 || VT == MVT::f64)
|
||||
return std::make_pair(0U, X86::GR64RegisterClass);
|
||||
@ -12983,14 +12983,14 @@ X86TargetLowering::getRegForInlineAsmConstraint(const std::string &Constraint,
|
||||
return std::make_pair(0U, X86::GR32_ABCDRegisterClass);
|
||||
else if (VT == MVT::i16)
|
||||
return std::make_pair(0U, X86::GR16_ABCDRegisterClass);
|
||||
else if (VT == MVT::i8)
|
||||
else if (VT == MVT::i8 || VT == MVT::i1)
|
||||
return std::make_pair(0U, X86::GR8_ABCD_LRegisterClass);
|
||||
else if (VT == MVT::i64)
|
||||
return std::make_pair(0U, X86::GR64_ABCDRegisterClass);
|
||||
break;
|
||||
case 'r': // GENERAL_REGS
|
||||
case 'l': // INDEX_REGS
|
||||
if (VT == MVT::i8)
|
||||
if (VT == MVT::i8 || VT == MVT::i1)
|
||||
return std::make_pair(0U, X86::GR8RegisterClass);
|
||||
if (VT == MVT::i16)
|
||||
return std::make_pair(0U, X86::GR16RegisterClass);
|
||||
@ -12998,7 +12998,7 @@ X86TargetLowering::getRegForInlineAsmConstraint(const std::string &Constraint,
|
||||
return std::make_pair(0U, X86::GR32RegisterClass);
|
||||
return std::make_pair(0U, X86::GR64RegisterClass);
|
||||
case 'R': // LEGACY_REGS
|
||||
if (VT == MVT::i8)
|
||||
if (VT == MVT::i8 || VT == MVT::i1)
|
||||
return std::make_pair(0U, X86::GR8_NOREXRegisterClass);
|
||||
if (VT == MVT::i16)
|
||||
return std::make_pair(0U, X86::GR16_NOREXRegisterClass);
|
||||
|
@ -30,3 +30,16 @@ entry:
|
||||
%0 = tail call i32 asm "test", "=l,~{dirflag},~{fpsr},~{flags}"() nounwind
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
; rdar://9777108 PR10352
|
||||
define void @test6(i1 zeroext %desired) nounwind {
|
||||
entry:
|
||||
tail call void asm sideeffect "foo $0", "q,~{dirflag},~{fpsr},~{flags}"(i1 %desired) nounwind
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @test7(i1 zeroext %desired, i32* %p) nounwind {
|
||||
entry:
|
||||
%0 = tail call i8 asm sideeffect "xchg $0, $1", "=r,*m,0,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* %p, i1 %desired) nounwind
|
||||
ret void
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user