llvm.org GIT mirror llvm / f30187a
look up instructions by record, not by name. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98904 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 9 years ago
7 changed file(s) with 17 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
155155
156156 BitsInit *BI = R->getValueAsBitsInit("Inst");
157157 const std::vector &Vals = R->getValues();
158 CodeGenInstruction &CGI = Target.getInstruction(InstName);
158 CodeGenInstruction &CGI = Target.getInstruction(R);
159159
160160 // Loop over all of the fields in the instruction, determining which are the
161161 // operands to the instruction.
11401140 "Only supports zero or one result instrs!");
11411141
11421142 CodeGenInstruction &InstInfo =
1143 CDP.getTargetInfo().getInstruction(getOperator()->getName());
1143 CDP.getTargetInfo().getInstruction(getOperator());
11441144
11451145 EEVT::TypeSet ResultType;
11461146
20822082 std::vector Results;
20832083 std::vector Operands;
20842084
2085 CodeGenInstruction &InstInfo =Target.getInstruction(Instrs[i]->getName());
2085 CodeGenInstruction &InstInfo = Target.getInstruction(Instrs[i]);
20862086
20872087 if (InstInfo.OperandList.size() != 0) {
20882088 if (InstInfo.NumDefs == 0) {
21492149
21502150 // Parse the operands list from the (ops) list, validating it.
21512151 assert(I->getArgList().empty() && "Args list should still be empty here!");
2152 CodeGenInstruction &CGI = Target.getInstruction(Instrs[i]->getName());
2152 CodeGenInstruction &CGI = Target.getInstruction(Instrs[i]);
21532153
21542154 // Check that all of the results occur first in the list.
21552155 std::vector Results;
137137 return TargetRec->getValueAsDef("InstructionSet");
138138 }
139139
140
141 CodeGenInstruction &CodeGenTarget::getInstruction(const Record *InstRec) const {
142 return getInstruction(InstRec->getName());
143 }
144
145
140146 /// getAsmParser - Return the AssemblyParser definition for this target.
141147 ///
142148 Record *CodeGenTarget::getAsmParser() const {
192192 if (Instructions.empty()) ReadInstructions();
193193 return Instructions;
194194 }
195
195 private:
196196 CodeGenInstruction &getInstruction(const std::string &Name) const {
197197 const std::map &Insts = getInstructions();
198198 assert(Insts.count(Name) && "Not an instruction!");
199199 return const_cast(Insts.find(Name)->second);
200200 }
201 public:
202
203 CodeGenInstruction &getInstruction(const Record *InstRec) const;
201204
202205 typedef std::map
203206 CodeGenInstruction>::const_iterator inst_iterator;
7474 Record *Op = P->getOperator();
7575 if (Op->isSubClassOf("Instruction")) {
7676 Cost++;
77 CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op->getName());
77 CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op);
7878 if (II.usesCustomInserter)
7979 Cost += 10;
8080 }
626626 SmallVectorImpl &OutputOps) {
627627 Record *Op = N->getOperator();
628628 const CodeGenTarget &CGT = CGP.getTargetInfo();
629 CodeGenInstruction &II = CGT.getInstruction(Op->getName());
629 CodeGenInstruction &II = CGT.getInstruction(Op);
630630 const DAGInstruction &Inst = CGP.getInstruction(Op);
631631
632632 // If we can, get the pattern for the instruction we're generating. We derive
253253 Record *Op = Dst->getOperator();
254254 if (!Op->isSubClassOf("Instruction"))
255255 continue;
256 CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op->getName());
256 CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op);
257257 if (II.OperandList.empty())
258258 continue;
259259