diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-02-01 01:29:47 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-02-01 01:29:47 +0000 |
| commit | 7ed3101d14cff81a445641d27f65e5032af6f2d3 (patch) | |
| tree | 9496460822bf1cb7ddb582aca08dc6c1a540b677 /llvm/lib/Target | |
| parent | 3a5ed551874fc55f29f309e5373ebd4da6bcf284 (diff) | |
| download | bcm5719-llvm-7ed3101d14cff81a445641d27f65e5032af6f2d3.tar.gz bcm5719-llvm-7ed3101d14cff81a445641d27f65e5032af6f2d3.zip | |
Beef up the interface to inline asm constraint parsing, making it more general, useful, and easier to use.
llvm-svn: 25866
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/TargetLowering.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/llvm/lib/Target/TargetLowering.cpp b/llvm/lib/Target/TargetLowering.cpp index edb98f3817f..c861762d16d 100644 --- a/llvm/lib/Target/TargetLowering.cpp +++ b/llvm/lib/Target/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>(); } |

