Lines Matching defs:OS
19 void PredicateExpander::expandTrue(raw_ostream &OS) { OS << "true"; }
20 void PredicateExpander::expandFalse(raw_ostream &OS) { OS << "false"; }
22 void PredicateExpander::expandCheckImmOperand(raw_ostream &OS, int OpIndex,
26 OS << FunctionMapper << "(";
27 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex
30 OS << ")";
31 OS << (shouldNegate() ? " != " : " == ") << ImmVal;
34 void PredicateExpander::expandCheckImmOperand(raw_ostream &OS, int OpIndex,
38 expandCheckImmOperandSimple(OS, OpIndex, FunctionMapper);
41 OS << FunctionMapper << "(";
42 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex
45 OS << ")";
46 OS << (shouldNegate() ? " != " : " == ") << ImmVal;
49 void PredicateExpander::expandCheckImmOperandSimple(raw_ostream &OS,
53 OS << "!";
55 OS << FunctionMapper << "(";
56 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex
59 OS << ")";
62 void PredicateExpander::expandCheckImmOperandLT(raw_ostream &OS, int OpIndex,
66 OS << FunctionMapper << "(";
67 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex
70 OS << ")";
71 OS << (shouldNegate() ? " >= " : " < ") << ImmVal;
74 void PredicateExpander::expandCheckImmOperandGT(raw_ostream &OS, int OpIndex,
78 OS << FunctionMapper << "(";
79 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex
82 OS << ")";
83 OS << (shouldNegate() ? " <= " : " > ") << ImmVal;
86 void PredicateExpander::expandCheckRegOperand(raw_ostream &OS, int OpIndex,
92 OS << FunctionMapper << "(";
93 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex
96 OS << ")";
97 OS << (shouldNegate() ? " != " : " == ");
100 OS << Str << "::";
101 OS << Reg->getName();
104 void PredicateExpander::expandCheckRegOperandSimple(raw_ostream &OS,
108 OS << "!";
110 OS << FunctionMapper << "(";
111 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex
114 OS << ")";
117 void PredicateExpander::expandCheckInvalidRegOperand(raw_ostream &OS,
120 OS << "!";
121 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex
125 void PredicateExpander::expandCheckSameRegOperand(raw_ostream &OS, int First,
127 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << First
132 void PredicateExpander::expandCheckNumOperands(raw_ostream &OS, int NumOps) {
133 OS << "MI" << (isByRef() ? "." : "->") << "getNumOperands() "
137 void PredicateExpander::expandCheckOpcode(raw_ostream &OS, const Record *Inst) {
138 OS << "MI" << (isByRef() ? "." : "->") << "getOpcode() "
143 void PredicateExpander::expandCheckOpcode(raw_ostream &OS,
149 OS << "( ";
150 expandCheckOpcode(OS, Opcodes[0]);
151 OS << " )";
155 OS << '(';
158 OS << '\n' << Indent;
160 OS << (shouldNegate() ? "&& " : "|| ");
162 expandCheckOpcode(OS, Rec);
167 OS << '\n' << Indent << ')';
170 void PredicateExpander::expandCheckPseudo(raw_ostream &OS,
173 expandFalse(OS);
175 expandCheckOpcode(OS, Opcodes);
179 raw_ostream &OS, ArrayRef<const Record *> Sequence, bool IsCheckAll) {
182 return expandPredicate(OS, Sequence[0]);
186 OS << (shouldNegate() ? "!(" : "(");
192 OS << '\n' << Indent;
194 OS << (IsCheckAll ? "&& " : "|| ");
195 expandPredicate(OS, Rec);
199 OS << '\n' << Indent << ')';
203 void PredicateExpander::expandTIIFunctionCall(raw_ostream &OS,
205 OS << (shouldNegate() ? "!" : "");
206 OS << TargetName << (shouldExpandForMC() ? "_MC::" : "InstrInfo::");
207 OS << MethodName << (isByRef() ? "(MI)" : "(*MI)");
210 void PredicateExpander::expandCheckIsRegOperand(raw_ostream &OS, int OpIndex) {
211 OS << (shouldNegate() ? "!" : "") << "MI" << (isByRef() ? "." : "->")
215 void PredicateExpander::expandCheckIsVRegOperand(raw_ostream &OS, int OpIndex) {
216 OS << (shouldNegate() ? "!" : "") << "MI" << (isByRef() ? "." : "->")
220 void PredicateExpander::expandCheckIsImmOperand(raw_ostream &OS, int OpIndex) {
221 OS << (shouldNegate() ? "!" : "") << "MI" << (isByRef() ? "." : "->")
226 raw_ostream &OS, StringRef MCInstFn, StringRef MachineInstrFn,
229 OS << (TIIPtr.empty() ? "TII" : TIIPtr) << "->" << MachineInstrFn;
230 OS << (isByRef() ? "(MI)" : "(*MI)");
234 OS << MCInstFn << (isByRef() ? "(MI" : "(*MI") << ", MCII)";
237 void PredicateExpander::expandCheckFunctionPredicate(raw_ostream &OS,
240 OS << (shouldExpandForMC() ? MCInstFn : MachineInstrFn)
244 void PredicateExpander::expandCheckNonPortable(raw_ostream &OS,
247 return expandFalse(OS);
249 OS << '(' << Code << ')';
252 void PredicateExpander::expandReturnStatement(raw_ostream &OS,
260 OS << Buffer;
263 void PredicateExpander::expandOpcodeSwitchCase(raw_ostream &OS,
266 OS << Indent << "case " << Opcode->getValueAsString("Namespace")
271 OS << Indent;
272 expandStatement(OS, Rec->getValueAsDef("CaseStmt"));
277 raw_ostream &OS, ArrayRef<const Record *> Cases, const Record *Default) {
294 OS << Buffer;
297 void PredicateExpander::expandStatement(raw_ostream &OS, const Record *Rec) {
300 expandOpcodeSwitchStatement(OS, Rec->getValueAsListOfDefs("Cases"),
306 expandReturnStatement(OS, Rec->getValueAsDef("Pred"));
313 void PredicateExpander::expandPredicate(raw_ostream &OS, const Record *Rec) {
317 return expandFalse(OS);
318 return expandTrue(OS);
323 return expandTrue(OS);
324 return expandFalse(OS);
329 expandPredicate(OS, Rec->getValueAsDef("Pred"));
335 return expandCheckIsRegOperand(OS, Rec->getValueAsInt("OpIndex"));
338 return expandCheckIsVRegOperand(OS, Rec->getValueAsInt("OpIndex"));
341 return expandCheckIsImmOperand(OS, Rec->getValueAsInt("OpIndex"));
344 return expandCheckRegOperand(OS, Rec->getValueAsInt("OpIndex"),
349 return expandCheckRegOperandSimple(OS, Rec->getValueAsInt("OpIndex"),
353 return expandCheckInvalidRegOperand(OS, Rec->getValueAsInt("OpIndex"));
356 return expandCheckImmOperand(OS, Rec->getValueAsInt("OpIndex"),
361 return expandCheckImmOperand(OS, Rec->getValueAsInt("OpIndex"),
366 return expandCheckImmOperandLT(OS, Rec->getValueAsInt("OpIndex"),
371 return expandCheckImmOperandGT(OS, Rec->getValueAsInt("OpIndex"),
376 return expandCheckImmOperandSimple(OS, Rec->getValueAsInt("OpIndex"),
380 return expandCheckSameRegOperand(OS, Rec->getValueAsInt("FirstIndex"),
384 return expandCheckNumOperands(OS, Rec->getValueAsInt("NumOps"));
387 return expandCheckPseudo(OS, Rec->getValueAsListOfDefs("ValidOpcodes"));
390 return expandCheckOpcode(OS, Rec->getValueAsListOfDefs("ValidOpcodes"));
393 return expandPredicateSequence(OS, Rec->getValueAsListOfDefs("Predicates"),
397 return expandPredicateSequence(OS, Rec->getValueAsListOfDefs("Predicates"),
402 OS, Rec->getValueAsString("MCInstFnName"),
408 OS, Rec->getValueAsString("MCInstFnName"),
414 return expandCheckNonPortable(OS, Rec->getValueAsString("CodeBlock"));
417 return expandTIIFunctionCall(OS, Rec->getValueAsString("FunctionName"));
422 void STIPredicateExpander::expandHeader(raw_ostream &OS,
427 OS << Indent << "bool ";
429 OS << getClassPrefix() << "::";
430 OS << FunctionName << "(";
432 OS << "const MCInst " << (isByRef() ? "&" : "*") << "MI";
434 OS << "const MachineInstr " << (isByRef() ? "&" : "*") << "MI";
436 OS << ", APInt &Mask";
437 OS << (shouldExpandForMC() ? ", unsigned ProcessorID) const " : ") const ");
439 OS << "{\n";
444 OS << "override";
445 OS << ";\n";
448 void STIPredicateExpander::expandPrologue(raw_ostream &OS,
456 OS << Indent << "if (" << Delegate->getValueAsString("Name") << "(MI";
458 OS << ", Mask";
460 OS << ", ProcessorID";
461 OS << "))\n";
462 OS << Indent + 1 << "return true;\n\n";
468 OS << Indent << "unsigned ProcessorID = getSchedModel().getProcessorID();\n";
471 void STIPredicateExpander::expandOpcodeGroup(raw_ostream &OS,
483 OS << Indent << "if (ProcessorID == " << I;
485 OS << " || ProcessorID == " << I;
490 OS << ") {\n";
493 OS << Indent;
496 OS << "Mask.clearAllBits();\n";
498 OS << "Mask = " << PI.OperandMask << ";\n";
499 OS << Indent;
501 OS << "return ";
502 expandPredicate(OS, PI.Predicate);
503 OS << ";\n";
505 OS << Indent << "}\n";
509 void STIPredicateExpander::expandBody(raw_ostream &OS,
514 OS << Indent << "switch(MI" << (isByRef() ? "." : "->") << "getOpcode()) {\n";
515 OS << Indent << "default:\n";
516 OS << Indent << " break;";
520 OS << '\n'
525 OS << '\n';
527 expandOpcodeGroup(OS, Group, UpdatesOpcodeMask);
529 OS << Indent << "break;\n";
533 OS << Indent << "}\n";
536 void STIPredicateExpander::expandEpilogue(raw_ostream &OS,
538 OS << '\n' << Indent;
539 OS << "return ";
540 expandPredicate(OS, Fn.getDefaultReturnPredicate());
541 OS << ";\n";
545 OS << Indent << "} // " << ClassPrefix << "::" << FunctionName << "\n\n";
548 void STIPredicateExpander::expandSTIPredicate(raw_ostream &OS,
554 expandHeader(OS, Fn);
556 expandPrologue(OS, Fn);
557 expandBody(OS, Fn);
558 expandEpilogue(OS, Fn);