Lines Matching refs:OS

18 void PredicateExpander::expandTrue(raw_ostream &OS) { OS << "true"; }  in expandTrue()  argument
19 void PredicateExpander::expandFalse(raw_ostream &OS) { OS << "false"; } in expandFalse() argument
21 void PredicateExpander::expandCheckImmOperand(raw_ostream &OS, int OpIndex, in expandCheckImmOperand() argument
25 OS << FunctionMapper << "("; in expandCheckImmOperand()
26 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckImmOperand()
29 OS << ")"; in expandCheckImmOperand()
30 OS << (shouldNegate() ? " != " : " == ") << ImmVal; in expandCheckImmOperand()
33 void PredicateExpander::expandCheckImmOperand(raw_ostream &OS, int OpIndex, in expandCheckImmOperand() argument
37 expandCheckImmOperandSimple(OS, OpIndex, FunctionMapper); in expandCheckImmOperand()
40 OS << FunctionMapper << "("; in expandCheckImmOperand()
41 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckImmOperand()
44 OS << ")"; in expandCheckImmOperand()
45 OS << (shouldNegate() ? " != " : " == ") << ImmVal; in expandCheckImmOperand()
48 void PredicateExpander::expandCheckImmOperandSimple(raw_ostream &OS, in expandCheckImmOperandSimple() argument
52 OS << "!"; in expandCheckImmOperandSimple()
54 OS << FunctionMapper << "("; in expandCheckImmOperandSimple()
55 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckImmOperandSimple()
58 OS << ")"; in expandCheckImmOperandSimple()
61 void PredicateExpander::expandCheckRegOperand(raw_ostream &OS, int OpIndex, in expandCheckRegOperand() argument
67 OS << FunctionMapper << "("; in expandCheckRegOperand()
68 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckRegOperand()
71 OS << ")"; in expandCheckRegOperand()
72 OS << (shouldNegate() ? " != " : " == "); in expandCheckRegOperand()
75 OS << Str << "::"; in expandCheckRegOperand()
76 OS << Reg->getName(); in expandCheckRegOperand()
80 void PredicateExpander::expandCheckRegOperandSimple(raw_ostream &OS, in expandCheckRegOperandSimple() argument
84 OS << "!"; in expandCheckRegOperandSimple()
86 OS << FunctionMapper << "("; in expandCheckRegOperandSimple()
87 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckRegOperandSimple()
90 OS << ")"; in expandCheckRegOperandSimple()
93 void PredicateExpander::expandCheckInvalidRegOperand(raw_ostream &OS, in expandCheckInvalidRegOperand() argument
95 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckInvalidRegOperand()
99 void PredicateExpander::expandCheckSameRegOperand(raw_ostream &OS, int First, in expandCheckSameRegOperand() argument
101 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << First in expandCheckSameRegOperand()
106 void PredicateExpander::expandCheckNumOperands(raw_ostream &OS, int NumOps) { in expandCheckNumOperands() argument
107 OS << "MI" << (isByRef() ? "." : "->") << "getNumOperands() " in expandCheckNumOperands()
111 void PredicateExpander::expandCheckOpcode(raw_ostream &OS, const Record *Inst) { in expandCheckOpcode() argument
112 OS << "MI" << (isByRef() ? "." : "->") << "getOpcode() " in expandCheckOpcode()
117 void PredicateExpander::expandCheckOpcode(raw_ostream &OS, in expandCheckOpcode() argument
123 OS << "( "; in expandCheckOpcode()
124 expandCheckOpcode(OS, Opcodes[0]); in expandCheckOpcode()
125 OS << " )"; in expandCheckOpcode()
129 OS << '('; in expandCheckOpcode()
132 OS << '\n'; in expandCheckOpcode()
133 OS.indent(getIndentLevel() * 2); in expandCheckOpcode()
135 OS << (shouldNegate() ? "&& " : "|| "); in expandCheckOpcode()
137 expandCheckOpcode(OS, Rec); in expandCheckOpcode()
141 OS << '\n'; in expandCheckOpcode()
143 OS.indent(getIndentLevel() * 2); in expandCheckOpcode()
144 OS << ')'; in expandCheckOpcode()
147 void PredicateExpander::expandCheckPseudo(raw_ostream &OS, in expandCheckPseudo() argument
150 expandFalse(OS); in expandCheckPseudo()
152 expandCheckOpcode(OS, Opcodes); in expandCheckPseudo()
155 void PredicateExpander::expandPredicateSequence(raw_ostream &OS, in expandPredicateSequence() argument
160 return expandPredicate(OS, Sequence[0]); in expandPredicateSequence()
164 OS << (shouldNegate() ? "!(" : "("); in expandPredicateSequence()
170 OS << '\n'; in expandPredicateSequence()
171 OS.indent(getIndentLevel() * 2); in expandPredicateSequence()
173 OS << (IsCheckAll ? "&& " : "|| "); in expandPredicateSequence()
174 expandPredicate(OS, Rec); in expandPredicateSequence()
177 OS << '\n'; in expandPredicateSequence()
179 OS.indent(getIndentLevel() * 2); in expandPredicateSequence()
180 OS << ')'; in expandPredicateSequence()
184 void PredicateExpander::expandTIIFunctionCall(raw_ostream &OS, in expandTIIFunctionCall() argument
186 OS << (shouldNegate() ? "!" : ""); in expandTIIFunctionCall()
187 OS << TargetName << (shouldExpandForMC() ? "_MC::" : "InstrInfo::"); in expandTIIFunctionCall()
188 OS << MethodName << (isByRef() ? "(MI)" : "(*MI)"); in expandTIIFunctionCall()
191 void PredicateExpander::expandCheckIsRegOperand(raw_ostream &OS, int OpIndex) { in expandCheckIsRegOperand() argument
192 OS << (shouldNegate() ? "!" : "") << "MI" << (isByRef() ? "." : "->") in expandCheckIsRegOperand()
196 void PredicateExpander::expandCheckIsImmOperand(raw_ostream &OS, int OpIndex) { in expandCheckIsImmOperand() argument
197 OS << (shouldNegate() ? "!" : "") << "MI" << (isByRef() ? "." : "->") in expandCheckIsImmOperand()
202 raw_ostream &OS, StringRef MCInstFn, StringRef MachineInstrFn, in expandCheckFunctionPredicateWithTII() argument
205 OS << (TIIPtr.empty() ? "TII" : TIIPtr) << "->" << MachineInstrFn; in expandCheckFunctionPredicateWithTII()
206 OS << (isByRef() ? "(MI)" : "(*MI)"); in expandCheckFunctionPredicateWithTII()
210 OS << MCInstFn << (isByRef() ? "(MI" : "(*MI") << ", MCII)"; in expandCheckFunctionPredicateWithTII()
213 void PredicateExpander::expandCheckFunctionPredicate(raw_ostream &OS, in expandCheckFunctionPredicate() argument
216 OS << (shouldExpandForMC() ? MCInstFn : MachineInstrFn) in expandCheckFunctionPredicate()
220 void PredicateExpander::expandCheckNonPortable(raw_ostream &OS, in expandCheckNonPortable() argument
223 return expandFalse(OS); in expandCheckNonPortable()
225 OS << '(' << Code << ')'; in expandCheckNonPortable()
228 void PredicateExpander::expandReturnStatement(raw_ostream &OS, in expandReturnStatement() argument
236 OS << Buffer; in expandReturnStatement()
239 void PredicateExpander::expandOpcodeSwitchCase(raw_ostream &OS, in expandOpcodeSwitchCase() argument
243 OS.indent(getIndentLevel() * 2); in expandOpcodeSwitchCase()
244 OS << "case " << Opcode->getValueAsString("Namespace") in expandOpcodeSwitchCase()
249 OS.indent(getIndentLevel() * 2); in expandOpcodeSwitchCase()
250 expandStatement(OS, Rec->getValueAsDef("CaseStmt")); in expandOpcodeSwitchCase()
254 void PredicateExpander::expandOpcodeSwitchStatement(raw_ostream &OS, in expandOpcodeSwitchStatement() argument
278 OS << Buffer; in expandOpcodeSwitchStatement()
281 void PredicateExpander::expandStatement(raw_ostream &OS, const Record *Rec) { in expandStatement() argument
284 expandOpcodeSwitchStatement(OS, Rec->getValueAsListOfDefs("Cases"), in expandStatement()
290 expandReturnStatement(OS, Rec->getValueAsDef("Pred")); in expandStatement()
297 void PredicateExpander::expandPredicate(raw_ostream &OS, const Record *Rec) { in expandPredicate() argument
301 return expandFalse(OS); in expandPredicate()
302 return expandTrue(OS); in expandPredicate()
307 return expandTrue(OS); in expandPredicate()
308 return expandFalse(OS); in expandPredicate()
313 expandPredicate(OS, Rec->getValueAsDef("Pred")); in expandPredicate()
319 return expandCheckIsRegOperand(OS, Rec->getValueAsInt("OpIndex")); in expandPredicate()
322 return expandCheckIsImmOperand(OS, Rec->getValueAsInt("OpIndex")); in expandPredicate()
325 return expandCheckRegOperand(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
330 return expandCheckRegOperandSimple(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
334 return expandCheckInvalidRegOperand(OS, Rec->getValueAsInt("OpIndex")); in expandPredicate()
337 return expandCheckImmOperand(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
342 return expandCheckImmOperand(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
347 return expandCheckImmOperandSimple(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
351 return expandCheckSameRegOperand(OS, Rec->getValueAsInt("FirstIndex"), in expandPredicate()
355 return expandCheckNumOperands(OS, Rec->getValueAsInt("NumOps")); in expandPredicate()
358 return expandCheckPseudo(OS, Rec->getValueAsListOfDefs("ValidOpcodes")); in expandPredicate()
361 return expandCheckOpcode(OS, Rec->getValueAsListOfDefs("ValidOpcodes")); in expandPredicate()
364 return expandPredicateSequence(OS, Rec->getValueAsListOfDefs("Predicates"), in expandPredicate()
368 return expandPredicateSequence(OS, Rec->getValueAsListOfDefs("Predicates"), in expandPredicate()
373 OS, Rec->getValueAsString("MCInstFnName"), in expandPredicate()
379 OS, Rec->getValueAsString("MCInstFnName"), in expandPredicate()
385 return expandCheckNonPortable(OS, Rec->getValueAsString("CodeBlock")); in expandPredicate()
388 return expandTIIFunctionCall(OS, Rec->getValueAsString("FunctionName")); in expandPredicate()
393 void STIPredicateExpander::expandHeader(raw_ostream &OS, in expandHeader() argument
398 OS.indent(getIndentLevel() * 2); in expandHeader()
399 OS << "bool "; in expandHeader()
401 OS << getClassPrefix() << "::"; in expandHeader()
402 OS << FunctionName << "("; in expandHeader()
404 OS << "const MCInst " << (isByRef() ? "&" : "*") << "MI"; in expandHeader()
406 OS << "const MachineInstr " << (isByRef() ? "&" : "*") << "MI"; in expandHeader()
408 OS << ", APInt &Mask"; in expandHeader()
409 OS << (shouldExpandForMC() ? ", unsigned ProcessorID) const " : ") const "); in expandHeader()
411 OS << "{\n"; in expandHeader()
416 OS << "override"; in expandHeader()
417 OS << ";\n"; in expandHeader()
420 void STIPredicateExpander::expandPrologue(raw_ostream &OS, in expandPrologue() argument
429 OS.indent(IndentLevel * 2); in expandPrologue()
430 OS << "if (" << Delegate->getValueAsString("Name") << "(MI"; in expandPrologue()
432 OS << ", Mask"; in expandPrologue()
434 OS << ", ProcessorID"; in expandPrologue()
435 OS << "))\n"; in expandPrologue()
436 OS.indent((1 + IndentLevel) * 2); in expandPrologue()
437 OS << "return true;\n\n"; in expandPrologue()
443 OS.indent(IndentLevel * 2); in expandPrologue()
444 OS << "unsigned ProcessorID = getSchedModel().getProcessorID();\n"; in expandPrologue()
447 void STIPredicateExpander::expandOpcodeGroup(raw_ostream &OS, const OpcodeGroup &Group, in expandOpcodeGroup() argument
458 OS.indent(getIndentLevel() * 2); in expandOpcodeGroup()
459 OS << "if (ProcessorID == " << I; in expandOpcodeGroup()
461 OS << " || ProcessorID == " << I; in expandOpcodeGroup()
466 OS << ") {\n"; in expandOpcodeGroup()
469 OS.indent(getIndentLevel() * 2); in expandOpcodeGroup()
472 OS << "Mask.clearAllBits();\n"; in expandOpcodeGroup()
474 OS << "Mask = " << PI.OperandMask << ";\n"; in expandOpcodeGroup()
475 OS.indent(getIndentLevel() * 2); in expandOpcodeGroup()
477 OS << "return "; in expandOpcodeGroup()
478 expandPredicate(OS, PI.Predicate); in expandOpcodeGroup()
479 OS << ";\n"; in expandOpcodeGroup()
481 OS.indent(getIndentLevel() * 2); in expandOpcodeGroup()
482 OS << "}\n"; in expandOpcodeGroup()
486 void STIPredicateExpander::expandBody(raw_ostream &OS, in expandBody() argument
492 OS.indent(IndentLevel * 2); in expandBody()
493 OS << "switch(MI" << (isByRef() ? "." : "->") << "getOpcode()) {\n"; in expandBody()
494 OS.indent(IndentLevel * 2); in expandBody()
495 OS << "default:\n"; in expandBody()
496 OS.indent(IndentLevel * 2); in expandBody()
497 OS << " break;"; in expandBody()
501 OS << '\n'; in expandBody()
502 OS.indent(IndentLevel * 2); in expandBody()
503 OS << "case " << getTargetName() << "::" << Opcode->getName() << ":"; in expandBody()
506 OS << '\n'; in expandBody()
508 expandOpcodeGroup(OS, Group, UpdatesOpcodeMask); in expandBody()
510 OS.indent(getIndentLevel() * 2); in expandBody()
511 OS << "break;\n"; in expandBody()
515 OS.indent(IndentLevel * 2); in expandBody()
516 OS << "}\n"; in expandBody()
519 void STIPredicateExpander::expandEpilogue(raw_ostream &OS, in expandEpilogue() argument
521 OS << '\n'; in expandEpilogue()
522 OS.indent(getIndentLevel() * 2); in expandEpilogue()
523 OS << "return "; in expandEpilogue()
524 expandPredicate(OS, Fn.getDefaultReturnPredicate()); in expandEpilogue()
525 OS << ";\n"; in expandEpilogue()
528 OS.indent(getIndentLevel() * 2); in expandEpilogue()
530 OS << "} // " << ClassPrefix << "::" << FunctionName << "\n\n"; in expandEpilogue()
533 void STIPredicateExpander::expandSTIPredicate(raw_ostream &OS, in expandSTIPredicate() argument
539 expandHeader(OS, Fn); in expandSTIPredicate()
541 expandPrologue(OS, Fn); in expandSTIPredicate()
542 expandBody(OS, Fn); in expandSTIPredicate()
543 expandEpilogue(OS, Fn); in expandSTIPredicate()