mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-27 04:18:42 +00:00
avoid needless throw/catch/rethrow, stringref'ize some simple stuff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117892 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
1 parent
f780811456
commit
79b3cddfa2
3 files changed
+7
-10
No files matched your search
@@ -945,7 +945,7 @@ void AsmMatcherInfo::BuildInfo() {
|
|||||||
|
|
||||||
Instructions.push_back(II.take());
|
Instructions.push_back(II.take());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build info for the register classes.
|
// Build info for the register classes.
|
||||||
BuildRegisterClasses(SingletonRegisters);
|
BuildRegisterClasses(SingletonRegisters);
|
||||||
|
|
||||||
@@ -998,12 +998,9 @@ void AsmMatcherInfo::BuildInfo() {
|
|||||||
|
|
||||||
// Map this token to an operand. FIXME: Move elsewhere.
|
// Map this token to an operand. FIXME: Move elsewhere.
|
||||||
unsigned Idx;
|
unsigned Idx;
|
||||||
try {
|
if (!II->Instr->hasOperandNamed(OperandName, Idx))
|
||||||
Idx = II->Instr->getOperandNamed(OperandName);
|
|
||||||
} catch(...) {
|
|
||||||
throw std::string("error: unable to find operand: '" +
|
throw std::string("error: unable to find operand: '" +
|
||||||
OperandName.str() + "'");
|
OperandName.str() + "'");
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: This is annoying, the named operand may be tied (e.g.,
|
// 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
|
// 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
|
/// non-empty name. If the instruction does not have an operand with the
|
||||||
/// specified name, throw an exception.
|
/// specified name, throw an exception.
|
||||||
///
|
///
|
||||||
unsigned CodeGenInstruction::getOperandNamed(const std::string &Name) const {
|
unsigned CodeGenInstruction::getOperandNamed(StringRef Name) const {
|
||||||
unsigned OpIdx;
|
unsigned OpIdx;
|
||||||
if (hasOperandNamed(Name, OpIdx)) return OpIdx;
|
if (hasOperandNamed(Name, OpIdx)) return OpIdx;
|
||||||
throw "Instruction '" + TheDef->getName() +
|
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
|
/// hasOperandNamed - Query whether the instruction has an operand of the
|
||||||
/// given name. If so, return true and set OpIdx to the index of the
|
/// given name. If so, return true and set OpIdx to the index of the
|
||||||
/// operand. Otherwise, return false.
|
/// operand. Otherwise, return false.
|
||||||
bool CodeGenInstruction::hasOperandNamed(const std::string &Name,
|
bool CodeGenInstruction::hasOperandNamed(StringRef Name,
|
||||||
unsigned &OpIdx) const {
|
unsigned &OpIdx) const {
|
||||||
assert(!Name.empty() && "Cannot search for operand with no name!");
|
assert(!Name.empty() && "Cannot search for operand with no name!");
|
||||||
for (unsigned i = 0, e = OperandList.size(); i != e; ++i)
|
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
|
/// getOperandNamed - Return the index of the operand with the specified
|
||||||
/// non-empty name. If the instruction does not have an operand with the
|
/// non-empty name. If the instruction does not have an operand with the
|
||||||
/// specified name, throw an exception.
|
/// 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
|
/// hasOperandNamed - Query whether the instruction has an operand of the
|
||||||
/// given name. If so, return true and set OpIdx to the index of the
|
/// given name. If so, return true and set OpIdx to the index of the
|
||||||
/// operand. Otherwise, return false.
|
/// 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
|
/// HasOneImplicitDefWithKnownVT - If the instruction has at least one
|
||||||
/// implicit def and it has a known VT, return the VT, otherwise return
|
/// implicit def and it has a known VT, return the VT, otherwise return
|
||||||
|
|||||||
Reference in new issue
Block a user