Live intervals for live-in registers should begin at the beginning of a basic block...
[oota-llvm.git] / utils / TableGen / FastISelEmitter.cpp
1 //===- FastISelEmitter.cpp - Generate an instruction selector -------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This tablegen backend emits a "fast" instruction selector.
11 //
12 // This instruction selection method is designed to emit very poor code
13 // quickly. Also, it is not designed to do much lowering, so most illegal
14 // types (e.g. i64 on 32-bit targets) and operations (e.g. calls) are not
15 // supported and cannot easily be added. Blocks containing operations
16 // that are not supported need to be handled by a more capable selector,
17 // such as the SelectionDAG selector.
18 //
19 // The intended use for "fast" instruction selection is "-O0" mode
20 // compilation, where the quality of the generated code is irrelevant when
21 // weighed against the speed at which the code can be generated.
22 //
23 // If compile time is so important, you might wonder why we don't just
24 // skip codegen all-together, emit LLVM bytecode files, and execute them
25 // with an interpreter. The answer is that it would complicate linking and
26 // debugging, and also because that isn't how a compiler is expected to
27 // work in some circles.
28 //
29 // If you need better generated code or more lowering than what this
30 // instruction selector provides, use the SelectionDAG (DAGISel) instruction
31 // selector instead. If you're looking here because SelectionDAG isn't fast
32 // enough, consider looking into improving the SelectionDAG infastructure
33 // instead. At the time of this writing there remain several major
34 // opportunities for improvement.
35 // 
36 //===----------------------------------------------------------------------===//
37
38 #include "FastISelEmitter.h"
39 #include "Record.h"
40 #include "llvm/Support/Debug.h"
41 #include "llvm/Support/Streams.h"
42 #include "llvm/ADT/VectorExtras.h"
43 using namespace llvm;
44
45 namespace {
46
47 /// InstructionMemo - This class holds additional information about an
48 /// instruction needed to emit code for it.
49 ///
50 struct InstructionMemo {
51   std::string Name;
52   const CodeGenRegisterClass *RC;
53   unsigned char SubRegNo;
54   std::vector<std::string>* PhysRegs;
55 };
56
57 /// OperandsSignature - This class holds a description of a list of operand
58 /// types. It has utility methods for emitting text based on the operands.
59 ///
60 struct OperandsSignature {
61   std::vector<std::string> Operands;
62
63   bool operator<(const OperandsSignature &O) const {
64     return Operands < O.Operands;
65   }
66
67   bool empty() const { return Operands.empty(); }
68
69   /// initialize - Examine the given pattern and initialize the contents
70   /// of the Operands array accordingly. Return true if all the operands
71   /// are supported, false otherwise.
72   ///
73   bool initialize(TreePatternNode *InstPatNode,
74                   const CodeGenTarget &Target,
75                   MVT::SimpleValueType VT) {
76     if (!InstPatNode->isLeaf() &&
77         InstPatNode->getOperator()->getName() == "imm") {
78       Operands.push_back("i");
79       return true;
80     }
81     if (!InstPatNode->isLeaf() &&
82         InstPatNode->getOperator()->getName() == "fpimm") {
83       Operands.push_back("f");
84       return true;
85     }
86     
87     const CodeGenRegisterClass *DstRC = 0;
88     
89     for (unsigned i = 0, e = InstPatNode->getNumChildren(); i != e; ++i) {
90       TreePatternNode *Op = InstPatNode->getChild(i);
91       // For now, filter out any operand with a predicate.
92       if (!Op->getPredicateFn().empty())
93         return false;
94       // For now, filter out any operand with multiple values.
95       if (Op->getExtTypes().size() != 1)
96         return false;
97       // For now, all the operands must have the same type.
98       if (Op->getTypeNum(0) != VT)
99         return false;
100       if (!Op->isLeaf()) {
101         if (Op->getOperator()->getName() == "imm") {
102           Operands.push_back("i");
103           return true;
104         }
105         if (Op->getOperator()->getName() == "fpimm") {
106           Operands.push_back("f");
107           return true;
108         }
109         // For now, ignore other non-leaf nodes.
110         return false;
111       }
112       DefInit *OpDI = dynamic_cast<DefInit*>(Op->getLeafValue());
113       if (!OpDI)
114         return false;
115       Record *OpLeafRec = OpDI->getDef();
116       // For now, the only other thing we accept is register operands.
117
118       const CodeGenRegisterClass *RC = 0;
119       if (OpLeafRec->isSubClassOf("RegisterClass"))
120         RC = &Target.getRegisterClass(OpLeafRec);
121       else if (OpLeafRec->isSubClassOf("Register"))
122         RC = Target.getRegisterClassForRegister(OpLeafRec);
123       else
124         return false;
125       // For now, require the register operands' register classes to all
126       // be the same.
127       if (!RC)
128         return false;
129       // For now, all the operands must have the same register class.
130       if (DstRC) {
131         if (DstRC != RC)
132           return false;
133       } else
134         DstRC = RC;
135       Operands.push_back("r");
136     }
137     return true;
138   }
139
140   void PrintParameters(std::ostream &OS) const {
141     for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
142       if (Operands[i] == "r") {
143         OS << "unsigned Op" << i;
144       } else if (Operands[i] == "i") {
145         OS << "uint64_t imm" << i;
146       } else if (Operands[i] == "f") {
147         OS << "ConstantFP *f" << i;
148       } else {
149         assert("Unknown operand kind!");
150         abort();
151       }
152       if (i + 1 != e)
153         OS << ", ";
154     }
155   }
156
157   void PrintArguments(std::ostream &OS,
158                       const std::vector<std::string>& PR) const {
159     assert(PR.size() == Operands.size());
160     bool PrintedArg = false;
161     for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
162       if (PR[i] != "")
163         // Implicit physical register operand.
164         continue;
165
166       if (PrintedArg)
167         OS << ", ";
168       if (Operands[i] == "r") {
169         OS << "Op" << i;
170         PrintedArg = true;
171       } else if (Operands[i] == "i") {
172         OS << "imm" << i;
173         PrintedArg = true;
174       } else if (Operands[i] == "f") {
175         OS << "f" << i;
176         PrintedArg = true;
177       } else {
178         assert("Unknown operand kind!");
179         abort();
180       }
181     }
182   }
183
184   void PrintArguments(std::ostream &OS) const {
185     for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
186       if (Operands[i] == "r") {
187         OS << "Op" << i;
188       } else if (Operands[i] == "i") {
189         OS << "imm" << i;
190       } else if (Operands[i] == "f") {
191         OS << "f" << i;
192       } else {
193         assert("Unknown operand kind!");
194         abort();
195       }
196       if (i + 1 != e)
197         OS << ", ";
198     }
199   }
200
201
202   void PrintManglingSuffix(std::ostream &OS,
203                            const std::vector<std::string>& PR) const {
204     for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
205       if (PR[i] != "")
206         // Implicit physical register operand. e.g. Instruction::Mul expect to
207         // select to a binary op. On x86, mul may take a single operand with
208         // the other operand being implicit. We must emit something that looks
209         // like a binary instruction except for the very inner FastEmitInst_*
210         // call.
211         continue;
212       OS << Operands[i];
213     }
214   }
215
216   void PrintManglingSuffix(std::ostream &OS) const {
217     for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
218       OS << Operands[i];
219     }
220   }
221 };
222
223 class FastISelMap {
224   typedef std::map<std::string, InstructionMemo> PredMap;
225   typedef std::map<MVT::SimpleValueType, PredMap> RetPredMap;
226   typedef std::map<MVT::SimpleValueType, RetPredMap> TypeRetPredMap;
227   typedef std::map<std::string, TypeRetPredMap> OpcodeTypeRetPredMap;
228   typedef std::map<OperandsSignature, OpcodeTypeRetPredMap> OperandsOpcodeTypeRetPredMap;
229
230   OperandsOpcodeTypeRetPredMap SimplePatterns;
231
232   std::string InstNS;
233
234 public:
235   explicit FastISelMap(std::string InstNS);
236
237   void CollectPatterns(CodeGenDAGPatterns &CGP);
238   void PrintClass(std::ostream &OS);
239   void PrintFunctionDefinitions(std::ostream &OS);
240 };
241
242 }
243
244 static std::string getOpcodeName(Record *Op, CodeGenDAGPatterns &CGP) {
245   return CGP.getSDNodeInfo(Op).getEnumName();
246 }
247
248 static std::string getLegalCName(std::string OpName) {
249   std::string::size_type pos = OpName.find("::");
250   if (pos != std::string::npos)
251     OpName.replace(pos, 2, "_");
252   return OpName;
253 }
254
255 FastISelMap::FastISelMap(std::string instns)
256   : InstNS(instns) {
257 }
258
259 void FastISelMap::CollectPatterns(CodeGenDAGPatterns &CGP) {
260   const CodeGenTarget &Target = CGP.getTargetInfo();
261
262   // Determine the target's namespace name.
263   InstNS = Target.getInstNamespace() + "::";
264   assert(InstNS.size() > 2 && "Can't determine target-specific namespace!");
265
266   // Scan through all the patterns and record the simple ones.
267   for (CodeGenDAGPatterns::ptm_iterator I = CGP.ptm_begin(),
268        E = CGP.ptm_end(); I != E; ++I) {
269     const PatternToMatch &Pattern = *I;
270
271     // For now, just look at Instructions, so that we don't have to worry
272     // about emitting multiple instructions for a pattern.
273     TreePatternNode *Dst = Pattern.getDstPattern();
274     if (Dst->isLeaf()) continue;
275     Record *Op = Dst->getOperator();
276     if (!Op->isSubClassOf("Instruction"))
277       continue;
278     CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op->getName());
279     if (II.OperandList.empty())
280       continue;
281
282     // For now, ignore multi-instruction patterns.
283     bool MultiInsts = false;
284     for (unsigned i = 0, e = Dst->getNumChildren(); i != e; ++i) {
285       TreePatternNode *ChildOp = Dst->getChild(i);
286       if (ChildOp->isLeaf())
287         continue;
288       if (ChildOp->getOperator()->isSubClassOf("Instruction")) {
289         MultiInsts = true;
290         break;
291       }
292     }
293     if (MultiInsts)
294       continue;
295
296     // For now, ignore instructions where the first operand is not an
297     // output register.
298     const CodeGenRegisterClass *DstRC = 0;
299     unsigned SubRegNo = ~0;
300     if (Op->getName() != "EXTRACT_SUBREG") {
301       Record *Op0Rec = II.OperandList[0].Rec;
302       if (!Op0Rec->isSubClassOf("RegisterClass"))
303         continue;
304       DstRC = &Target.getRegisterClass(Op0Rec);
305       if (!DstRC)
306         continue;
307     } else {
308       SubRegNo = static_cast<IntInit*>(
309                  Dst->getChild(1)->getLeafValue())->getValue();
310     }
311
312     // Inspect the pattern.
313     TreePatternNode *InstPatNode = Pattern.getSrcPattern();
314     if (!InstPatNode) continue;
315     if (InstPatNode->isLeaf()) continue;
316
317     Record *InstPatOp = InstPatNode->getOperator();
318     std::string OpcodeName = getOpcodeName(InstPatOp, CGP);
319     MVT::SimpleValueType RetVT = InstPatNode->getTypeNum(0);
320     MVT::SimpleValueType VT = RetVT;
321     if (InstPatNode->getNumChildren())
322       VT = InstPatNode->getChild(0)->getTypeNum(0);
323
324     // For now, filter out instructions which just set a register to
325     // an Operand or an immediate, like MOV32ri.
326     if (InstPatOp->isSubClassOf("Operand"))
327       continue;
328
329     // For now, filter out any instructions with predicates.
330     if (!InstPatNode->getPredicateFn().empty())
331       continue;
332
333     // Check all the operands.
334     OperandsSignature Operands;
335     if (!Operands.initialize(InstPatNode, Target, VT))
336       continue;
337     
338     std::vector<std::string>* PhysRegInputs = new std::vector<std::string>();
339     if (!InstPatNode->isLeaf() &&
340         (InstPatNode->getOperator()->getName() == "imm" ||
341          InstPatNode->getOperator()->getName() == "fpimmm"))
342       PhysRegInputs->push_back("");
343     else if (!InstPatNode->isLeaf()) {
344       for (unsigned i = 0, e = InstPatNode->getNumChildren(); i != e; ++i) {
345         TreePatternNode *Op = InstPatNode->getChild(i);
346         if (!Op->isLeaf()) {
347           PhysRegInputs->push_back("");
348           continue;
349         }
350         
351         DefInit *OpDI = dynamic_cast<DefInit*>(Op->getLeafValue());
352         Record *OpLeafRec = OpDI->getDef();
353         std::string PhysReg;
354         if (OpLeafRec->isSubClassOf("Register")) {
355           PhysReg += static_cast<StringInit*>(OpLeafRec->getValue( \
356                      "Namespace")->getValue())->getValue();
357           PhysReg += "::";
358           
359           std::vector<CodeGenRegister> Regs = Target.getRegisters();
360           for (unsigned i = 0; i < Regs.size(); ++i) {
361             if (Regs[i].TheDef == OpLeafRec) {
362               PhysReg += Regs[i].getName();
363               break;
364             }
365           }
366         }
367       
368         PhysRegInputs->push_back(PhysReg);
369       }
370     } else
371       PhysRegInputs->push_back("");
372
373     // Get the predicate that guards this pattern.
374     std::string PredicateCheck = Pattern.getPredicateCheck();
375
376     // Ok, we found a pattern that we can handle. Remember it.
377     InstructionMemo Memo = {
378       Pattern.getDstPattern()->getOperator()->getName(),
379       DstRC,
380       SubRegNo,
381       PhysRegInputs
382     };
383     assert(!SimplePatterns[Operands][OpcodeName][VT][RetVT].count(PredicateCheck) &&
384            "Duplicate pattern!");
385     SimplePatterns[Operands][OpcodeName][VT][RetVT][PredicateCheck] = Memo;
386   }
387 }
388
389 void FastISelMap::PrintFunctionDefinitions(std::ostream &OS) {
390   // Now emit code for all the patterns that we collected.
391   for (OperandsOpcodeTypeRetPredMap::const_iterator OI = SimplePatterns.begin(),
392        OE = SimplePatterns.end(); OI != OE; ++OI) {
393     const OperandsSignature &Operands = OI->first;
394     const OpcodeTypeRetPredMap &OTM = OI->second;
395
396     for (OpcodeTypeRetPredMap::const_iterator I = OTM.begin(), E = OTM.end();
397          I != E; ++I) {
398       const std::string &Opcode = I->first;
399       const TypeRetPredMap &TM = I->second;
400
401       OS << "// FastEmit functions for " << Opcode << ".\n";
402       OS << "\n";
403
404       // Emit one function for each opcode,type pair.
405       for (TypeRetPredMap::const_iterator TI = TM.begin(), TE = TM.end();
406            TI != TE; ++TI) {
407         MVT::SimpleValueType VT = TI->first;
408         const RetPredMap &RM = TI->second;
409         if (RM.size() != 1) {
410           for (RetPredMap::const_iterator RI = RM.begin(), RE = RM.end();
411                RI != RE; ++RI) {
412             MVT::SimpleValueType RetVT = RI->first;
413             const PredMap &PM = RI->second;
414             bool HasPred = false;
415
416             OS << "unsigned FastEmit_"
417                << getLegalCName(Opcode)
418                << "_" << getLegalCName(getName(VT))
419                << "_" << getLegalCName(getName(RetVT)) << "_";
420             Operands.PrintManglingSuffix(OS);
421             OS << "(";
422             Operands.PrintParameters(OS);
423             OS << ") {\n";
424
425             // Emit code for each possible instruction. There may be
426             // multiple if there are subtarget concerns.
427             for (PredMap::const_iterator PI = PM.begin(), PE = PM.end();
428                  PI != PE; ++PI) {
429               std::string PredicateCheck = PI->first;
430               const InstructionMemo &Memo = PI->second;
431   
432               if (PredicateCheck.empty()) {
433                 assert(!HasPred &&
434                        "Multiple instructions match, at least one has "
435                        "a predicate and at least one doesn't!");
436               } else {
437                 OS << "  if (" + PredicateCheck + ") {\n";
438                 OS << "  ";
439                 HasPred = true;
440               }
441               
442               for (unsigned i = 0; i < Memo.PhysRegs->size(); ++i) {
443                 if ((*Memo.PhysRegs)[i] != "")
444                   OS << "  TII.copyRegToReg(*MBB, MBB->end(), "
445                      << (*Memo.PhysRegs)[i] << ", Op" << i << ", "
446                      << "TM.getRegisterInfo()->getPhysicalRegisterRegClass("
447                      << (*Memo.PhysRegs)[i] << "), "
448                      << "MRI.getRegClass(Op" << i << "));\n";
449               }
450               
451               OS << "  return FastEmitInst_";
452               if (Memo.SubRegNo == (unsigned char)~0) {
453                 Operands.PrintManglingSuffix(OS, *Memo.PhysRegs);
454                 OS << "(" << InstNS << Memo.Name << ", ";
455                 OS << InstNS << Memo.RC->getName() << "RegisterClass";
456                 if (!Operands.empty())
457                   OS << ", ";
458                 Operands.PrintArguments(OS, *Memo.PhysRegs);
459                 OS << ");\n";
460               } else {
461                 OS << "extractsubreg(Op0, ";
462                 OS << (unsigned)Memo.SubRegNo;
463                 OS << ");\n";
464               }
465               
466               if (HasPred)
467                 OS << "  }\n";
468               
469             }
470             // Return 0 if none of the predicates were satisfied.
471             if (HasPred)
472               OS << "  return 0;\n";
473             OS << "}\n";
474             OS << "\n";
475           }
476           
477           // Emit one function for the type that demultiplexes on return type.
478           OS << "unsigned FastEmit_"
479              << getLegalCName(Opcode) << "_"
480              << getLegalCName(getName(VT)) << "_";
481           Operands.PrintManglingSuffix(OS);
482           OS << "(MVT::SimpleValueType RetVT";
483           if (!Operands.empty())
484             OS << ", ";
485           Operands.PrintParameters(OS);
486           OS << ") {\nswitch (RetVT) {\n";
487           for (RetPredMap::const_iterator RI = RM.begin(), RE = RM.end();
488                RI != RE; ++RI) {
489             MVT::SimpleValueType RetVT = RI->first;
490             OS << "  case " << getName(RetVT) << ": return FastEmit_"
491                << getLegalCName(Opcode) << "_" << getLegalCName(getName(VT))
492                << "_" << getLegalCName(getName(RetVT)) << "_";
493             Operands.PrintManglingSuffix(OS);
494             OS << "(";
495             Operands.PrintArguments(OS);
496             OS << ");\n";
497           }
498           OS << "  default: return 0;\n}\n}\n\n";
499           
500         } else {
501           // Non-variadic return type.
502           OS << "unsigned FastEmit_"
503              << getLegalCName(Opcode) << "_"
504              << getLegalCName(getName(VT)) << "_";
505           Operands.PrintManglingSuffix(OS);
506           OS << "(MVT::SimpleValueType RetVT";
507           if (!Operands.empty())
508             OS << ", ";
509           Operands.PrintParameters(OS);
510           OS << ") {\n";
511           
512           OS << "  if (RetVT != " << getName(RM.begin()->first)
513              << ")\n    return 0;\n";
514           
515           const PredMap &PM = RM.begin()->second;
516           bool HasPred = false;
517           
518           // Emit code for each possible instruction. There may be
519           // multiple if there are subtarget concerns.
520           for (PredMap::const_iterator PI = PM.begin(), PE = PM.end(); PI != PE;
521                ++PI) {
522             std::string PredicateCheck = PI->first;
523             const InstructionMemo &Memo = PI->second;
524
525             if (PredicateCheck.empty()) {
526               assert(!HasPred &&
527                      "Multiple instructions match, at least one has "
528                      "a predicate and at least one doesn't!");
529             } else {
530               OS << "  if (" + PredicateCheck + ") {\n";
531               OS << "  ";
532               HasPred = true;
533             }
534             
535              for (unsigned i = 0; i < Memo.PhysRegs->size(); ++i) {
536                 if ((*Memo.PhysRegs)[i] != "")
537                   OS << "  TII.copyRegToReg(*MBB, MBB->end(), "
538                      << (*Memo.PhysRegs)[i] << ", Op" << i << ", "
539                      << "TM.getRegisterInfo()->getPhysicalRegisterRegClass("
540                      << (*Memo.PhysRegs)[i] << "), "
541                      << "MRI.getRegClass(Op" << i << "));\n";
542               }
543             
544             OS << "  return FastEmitInst_";
545             
546             if (Memo.SubRegNo == (unsigned char)~0) {
547               Operands.PrintManglingSuffix(OS, *Memo.PhysRegs);
548               OS << "(" << InstNS << Memo.Name << ", ";
549               OS << InstNS << Memo.RC->getName() << "RegisterClass";
550               if (!Operands.empty())
551                 OS << ", ";
552               Operands.PrintArguments(OS, *Memo.PhysRegs);
553               OS << ");\n";
554             } else {
555               OS << "extractsubreg(Op0, ";
556               OS << (unsigned)Memo.SubRegNo;
557               OS << ");\n";
558             }
559             
560              if (HasPred)
561                OS << "  }\n";
562           }
563           
564           // Return 0 if none of the predicates were satisfied.
565           if (HasPred)
566             OS << "  return 0;\n";
567           OS << "}\n";
568           OS << "\n";
569         }
570       }
571
572       // Emit one function for the opcode that demultiplexes based on the type.
573       OS << "unsigned FastEmit_"
574          << getLegalCName(Opcode) << "_";
575       Operands.PrintManglingSuffix(OS);
576       OS << "(MVT::SimpleValueType VT, MVT::SimpleValueType RetVT";
577       if (!Operands.empty())
578         OS << ", ";
579       Operands.PrintParameters(OS);
580       OS << ") {\n";
581       OS << "  switch (VT) {\n";
582       for (TypeRetPredMap::const_iterator TI = TM.begin(), TE = TM.end();
583            TI != TE; ++TI) {
584         MVT::SimpleValueType VT = TI->first;
585         std::string TypeName = getName(VT);
586         OS << "  case " << TypeName << ": return FastEmit_"
587            << getLegalCName(Opcode) << "_" << getLegalCName(TypeName) << "_";
588         Operands.PrintManglingSuffix(OS);
589         OS << "(RetVT";
590         if (!Operands.empty())
591           OS << ", ";
592         Operands.PrintArguments(OS);
593         OS << ");\n";
594       }
595       OS << "  default: return 0;\n";
596       OS << "  }\n";
597       OS << "}\n";
598       OS << "\n";
599     }
600
601     OS << "// Top-level FastEmit function.\n";
602     OS << "\n";
603
604     // Emit one function for the operand signature that demultiplexes based
605     // on opcode and type.
606     OS << "unsigned FastEmit_";
607     Operands.PrintManglingSuffix(OS);
608     OS << "(MVT::SimpleValueType VT, MVT::SimpleValueType RetVT, ISD::NodeType Opcode";
609     if (!Operands.empty())
610       OS << ", ";
611     Operands.PrintParameters(OS);
612     OS << ") {\n";
613     OS << "  switch (Opcode) {\n";
614     for (OpcodeTypeRetPredMap::const_iterator I = OTM.begin(), E = OTM.end();
615          I != E; ++I) {
616       const std::string &Opcode = I->first;
617
618       OS << "  case " << Opcode << ": return FastEmit_"
619          << getLegalCName(Opcode) << "_";
620       Operands.PrintManglingSuffix(OS);
621       OS << "(VT, RetVT";
622       if (!Operands.empty())
623         OS << ", ";
624       Operands.PrintArguments(OS);
625       OS << ");\n";
626     }
627     OS << "  default: return 0;\n";
628     OS << "  }\n";
629     OS << "}\n";
630     OS << "\n";
631   }
632 }
633
634 void FastISelEmitter::run(std::ostream &OS) {
635   const CodeGenTarget &Target = CGP.getTargetInfo();
636
637   // Determine the target's namespace name.
638   std::string InstNS = Target.getInstNamespace() + "::";
639   assert(InstNS.size() > 2 && "Can't determine target-specific namespace!");
640
641   EmitSourceFileHeader("\"Fast\" Instruction Selector for the " +
642                        Target.getName() + " target", OS);
643
644   FastISelMap F(InstNS);
645   F.CollectPatterns(CGP);
646   F.PrintFunctionDefinitions(OS);
647 }
648
649 FastISelEmitter::FastISelEmitter(RecordKeeper &R)
650   : Records(R),
651     CGP(R) {
652 }
653