diff options
author | Owen Anderson <resistor@mac.com> | 2011-07-28 23:56:20 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2011-07-28 23:56:20 +0000 |
commit | 00ef6e3a30a6b80ff995d3ee718db6349f93d732 (patch) | |
tree | 3f05dc75d82b58a08c646875679c9b2d32ad25e8 /utils | |
parent | 367853733247b46f2fa49359dd3490bada3cd111 (diff) | |
download | external_llvm-00ef6e3a30a6b80ff995d3ee718db6349f93d732.zip external_llvm-00ef6e3a30a6b80ff995d3ee718db6349f93d732.tar.gz external_llvm-00ef6e3a30a6b80ff995d3ee718db6349f93d732.tar.bz2 |
Enhance the fixed-length decoder emitter to support tied operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136431 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/FixedLenDecoderEmitter.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/utils/TableGen/FixedLenDecoderEmitter.cpp b/utils/TableGen/FixedLenDecoderEmitter.cpp index b062b40..4a2483b 100644 --- a/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/utils/TableGen/FixedLenDecoderEmitter.cpp @@ -1223,6 +1223,17 @@ static bool populateInstruction(const CodeGenInstruction &CGI, for (unsigned i = 0; i < In->getNumArgs(); ++i) InOutOperands.push_back(std::make_pair(In->getArg(i), In->getArgName(i))); + // Search for tied operands, so that we can correctly instantiate + // operands that are not explicitly represented in the encoding. + std::map<Init*, std::string> TiedNames; + for (unsigned i = 0; i < CGI.Operands.size(); ++i) { + int tiedTo = CGI.Operands[i].getTiedRegister(); + if (tiedTo != -1) { + TiedNames[InOutOperands[i].first] = InOutOperands[tiedTo].second; + TiedNames[InOutOperands[tiedTo].first] = InOutOperands[i].second; + } + } + // For each operand, see if we can figure out where it is encoded. for (std::vector<std::pair<Init*, std::string> >::iterator NI = InOutOperands.begin(), NE = InOutOperands.end(); NI != NE; ++NI) { @@ -1269,7 +1280,8 @@ static bool populateInstruction(const CodeGenInstruction &CGI, VarInit *Var = dynamic_cast<VarInit*>(BI->getVariable()); assert(Var); - if (Var->getName() != NI->second) { + if (Var->getName() != NI->second && + Var->getName() != TiedNames[NI->first]) { if (Base != ~0U) { OpInfo.addField(Base, Width, Offset); Base = ~0U; |