switch TargetLowering::getConstraintType to take the entire constraint,

not just the first letter.  No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35322 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2007-03-25 02:14:49 +00:00
parent 2b81207b4b
commit 4234f57fa0
11 changed files with 82 additions and 68 deletions

View File

@ -806,9 +806,9 @@ public:
C_Unknown // Unsupported constraint. C_Unknown // Unsupported constraint.
}; };
/// getConstraintType - Given a constraint letter, return the type of /// getConstraintType - Given a constraint, return the type of constraint it
/// constraint it is for this target. /// is for this target.
virtual ConstraintType getConstraintType(char ConstraintLetter) const; virtual ConstraintType getConstraintType(const std::string &Constraint) const;
/// getRegClassForInlineAsmConstraint - Given a constraint letter (e.g. "r"), /// getRegClassForInlineAsmConstraint - Given a constraint letter (e.g. "r"),

View File

@ -2633,9 +2633,9 @@ static std::string GetMostGeneralConstraint(std::vector<std::string> &C,
std::string *Current = &C[0]; std::string *Current = &C[0];
// If we have multiple constraints, try to pick the most general one ahead // If we have multiple constraints, try to pick the most general one ahead
// of time. This isn't a wonderful solution, but handles common cases. // of time. This isn't a wonderful solution, but handles common cases.
TargetLowering::ConstraintType Flavor = TLI.getConstraintType(Current[0][0]); TargetLowering::ConstraintType Flavor = TLI.getConstraintType(Current[0]);
for (unsigned j = 1, e = C.size(); j != e; ++j) { for (unsigned j = 1, e = C.size(); j != e; ++j) {
TargetLowering::ConstraintType ThisFlavor = TLI.getConstraintType(C[j][0]); TargetLowering::ConstraintType ThisFlavor = TLI.getConstraintType(C[j]);
if (getConstraintGenerality(ThisFlavor) > if (getConstraintGenerality(ThisFlavor) >
getConstraintGenerality(Flavor)) { getConstraintGenerality(Flavor)) {
// This constraint letter is more general than the previous one, // This constraint letter is more general than the previous one,
@ -2748,7 +2748,7 @@ void SelectionDAGLowering::visitInlineAsm(CallInst &I) {
case InlineAsm::isOutput: { case InlineAsm::isOutput: {
TargetLowering::ConstraintType CTy = TargetLowering::C_RegisterClass; TargetLowering::ConstraintType CTy = TargetLowering::C_RegisterClass;
if (ConstraintCode.size() == 1) // not a physreg name. if (ConstraintCode.size() == 1) // not a physreg name.
CTy = TLI.getConstraintType(ConstraintCode[0]); CTy = TLI.getConstraintType(ConstraintCode);
if (CTy == TargetLowering::C_Memory) { if (CTy == TargetLowering::C_Memory) {
// Memory output. // Memory output.
@ -2863,7 +2863,7 @@ void SelectionDAGLowering::visitInlineAsm(CallInst &I) {
TargetLowering::ConstraintType CTy = TargetLowering::C_RegisterClass; TargetLowering::ConstraintType CTy = TargetLowering::C_RegisterClass;
if (ConstraintCode.size() == 1) // not a physreg name. if (ConstraintCode.size() == 1) // not a physreg name.
CTy = TLI.getConstraintType(ConstraintCode[0]); CTy = TLI.getConstraintType(ConstraintCode);
if (CTy == TargetLowering::C_Other) { if (CTy == TargetLowering::C_Other) {
InOperandVal = TLI.isOperandValidForConstraint(InOperandVal, InOperandVal = TLI.isOperandValidForConstraint(InOperandVal,

View File

@ -1828,10 +1828,11 @@ PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const {
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
TargetLowering::ConstraintType TargetLowering::ConstraintType
TargetLowering::getConstraintType(char ConstraintLetter) const { TargetLowering::getConstraintType(const std::string &Constraint) const {
// FIXME: lots more standard ones to handle. // FIXME: lots more standard ones to handle.
switch (ConstraintLetter) { if (Constraint.size() == 1) {
default: return C_Unknown; switch (Constraint[0]) {
default: break;
case 'r': return C_RegisterClass; case 'r': return C_RegisterClass;
case 'm': // memory case 'm': // memory
case 'o': // offsetable case 'o': // offsetable
@ -1851,6 +1852,9 @@ TargetLowering::getConstraintType(char ConstraintLetter) const {
return C_Other; return C_Other;
} }
} }
// TODO: Handle registers.
return C_Unknown;
}
/// isOperandValidForConstraint - Return the specified operand (possibly /// isOperandValidForConstraint - Return the specified operand (possibly
/// modified) if the specified SDOperand is valid for the specified target /// modified) if the specified SDOperand is valid for the specified target

View File

@ -1550,13 +1550,15 @@ void ARMTargetLowering::computeMaskedBitsForTargetNode(const SDOperand Op,
/// getConstraintType - Given a constraint letter, return the type of /// getConstraintType - Given a constraint letter, return the type of
/// constraint it is for this target. /// constraint it is for this target.
ARMTargetLowering::ConstraintType ARMTargetLowering::ConstraintType
ARMTargetLowering::getConstraintType(char ConstraintLetter) const { ARMTargetLowering::getConstraintType(const std::string &Constraint) const {
switch (ConstraintLetter) { if (Constraint.size() == 1) {
case 'l': switch (Constraint[0]) {
return C_RegisterClass; default: break;
default: return TargetLowering::getConstraintType(ConstraintLetter); case 'l': return C_RegisterClass;
} }
} }
return TargetLowering::getConstraintType(Constraint);
}
std::pair<unsigned, const TargetRegisterClass*> std::pair<unsigned, const TargetRegisterClass*>
ARMTargetLowering::getRegForInlineAsmConstraint(const std::string &Constraint, ARMTargetLowering::getRegForInlineAsmConstraint(const std::string &Constraint,

View File

@ -133,7 +133,7 @@ namespace llvm {
uint64_t &KnownZero, uint64_t &KnownZero,
uint64_t &KnownOne, uint64_t &KnownOne,
unsigned Depth) const; unsigned Depth) const;
ConstraintType getConstraintType(char ConstraintLetter) const; ConstraintType getConstraintType(const std::string &Constraint) const;
std::pair<unsigned, const TargetRegisterClass*> std::pair<unsigned, const TargetRegisterClass*>
getRegForInlineAsmConstraint(const std::string &Constraint, getRegForInlineAsmConstraint(const std::string &Constraint,
MVT::ValueType VT) const; MVT::ValueType VT) const;

View File

@ -571,14 +571,16 @@ SDOperand AlphaTargetLowering::CustomPromoteOperation(SDOperand Op,
/// getConstraintType - Given a constraint letter, return the type of /// getConstraintType - Given a constraint letter, return the type of
/// constraint it is for this target. /// constraint it is for this target.
AlphaTargetLowering::ConstraintType AlphaTargetLowering::ConstraintType
AlphaTargetLowering::getConstraintType(char ConstraintLetter) const { AlphaTargetLowering::getConstraintType(const std::string &Constraint) const {
switch (ConstraintLetter) { if (Constraint.size() == 1) {
switch (Constraint[0]) {
default: break; default: break;
case 'f': case 'f':
case 'r': case 'r':
return C_RegisterClass; return C_RegisterClass;
} }
return TargetLowering::getConstraintType(ConstraintLetter); }
return TargetLowering::getConstraintType(Constraint);
} }
std::vector<unsigned> AlphaTargetLowering:: std::vector<unsigned> AlphaTargetLowering::

View File

@ -81,7 +81,7 @@ namespace llvm {
bool isVarArg, unsigned CC, bool isTailCall, SDOperand Callee, bool isVarArg, unsigned CC, bool isTailCall, SDOperand Callee,
ArgListTy &Args, SelectionDAG &DAG); ArgListTy &Args, SelectionDAG &DAG);
ConstraintType getConstraintType(char ConstraintLetter) const; ConstraintType getConstraintType(const std::string &Constraint) const;
std::vector<unsigned> std::vector<unsigned>
getRegClassForInlineAsmConstraint(const std::string &Constraint, getRegClassForInlineAsmConstraint(const std::string &Constraint,

View File

@ -3105,11 +3105,12 @@ void PPCTargetLowering::computeMaskedBitsForTargetNode(const SDOperand Op,
} }
/// getConstraintType - Given a constraint letter, return the type of /// getConstraintType - Given a constraint, return the type of
/// constraint it is for this target. /// constraint it is for this target.
PPCTargetLowering::ConstraintType PPCTargetLowering::ConstraintType
PPCTargetLowering::getConstraintType(char ConstraintLetter) const { PPCTargetLowering::getConstraintType(const std::string &Constraint) const {
switch (ConstraintLetter) { if (Constraint.size() == 1) {
switch (Constraint[0]) {
default: break; default: break;
case 'b': case 'b':
case 'r': case 'r':
@ -3118,7 +3119,8 @@ PPCTargetLowering::getConstraintType(char ConstraintLetter) const {
case 'y': case 'y':
return C_RegisterClass; return C_RegisterClass;
} }
return TargetLowering::getConstraintType(ConstraintLetter); }
return TargetLowering::getConstraintType(Constraint);
} }
std::pair<unsigned, const TargetRegisterClass*> std::pair<unsigned, const TargetRegisterClass*>

View File

@ -229,7 +229,7 @@ namespace llvm {
virtual MachineBasicBlock *InsertAtEndOfBasicBlock(MachineInstr *MI, virtual MachineBasicBlock *InsertAtEndOfBasicBlock(MachineInstr *MI,
MachineBasicBlock *MBB); MachineBasicBlock *MBB);
ConstraintType getConstraintType(char ConstraintLetter) const; ConstraintType getConstraintType(const std::string &Constraint) const;
std::pair<unsigned, const TargetRegisterClass*> std::pair<unsigned, const TargetRegisterClass*>
getRegForInlineAsmConstraint(const std::string &Constraint, getRegForInlineAsmConstraint(const std::string &Constraint,
MVT::ValueType VT) const; MVT::ValueType VT) const;

View File

@ -4521,8 +4521,9 @@ SDOperand X86TargetLowering::PerformDAGCombine(SDNode *N,
/// getConstraintType - Given a constraint letter, return the type of /// getConstraintType - Given a constraint letter, return the type of
/// constraint it is for this target. /// constraint it is for this target.
X86TargetLowering::ConstraintType X86TargetLowering::ConstraintType
X86TargetLowering::getConstraintType(char ConstraintLetter) const { X86TargetLowering::getConstraintType(const std::string &Constraint) const {
switch (ConstraintLetter) { if (Constraint.size() == 1) {
switch (Constraint[0]) {
case 'A': case 'A':
case 'r': case 'r':
case 'R': case 'R':
@ -4532,9 +4533,12 @@ X86TargetLowering::getConstraintType(char ConstraintLetter) const {
case 'x': case 'x':
case 'Y': case 'Y':
return C_RegisterClass; return C_RegisterClass;
default: return TargetLowering::getConstraintType(ConstraintLetter); default:
break;
} }
} }
return TargetLowering::getConstraintType(Constraint);
}
/// isOperandValidForConstraint - Return the specified operand (possibly /// isOperandValidForConstraint - Return the specified operand (possibly
/// modified) if the specified SDOperand is valid for the specified target /// modified) if the specified SDOperand is valid for the specified target

View File

@ -316,7 +316,7 @@ namespace llvm {
SDOperand getReturnAddressFrameIndex(SelectionDAG &DAG); SDOperand getReturnAddressFrameIndex(SelectionDAG &DAG);
ConstraintType getConstraintType(char ConstraintLetter) const; ConstraintType getConstraintType(const std::string &Constraint) const;
std::vector<unsigned> std::vector<unsigned>
getRegClassForInlineAsmConstraint(const std::string &Constraint, getRegClassForInlineAsmConstraint(const std::string &Constraint,