Lines Matching refs:OS

19 void PredicateExpander::expandTrue(raw_ostream &OS) { OS << "true"; }  in expandTrue()  argument
20 void PredicateExpander::expandFalse(raw_ostream &OS) { OS << "false"; } in expandFalse() argument
22 void PredicateExpander::expandCheckImmOperand(raw_ostream &OS, int OpIndex, in expandCheckImmOperand() argument
26 OS << FunctionMapper << "("; in expandCheckImmOperand()
27 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckImmOperand()
30 OS << ")"; in expandCheckImmOperand()
31 OS << (shouldNegate() ? " != " : " == ") << ImmVal; in expandCheckImmOperand()
34 void PredicateExpander::expandCheckImmOperand(raw_ostream &OS, int OpIndex, in expandCheckImmOperand() argument
38 expandCheckImmOperandSimple(OS, OpIndex, FunctionMapper); in expandCheckImmOperand()
41 OS << FunctionMapper << "("; in expandCheckImmOperand()
42 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckImmOperand()
45 OS << ")"; in expandCheckImmOperand()
46 OS << (shouldNegate() ? " != " : " == ") << ImmVal; in expandCheckImmOperand()
49 void PredicateExpander::expandCheckImmOperandSimple(raw_ostream &OS, in expandCheckImmOperandSimple() argument
53 OS << "!"; in expandCheckImmOperandSimple()
55 OS << FunctionMapper << "("; in expandCheckImmOperandSimple()
56 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckImmOperandSimple()
59 OS << ")"; in expandCheckImmOperandSimple()
62 void PredicateExpander::expandCheckImmOperandLT(raw_ostream &OS, int OpIndex, in expandCheckImmOperandLT() argument
66 OS << FunctionMapper << "("; in expandCheckImmOperandLT()
67 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckImmOperandLT()
70 OS << ")"; in expandCheckImmOperandLT()
71 OS << (shouldNegate() ? " >= " : " < ") << ImmVal; in expandCheckImmOperandLT()
74 void PredicateExpander::expandCheckImmOperandGT(raw_ostream &OS, int OpIndex, in expandCheckImmOperandGT() argument
78 OS << FunctionMapper << "("; in expandCheckImmOperandGT()
79 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckImmOperandGT()
82 OS << ")"; in expandCheckImmOperandGT()
83 OS << (shouldNegate() ? " <= " : " > ") << ImmVal; in expandCheckImmOperandGT()
86 void PredicateExpander::expandCheckRegOperand(raw_ostream &OS, int OpIndex, in expandCheckRegOperand() argument
92 OS << FunctionMapper << "("; in expandCheckRegOperand()
93 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckRegOperand()
96 OS << ")"; in expandCheckRegOperand()
97 OS << (shouldNegate() ? " != " : " == "); in expandCheckRegOperand()
100 OS << Str << "::"; in expandCheckRegOperand()
101 OS << Reg->getName(); in expandCheckRegOperand()
104 void PredicateExpander::expandCheckRegOperandSimple(raw_ostream &OS, in expandCheckRegOperandSimple() argument
108 OS << "!"; in expandCheckRegOperandSimple()
110 OS << FunctionMapper << "("; in expandCheckRegOperandSimple()
111 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckRegOperandSimple()
114 OS << ")"; in expandCheckRegOperandSimple()
117 void PredicateExpander::expandCheckInvalidRegOperand(raw_ostream &OS, in expandCheckInvalidRegOperand() argument
119 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckInvalidRegOperand()
123 void PredicateExpander::expandCheckSameRegOperand(raw_ostream &OS, int First, in expandCheckSameRegOperand() argument
125 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << First in expandCheckSameRegOperand()
130 void PredicateExpander::expandCheckNumOperands(raw_ostream &OS, int NumOps) { in expandCheckNumOperands() argument
131 OS << "MI" << (isByRef() ? "." : "->") << "getNumOperands() " in expandCheckNumOperands()
135 void PredicateExpander::expandCheckOpcode(raw_ostream &OS, const Record *Inst) { in expandCheckOpcode() argument
136 OS << "MI" << (isByRef() ? "." : "->") << "getOpcode() " in expandCheckOpcode()
141 void PredicateExpander::expandCheckOpcode(raw_ostream &OS, in expandCheckOpcode() argument
147 OS << "( "; in expandCheckOpcode()
148 expandCheckOpcode(OS, Opcodes[0]); in expandCheckOpcode()
149 OS << " )"; in expandCheckOpcode()
153 OS << '('; in expandCheckOpcode()
156 OS << '\n'; in expandCheckOpcode()
157 OS.indent(getIndentLevel() * 2); in expandCheckOpcode()
159 OS << (shouldNegate() ? "&& " : "|| "); in expandCheckOpcode()
161 expandCheckOpcode(OS, Rec); in expandCheckOpcode()
165 OS << '\n'; in expandCheckOpcode()
167 OS.indent(getIndentLevel() * 2); in expandCheckOpcode()
168 OS << ')'; in expandCheckOpcode()
171 void PredicateExpander::expandCheckPseudo(raw_ostream &OS, in expandCheckPseudo() argument
174 expandFalse(OS); in expandCheckPseudo()
176 expandCheckOpcode(OS, Opcodes); in expandCheckPseudo()
179 void PredicateExpander::expandPredicateSequence(raw_ostream &OS, in expandPredicateSequence() argument
184 return expandPredicate(OS, Sequence[0]); in expandPredicateSequence()
188 OS << (shouldNegate() ? "!(" : "("); in expandPredicateSequence()
194 OS << '\n'; in expandPredicateSequence()
195 OS.indent(getIndentLevel() * 2); in expandPredicateSequence()
197 OS << (IsCheckAll ? "&& " : "|| "); in expandPredicateSequence()
198 expandPredicate(OS, Rec); in expandPredicateSequence()
201 OS << '\n'; in expandPredicateSequence()
203 OS.indent(getIndentLevel() * 2); in expandPredicateSequence()
204 OS << ')'; in expandPredicateSequence()
208 void PredicateExpander::expandTIIFunctionCall(raw_ostream &OS, in expandTIIFunctionCall() argument
210 OS << (shouldNegate() ? "!" : ""); in expandTIIFunctionCall()
211 OS << TargetName << (shouldExpandForMC() ? "_MC::" : "InstrInfo::"); in expandTIIFunctionCall()
212 OS << MethodName << (isByRef() ? "(MI)" : "(*MI)"); in expandTIIFunctionCall()
215 void PredicateExpander::expandCheckIsRegOperand(raw_ostream &OS, int OpIndex) { in expandCheckIsRegOperand() argument
216 OS << (shouldNegate() ? "!" : "") << "MI" << (isByRef() ? "." : "->") in expandCheckIsRegOperand()
220 void PredicateExpander::expandCheckIsVRegOperand(raw_ostream &OS, int OpIndex) { in expandCheckIsVRegOperand() argument
221 OS << (shouldNegate() ? "!" : "") << "MI" << (isByRef() ? "." : "->") in expandCheckIsVRegOperand()
225 void PredicateExpander::expandCheckIsImmOperand(raw_ostream &OS, int OpIndex) { in expandCheckIsImmOperand() argument
226 OS << (shouldNegate() ? "!" : "") << "MI" << (isByRef() ? "." : "->") in expandCheckIsImmOperand()
231 raw_ostream &OS, StringRef MCInstFn, StringRef MachineInstrFn, in expandCheckFunctionPredicateWithTII() argument
234 OS << (TIIPtr.empty() ? "TII" : TIIPtr) << "->" << MachineInstrFn; in expandCheckFunctionPredicateWithTII()
235 OS << (isByRef() ? "(MI)" : "(*MI)"); in expandCheckFunctionPredicateWithTII()
239 OS << MCInstFn << (isByRef() ? "(MI" : "(*MI") << ", MCII)"; in expandCheckFunctionPredicateWithTII()
242 void PredicateExpander::expandCheckFunctionPredicate(raw_ostream &OS, in expandCheckFunctionPredicate() argument
245 OS << (shouldExpandForMC() ? MCInstFn : MachineInstrFn) in expandCheckFunctionPredicate()
249 void PredicateExpander::expandCheckNonPortable(raw_ostream &OS, in expandCheckNonPortable() argument
252 return expandFalse(OS); in expandCheckNonPortable()
254 OS << '(' << Code << ')'; in expandCheckNonPortable()
257 void PredicateExpander::expandReturnStatement(raw_ostream &OS, in expandReturnStatement() argument
265 OS << Buffer; in expandReturnStatement()
268 void PredicateExpander::expandOpcodeSwitchCase(raw_ostream &OS, in expandOpcodeSwitchCase() argument
272 OS.indent(getIndentLevel() * 2); in expandOpcodeSwitchCase()
273 OS << "case " << Opcode->getValueAsString("Namespace") in expandOpcodeSwitchCase()
278 OS.indent(getIndentLevel() * 2); in expandOpcodeSwitchCase()
279 expandStatement(OS, Rec->getValueAsDef("CaseStmt")); in expandOpcodeSwitchCase()
283 void PredicateExpander::expandOpcodeSwitchStatement(raw_ostream &OS, in expandOpcodeSwitchStatement() argument
307 OS << Buffer; in expandOpcodeSwitchStatement()
310 void PredicateExpander::expandStatement(raw_ostream &OS, const Record *Rec) { in expandStatement() argument
313 expandOpcodeSwitchStatement(OS, Rec->getValueAsListOfDefs("Cases"), in expandStatement()
319 expandReturnStatement(OS, Rec->getValueAsDef("Pred")); in expandStatement()
326 void PredicateExpander::expandPredicate(raw_ostream &OS, const Record *Rec) { in expandPredicate() argument
330 return expandFalse(OS); in expandPredicate()
331 return expandTrue(OS); in expandPredicate()
336 return expandTrue(OS); in expandPredicate()
337 return expandFalse(OS); in expandPredicate()
342 expandPredicate(OS, Rec->getValueAsDef("Pred")); in expandPredicate()
348 return expandCheckIsRegOperand(OS, Rec->getValueAsInt("OpIndex")); in expandPredicate()
351 return expandCheckIsVRegOperand(OS, Rec->getValueAsInt("OpIndex")); in expandPredicate()
354 return expandCheckIsImmOperand(OS, Rec->getValueAsInt("OpIndex")); in expandPredicate()
357 return expandCheckRegOperand(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
362 return expandCheckRegOperandSimple(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
366 return expandCheckInvalidRegOperand(OS, Rec->getValueAsInt("OpIndex")); in expandPredicate()
369 return expandCheckImmOperand(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
374 return expandCheckImmOperand(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
379 return expandCheckImmOperandLT(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
384 return expandCheckImmOperandGT(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
389 return expandCheckImmOperandSimple(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
393 return expandCheckSameRegOperand(OS, Rec->getValueAsInt("FirstIndex"), in expandPredicate()
397 return expandCheckNumOperands(OS, Rec->getValueAsInt("NumOps")); in expandPredicate()
400 return expandCheckPseudo(OS, Rec->getValueAsListOfDefs("ValidOpcodes")); in expandPredicate()
403 return expandCheckOpcode(OS, Rec->getValueAsListOfDefs("ValidOpcodes")); in expandPredicate()
406 return expandPredicateSequence(OS, Rec->getValueAsListOfDefs("Predicates"), in expandPredicate()
410 return expandPredicateSequence(OS, Rec->getValueAsListOfDefs("Predicates"), in expandPredicate()
415 OS, Rec->getValueAsString("MCInstFnName"), in expandPredicate()
421 OS, Rec->getValueAsString("MCInstFnName"), in expandPredicate()
427 return expandCheckNonPortable(OS, Rec->getValueAsString("CodeBlock")); in expandPredicate()
430 return expandTIIFunctionCall(OS, Rec->getValueAsString("FunctionName")); in expandPredicate()
435 void STIPredicateExpander::expandHeader(raw_ostream &OS, in expandHeader() argument
440 OS.indent(getIndentLevel() * 2); in expandHeader()
441 OS << "bool "; in expandHeader()
443 OS << getClassPrefix() << "::"; in expandHeader()
444 OS << FunctionName << "("; in expandHeader()
446 OS << "const MCInst " << (isByRef() ? "&" : "*") << "MI"; in expandHeader()
448 OS << "const MachineInstr " << (isByRef() ? "&" : "*") << "MI"; in expandHeader()
450 OS << ", APInt &Mask"; in expandHeader()
451 OS << (shouldExpandForMC() ? ", unsigned ProcessorID) const " : ") const "); in expandHeader()
453 OS << "{\n"; in expandHeader()
458 OS << "override"; in expandHeader()
459 OS << ";\n"; in expandHeader()
462 void STIPredicateExpander::expandPrologue(raw_ostream &OS, in expandPrologue() argument
471 OS.indent(IndentLevel * 2); in expandPrologue()
472 OS << "if (" << Delegate->getValueAsString("Name") << "(MI"; in expandPrologue()
474 OS << ", Mask"; in expandPrologue()
476 OS << ", ProcessorID"; in expandPrologue()
477 OS << "))\n"; in expandPrologue()
478 OS.indent((1 + IndentLevel) * 2); in expandPrologue()
479 OS << "return true;\n\n"; in expandPrologue()
485 OS.indent(IndentLevel * 2); in expandPrologue()
486 OS << "unsigned ProcessorID = getSchedModel().getProcessorID();\n"; in expandPrologue()
489 void STIPredicateExpander::expandOpcodeGroup(raw_ostream &OS, in expandOpcodeGroup() argument
501 OS.indent(getIndentLevel() * 2); in expandOpcodeGroup()
502 OS << "if (ProcessorID == " << I; in expandOpcodeGroup()
504 OS << " || ProcessorID == " << I; in expandOpcodeGroup()
509 OS << ") {\n"; in expandOpcodeGroup()
512 OS.indent(getIndentLevel() * 2); in expandOpcodeGroup()
515 OS << "Mask.clearAllBits();\n"; in expandOpcodeGroup()
517 OS << "Mask = " << PI.OperandMask << ";\n"; in expandOpcodeGroup()
518 OS.indent(getIndentLevel() * 2); in expandOpcodeGroup()
520 OS << "return "; in expandOpcodeGroup()
521 expandPredicate(OS, PI.Predicate); in expandOpcodeGroup()
522 OS << ";\n"; in expandOpcodeGroup()
524 OS.indent(getIndentLevel() * 2); in expandOpcodeGroup()
525 OS << "}\n"; in expandOpcodeGroup()
529 void STIPredicateExpander::expandBody(raw_ostream &OS, in expandBody() argument
535 OS.indent(IndentLevel * 2); in expandBody()
536 OS << "switch(MI" << (isByRef() ? "." : "->") << "getOpcode()) {\n"; in expandBody()
537 OS.indent(IndentLevel * 2); in expandBody()
538 OS << "default:\n"; in expandBody()
539 OS.indent(IndentLevel * 2); in expandBody()
540 OS << " break;"; in expandBody()
544 OS << '\n'; in expandBody()
545 OS.indent(IndentLevel * 2); in expandBody()
546 OS << "case " << getTargetName() << "::" << Opcode->getName() << ":"; in expandBody()
549 OS << '\n'; in expandBody()
551 expandOpcodeGroup(OS, Group, UpdatesOpcodeMask); in expandBody()
553 OS.indent(getIndentLevel() * 2); in expandBody()
554 OS << "break;\n"; in expandBody()
558 OS.indent(IndentLevel * 2); in expandBody()
559 OS << "}\n"; in expandBody()
562 void STIPredicateExpander::expandEpilogue(raw_ostream &OS, in expandEpilogue() argument
564 OS << '\n'; in expandEpilogue()
565 OS.indent(getIndentLevel() * 2); in expandEpilogue()
566 OS << "return "; in expandEpilogue()
567 expandPredicate(OS, Fn.getDefaultReturnPredicate()); in expandEpilogue()
568 OS << ";\n"; in expandEpilogue()
571 OS.indent(getIndentLevel() * 2); in expandEpilogue()
573 OS << "} // " << ClassPrefix << "::" << FunctionName << "\n\n"; in expandEpilogue()
576 void STIPredicateExpander::expandSTIPredicate(raw_ostream &OS, in expandSTIPredicate() argument
582 expandHeader(OS, Fn); in expandSTIPredicate()
584 expandPrologue(OS, Fn); in expandSTIPredicate()
585 expandBody(OS, Fn); in expandSTIPredicate()
586 expandEpilogue(OS, Fn); in expandSTIPredicate()