summaryrefslogtreecommitdiff
path: root/utils/TableGen/CodeGenInstruction.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-06 06:39:47 +0000
committerChris Lattner <sabre@nondot.org>2010-11-06 06:39:47 +0000
commit225549f775db61c5dba10e14758f4b43c53ef593 (patch)
treea1bbc58de5faf69dc1f2ec4a8dd8b4391fe48993 /utils/TableGen/CodeGenInstruction.cpp
parent2a301704ea76535f0485d5c3b75664b323249bdb (diff)
downloadllvm-225549f775db61c5dba10e14758f4b43c53ef593.tar.gz
llvm-225549f775db61c5dba10e14758f4b43c53ef593.tar.bz2
llvm-225549f775db61c5dba10e14758f4b43c53ef593.tar.xz
disolve a hack, having CodeGenInstAlias decode the alias in the .td
file instead of the asmmatcher. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118324 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeGenInstruction.cpp')
-rw-r--r--utils/TableGen/CodeGenInstruction.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/utils/TableGen/CodeGenInstruction.cpp b/utils/TableGen/CodeGenInstruction.cpp
index 7428f2c88f..3c58cc6399 100644
--- a/utils/TableGen/CodeGenInstruction.cpp
+++ b/utils/TableGen/CodeGenInstruction.cpp
@@ -388,8 +388,16 @@ FlattenAsmStringVariants(StringRef Cur, unsigned Variant) {
/// CodeGenInstAlias Implementation
//===----------------------------------------------------------------------===//
-CodeGenInstAlias::CodeGenInstAlias(Record *R) : TheDef(R), Operands(R) {
+CodeGenInstAlias::CodeGenInstAlias(Record *R, CodeGenTarget &T)
+ : TheDef(R), Operands(R) {
AsmString = R->getValueAsString("AsmString");
Result = R->getValueAsDag("ResultInst");
+
+ // Verify that the root of the result is an instruction.
+ DefInit *DI = dynamic_cast<DefInit*>(Result->getOperator());
+ if (DI == 0 || !DI->getDef()->isSubClassOf("Instruction"))
+ throw TGError(R->getLoc(), "result of inst alias should be an instruction");
+
+ ResultInst = &T.getInstruction(DI->getDef());
}