diff options
author | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-03-05 14:01:30 +0000 |
---|---|---|
committer | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-03-05 14:01:30 +0000 |
commit | 0409b28af1b7093886e500223be77d01bb8625d6 (patch) | |
tree | 9a03a8d79910e9b54b12c182746e212c7c6e83d8 /llvm/utils/TableGen/FixedLenDecoderEmitter.cpp | |
parent | 8345c0e3a569ca1dd5f1adff5fe84864c199baf4 (diff) | |
download | bcm5719-llvm-0409b28af1b7093886e500223be77d01bb8625d6.tar.gz bcm5719-llvm-0409b28af1b7093886e500223be77d01bb8625d6.zip |
TableGen: Use DefInit::getDef() instead of the type's getRecord()
The former simply makes more sense: we want to access the data here in
the backend, not information about the type.
More importantly, removing users of RecordRecTy::getRecord() allows us
more freedom to refactor the frontend.
Change-Id: Iee8905fd22cdb9b11c42ca03246c03d8fe4dd77f
llvm-svn: 326699
Diffstat (limited to 'llvm/utils/TableGen/FixedLenDecoderEmitter.cpp')
-rw-r--r-- | llvm/utils/TableGen/FixedLenDecoderEmitter.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp index 03930d7132d..dc7e35deca1 100644 --- a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp @@ -1701,10 +1701,9 @@ void FilterChooser::emitTableEntries(DecoderTableInfo &TableInfo) const { static std::string findOperandDecoderMethod(TypedInit *TI) { std::string Decoder; - RecordRecTy *Type = cast<RecordRecTy>(TI->getType()); - Record *TypeRecord = Type->getRecord(); + Record *Record = cast<DefInit>(TI)->getDef(); - RecordVal *DecoderString = TypeRecord->getValue("DecoderMethod"); + RecordVal *DecoderString = Record->getValue("DecoderMethod"); StringInit *String = DecoderString ? dyn_cast<StringInit>(DecoderString->getValue()) : nullptr; if (String) { @@ -1713,14 +1712,14 @@ static std::string findOperandDecoderMethod(TypedInit *TI) { return Decoder; } - if (TypeRecord->isSubClassOf("RegisterOperand")) - TypeRecord = TypeRecord->getValueAsDef("RegClass"); + if (Record->isSubClassOf("RegisterOperand")) + Record = Record->getValueAsDef("RegClass"); - if (TypeRecord->isSubClassOf("RegisterClass")) { - Decoder = "Decode" + TypeRecord->getName().str() + "RegisterClass"; - } else if (TypeRecord->isSubClassOf("PointerLikeRegClass")) { + if (Record->isSubClassOf("RegisterClass")) { + Decoder = "Decode" + Record->getName().str() + "RegisterClass"; + } else if (Record->isSubClassOf("PointerLikeRegClass")) { Decoder = "DecodePointerLikeRegClass" + - utostr(TypeRecord->getValueAsInt("RegClassKind")); + utostr(Record->getValueAsInt("RegClassKind")); } return Decoder; @@ -1878,10 +1877,8 @@ static bool populateInstruction(CodeGenTarget &Target, CGI.Operands[SO.first].MIOperandInfo->getNumArgs()) { Init *Arg = CGI.Operands[SO.first].MIOperandInfo-> getArg(SO.second); - if (TypedInit *TI = cast<TypedInit>(Arg)) { - RecordRecTy *Type = cast<RecordRecTy>(TI->getType()); - TypeRecord = Type->getRecord(); - } + if (DefInit *DI = cast<DefInit>(Arg)) + TypeRecord = DI->getDef(); } bool isReg = false; @@ -1959,7 +1956,7 @@ static bool populateInstruction(CodeGenTarget &Target, // to interpret it. As a first step, require the target to provide // callbacks for decoding register classes. std::string Decoder = findOperandDecoderMethod(TI); - Record *TypeRecord = cast<RecordRecTy>(TI->getType())->getRecord(); + Record *TypeRecord = cast<DefInit>(TI)->getDef(); RecordVal *HasCompleteDecoderVal = TypeRecord->getValue("hasCompleteDecoder"); |