aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2010-06-28 22:09:45 +0000
committerDale Johannesen <dalej@apple.com>2010-06-28 22:09:45 +0000
commita5989f8e222f6e2ad67704d7e8cc67c86c4d0697 (patch)
tree07d5d7aa1e55a7e310067c111ffcf5e4b144f638 /lib/CodeGen
parentf187ac5a23213f85c3c1f0f80b3592295ee6441d (diff)
downloadexternal_llvm-a5989f8e222f6e2ad67704d7e8cc67c86c4d0697.zip
external_llvm-a5989f8e222f6e2ad67704d7e8cc67c86c4d0697.tar.gz
external_llvm-a5989f8e222f6e2ad67704d7e8cc67c86c4d0697.tar.bz2
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
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/SelectionDAG/TargetLowering.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 8019116..2db55d3 100644
--- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -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) {