diff options
author | Chris Lattner <sabre@nondot.org> | 2008-10-17 16:21:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-10-17 16:21:11 +0000 |
commit | 58f15c482a7129c78ca809792b46befa20ea337d (patch) | |
tree | 309dadc5cff02d4f392b98672ebd99dc512a3a5d /lib/CodeGen/SelectionDAG/TargetLowering.cpp | |
parent | 86af90d802896eff1cd9e9b85a26990c184e0b7c (diff) |
add an assert so that PR2356 explodes instead of running off an
array. Improve some minor comments, refactor some helpers in
AsmOperandInfo. No functionality change for valid code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57686 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/TargetLowering.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 4e4fd2b7d3..664e06d2d2 100644 --- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -1962,6 +1962,21 @@ getRegForInlineAsmConstraint(const std::string &Constraint, //===----------------------------------------------------------------------===// // Constraint Selection. +/// isMatchingConstraint - Return true of this is an input operand that is a +/// matching constraint like "4". +bool TargetLowering::AsmOperandInfo::isMatchingConstraint() const { + assert(!ConstraintCode.empty() && "No known constraint!"); + return isdigit(ConstraintCode[0]); +} + +/// getMatchedOperand - If this is an input matching constraint, this method +/// returns the output operand it matches. +unsigned TargetLowering::AsmOperandInfo::getMatchedOperand() const { + assert(!ConstraintCode.empty() && "No known constraint!"); + return atoi(ConstraintCode.c_str()); +} + + /// getConstraintGenerality - Return an integer indicating how general CT /// is. static unsigned getConstraintGenerality(TargetLowering::ConstraintType CT) { |