aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/TargetLowering.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-02-01 01:29:47 +0000
committerChris Lattner <sabre@nondot.org>2006-02-01 01:29:47 +0000
commita55079a5ccdf0cdb4d482fb47a3fb21825f56713 (patch)
tree9d845c034ab7b07018b6fd72bc18ad73cc7f72ba /lib/CodeGen/SelectionDAG/TargetLowering.cpp
parent2cc2f66c25d9576743026688fdae5ed402726532 (diff)
Beef up the interface to inline asm constraint parsing, making it more general, useful, and easier to use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25866 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/TargetLowering.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index edb98f3817..c861762d16 100644
--- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -243,15 +243,22 @@ bool TargetLowering::isMaskedValueZeroForTargetNode(const SDOperand &Op,
std::vector<unsigned> TargetLowering::
getRegForInlineAsmConstraint(const std::string &Constraint) const {
+ // Not a physreg, must not be a register reference or something.
+ if (Constraint[0] != '{') return std::vector<unsigned>();
+ assert(*(Constraint.end()-1) == '}' && "Not a brace enclosed constraint?");
+
+ // Remove the braces from around the name.
+ std::string RegName(Constraint.begin()+1, Constraint.end()-1);
+
// Scan to see if this constraint is a register name.
const MRegisterInfo *RI = TM.getRegisterInfo();
for (unsigned i = 1, e = RI->getNumRegs(); i != e; ++i) {
if (const char *Name = RI->get(i).Name)
- if (StringsEqualNoCase(Constraint, Name))
+ if (StringsEqualNoCase(RegName, Name))
return std::vector<unsigned>(1, i);
}
-
- // Not a physreg, must not be a register reference or something.
+
+ // Unknown physreg.
return std::vector<unsigned>();
}