mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
avoid needless throw/catch/rethrow, stringref'ize some simple stuff.
llvm-svn: 117892
This commit is contained in:
parent
d57d9e862d
commit
88f746114f
@ -945,7 +945,7 @@ void AsmMatcherInfo::BuildInfo() {
|
||||
|
||||
Instructions.push_back(II.take());
|
||||
}
|
||||
|
||||
|
||||
// Build info for the register classes.
|
||||
BuildRegisterClasses(SingletonRegisters);
|
||||
|
||||
@ -998,12 +998,9 @@ void AsmMatcherInfo::BuildInfo() {
|
||||
|
||||
// Map this token to an operand. FIXME: Move elsewhere.
|
||||
unsigned Idx;
|
||||
try {
|
||||
Idx = II->Instr->getOperandNamed(OperandName);
|
||||
} catch(...) {
|
||||
if (!II->Instr->hasOperandNamed(OperandName, Idx))
|
||||
throw std::string("error: unable to find operand: '" +
|
||||
OperandName.str() + "'");
|
||||
}
|
||||
|
||||
// FIXME: This is annoying, the named operand may be tied (e.g.,
|
||||
// XCHG8rm). What we want is the untied operand, which we now have to
|
||||
|
@ -237,17 +237,17 @@ CodeGenInstruction::CodeGenInstruction(Record *R) : TheDef(R) {
|
||||
/// non-empty name. If the instruction does not have an operand with the
|
||||
/// specified name, throw an exception.
|
||||
///
|
||||
unsigned CodeGenInstruction::getOperandNamed(const std::string &Name) const {
|
||||
unsigned CodeGenInstruction::getOperandNamed(StringRef Name) const {
|
||||
unsigned OpIdx;
|
||||
if (hasOperandNamed(Name, OpIdx)) return OpIdx;
|
||||
throw "Instruction '" + TheDef->getName() +
|
||||
"' does not have an operand named '$" + Name + "'!";
|
||||
"' does not have an operand named '$" + Name.str() + "'!";
|
||||
}
|
||||
|
||||
/// hasOperandNamed - Query whether the instruction has an operand of the
|
||||
/// given name. If so, return true and set OpIdx to the index of the
|
||||
/// operand. Otherwise, return false.
|
||||
bool CodeGenInstruction::hasOperandNamed(const std::string &Name,
|
||||
bool CodeGenInstruction::hasOperandNamed(StringRef Name,
|
||||
unsigned &OpIdx) const {
|
||||
assert(!Name.empty() && "Cannot search for operand with no name!");
|
||||
for (unsigned i = 0, e = OperandList.size(); i != e; ++i)
|
||||
|
@ -190,12 +190,12 @@ namespace llvm {
|
||||
/// getOperandNamed - Return the index of the operand with the specified
|
||||
/// non-empty name. If the instruction does not have an operand with the
|
||||
/// specified name, throw an exception.
|
||||
unsigned getOperandNamed(const std::string &Name) const;
|
||||
unsigned getOperandNamed(StringRef Name) const;
|
||||
|
||||
/// hasOperandNamed - Query whether the instruction has an operand of the
|
||||
/// given name. If so, return true and set OpIdx to the index of the
|
||||
/// operand. Otherwise, return false.
|
||||
bool hasOperandNamed(const std::string &Name, unsigned &OpIdx) const;
|
||||
bool hasOperandNamed(StringRef Name, unsigned &OpIdx) const;
|
||||
|
||||
/// HasOneImplicitDefWithKnownVT - If the instruction has at least one
|
||||
/// implicit def and it has a known VT, return the VT, otherwise return
|
||||
|
Loading…
Reference in New Issue
Block a user