mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
In asm's, output operands with matching input constraints
have to be registers, per gcc documentation. This affects the logic for determining what "g" should lower to. PR 7393. A couple of existing testcases are affected. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107079 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2547,12 +2547,12 @@ static void ChooseConstraint(TargetLowering::AsmOperandInfo &OpInfo,
|
||||
unsigned BestIdx = 0;
|
||||
TargetLowering::ConstraintType BestType = TargetLowering::C_Unknown;
|
||||
int BestGenerality = -1;
|
||||
|
||||
|
||||
// Loop over the options, keeping track of the most general one.
|
||||
for (unsigned i = 0, e = OpInfo.Codes.size(); i != e; ++i) {
|
||||
TargetLowering::ConstraintType CType =
|
||||
TLI.getConstraintType(OpInfo.Codes[i]);
|
||||
|
||||
|
||||
// If this is an 'other' constraint, see if the operand is valid for it.
|
||||
// For example, on X86 we might have an 'rI' constraint. If the operand
|
||||
// is an integer in the range [0..31] we want to use I (saving a load
|
||||
@@ -2570,6 +2570,11 @@ static void ChooseConstraint(TargetLowering::AsmOperandInfo &OpInfo,
|
||||
}
|
||||
}
|
||||
|
||||
// Things with matching constraints can only be registers, per gcc
|
||||
// documentation. This mainly affects "g" constraints.
|
||||
if (CType == TargetLowering::C_Memory && OpInfo.hasMatchingInput())
|
||||
continue;
|
||||
|
||||
// This constraint letter is more general than the previous one, use it.
|
||||
int Generality = getConstraintGenerality(CType);
|
||||
if (Generality > BestGenerality) {
|
||||
|
Reference in New Issue
Block a user