[llvm-branch-commits] [llvm-branch] r104497 - in /llvm/branches/Apple/whitney: include/llvm/Target/Target.td lib/Target/X86/X86InstrInfo.td utils/TableGen/AsmMatcherEmitter.cpp
Daniel Dunbar
daniel at zuster.org
Mon May 24 08:16:13 PDT 2010
Author: ddunbar
Date: Mon May 24 10:16:13 2010
New Revision: 104497
URL: http://llvm.org/viewvc/llvm-project?rev=104497&view=rev
Log:
tblgen/AsmMatcher: Change AsmOperandClass to allow a list of superclasses instead of just one.
Modified:
llvm/branches/Apple/whitney/include/llvm/Target/Target.td
llvm/branches/Apple/whitney/lib/Target/X86/X86InstrInfo.td
llvm/branches/Apple/whitney/utils/TableGen/AsmMatcherEmitter.cpp
Modified: llvm/branches/Apple/whitney/include/llvm/Target/Target.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/include/llvm/Target/Target.td?rev=104497&r1=104496&r2=104497&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/include/llvm/Target/Target.td (original)
+++ llvm/branches/Apple/whitney/include/llvm/Target/Target.td Mon May 24 10:16:13 2010
@@ -299,8 +299,8 @@
/// The name to use for this class, which should be usable as an enum value.
string Name = ?;
- /// The super class of this operand.
- AsmOperandClass SuperClass = ?;
+ /// The super classes of this operand.
+ list<AsmOperandClass> SuperClasses = [];
/// The name of the method on the target specific operand to call to test
/// whether the operand is an instance of this class. If not set, this will
@@ -334,10 +334,10 @@
// in. Match classes are used to define the order in which instructions are
// match, to ensure that which instructions gets matched is deterministic.
//
- // The target specific parser must be able to classify an parsed operand
- // into a unique class, which does not partially overlap with any other
- // classes. It can match a subset of some other class, in which case
- // ParserMatchSuperClass should be set to the name of that class.
+ // The target specific parser must be able to classify an parsed operand into
+ // a unique class, which does not partially overlap with any other classes. It
+ // can match a subset of some other class, in which case the AsmOperandClass
+ // should declare the other operand as one of its super classes.
AsmOperandClass ParserMatchClass = ImmAsmOperand;
}
Modified: llvm/branches/Apple/whitney/lib/Target/X86/X86InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/lib/Target/X86/X86InstrInfo.td?rev=104497&r1=104496&r2=104497&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/lib/Target/X86/X86InstrInfo.td (original)
+++ llvm/branches/Apple/whitney/lib/Target/X86/X86InstrInfo.td Mon May 24 10:16:13 2010
@@ -195,15 +195,15 @@
//
def X86MemAsmOperand : AsmOperandClass {
let Name = "Mem";
- let SuperClass = ?;
+ let SuperClasses = [];
}
def X86NoSegMemAsmOperand : AsmOperandClass {
let Name = "NoSegMem";
- let SuperClass = X86MemAsmOperand;
+ let SuperClasses = [X86MemAsmOperand];
}
def X86AbsMemAsmOperand : AsmOperandClass {
let Name = "AbsMem";
- let SuperClass = X86NoSegMemAsmOperand;
+ let SuperClasses = [X86NoSegMemAsmOperand];
}
class X86MemOperand<string printMethod> : Operand<iPTR> {
let PrintMethod = printMethod;
@@ -272,12 +272,12 @@
def ImmSExt32AsmOperand : AsmOperandClass {
let Name = "ImmSExt32";
- let SuperClass = ImmAsmOperand;
+ let SuperClasses = [ImmAsmOperand];
}
def ImmSExt8AsmOperand : AsmOperandClass {
let Name = "ImmSExt8";
- let SuperClass = ImmSExt32AsmOperand;
+ let SuperClasses = [ImmSExt32AsmOperand];
}
// A couple of more descriptive operand definitions.
Modified: llvm/branches/Apple/whitney/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/utils/TableGen/AsmMatcherEmitter.cpp?rev=104497&r1=104496&r2=104497&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/branches/Apple/whitney/utils/TableGen/AsmMatcherEmitter.cpp Mon May 24 10:16:13 2010
@@ -794,15 +794,19 @@
ClassInfo *CI = AsmOperandClasses[*it];
CI->Kind = ClassInfo::UserClass0 + Index;
- Init *Super = (*it)->getValueInit("SuperClass");
- if (DefInit *DI = dynamic_cast<DefInit*>(Super)) {
+ ListInit *Supers = (*it)->getValueAsListInit("SuperClasses");
+ for (unsigned i = 0, e = Supers->getSize(); i != e; ++i) {
+ DefInit *DI = dynamic_cast<DefInit*>(Supers->getElement(i));
+ if (!DI) {
+ PrintError((*it)->getLoc(), "Invalid super class reference!");
+ continue;
+ }
+
ClassInfo *SC = AsmOperandClasses[DI->getDef()];
if (!SC)
PrintError((*it)->getLoc(), "Invalid super class reference!");
else
CI->SuperClasses.push_back(SC);
- } else {
- assert(dynamic_cast<UnsetInit*>(Super) && "Unexpected SuperClass field!");
}
CI->ClassName = (*it)->getValueAsString("Name");
CI->Name = "MCK_" + CI->ClassName;
More information about the llvm-branch-commits
mailing list