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
237 OS << Buffer; in expandReturnStatement()
240 void PredicateExpander::expandOpcodeSwitchCase(raw_ostream &OS, in expandOpcodeSwitchCase() argument
244 OS.indent(getIndentLevel() * 2); in expandOpcodeSwitchCase()
245 OS << "case " << Opcode->getValueAsString("Namespace") in expandOpcodeSwitchCase()
250 OS.indent(getIndentLevel() * 2); in expandOpcodeSwitchCase()
251 expandStatement(OS, Rec->getValueAsDef("CaseStmt")); in expandOpcodeSwitchCase()
255 void PredicateExpander::expandOpcodeSwitchStatement(raw_ostream &OS, in expandOpcodeSwitchStatement() argument
280 OS << Buffer; in expandOpcodeSwitchStatement()
283 void PredicateExpander::expandStatement(raw_ostream &OS, const Record *Rec) { in expandStatement() argument
286 expandOpcodeSwitchStatement(OS, Rec->getValueAsListOfDefs("Cases"), in expandStatement()
292 expandReturnStatement(OS, Rec->getValueAsDef("Pred")); in expandStatement()
299 void PredicateExpander::expandPredicate(raw_ostream &OS, const Record *Rec) { in expandPredicate() argument
303 return expandFalse(OS); in expandPredicate()
304 return expandTrue(OS); in expandPredicate()
309 return expandTrue(OS); in expandPredicate()
310 return expandFalse(OS); in expandPredicate()
315 expandPredicate(OS, Rec->getValueAsDef("Pred")); in expandPredicate()
321 return expandCheckIsRegOperand(OS, Rec->getValueAsInt("OpIndex")); in expandPredicate()
324 return expandCheckIsImmOperand(OS, Rec->getValueAsInt("OpIndex")); in expandPredicate()
327 return expandCheckRegOperand(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
332 return expandCheckRegOperandSimple(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
336 return expandCheckInvalidRegOperand(OS, Rec->getValueAsInt("OpIndex")); in expandPredicate()
339 return expandCheckImmOperand(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
344 return expandCheckImmOperand(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
349 return expandCheckImmOperandSimple(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
353 return expandCheckSameRegOperand(OS, Rec->getValueAsInt("FirstIndex"), in expandPredicate()
357 return expandCheckNumOperands(OS, Rec->getValueAsInt("NumOps")); in expandPredicate()
360 return expandCheckPseudo(OS, Rec->getValueAsListOfDefs("ValidOpcodes")); in expandPredicate()
363 return expandCheckOpcode(OS, Rec->getValueAsListOfDefs("ValidOpcodes")); in expandPredicate()
366 return expandPredicateSequence(OS, Rec->getValueAsListOfDefs("Predicates"), in expandPredicate()
370 return expandPredicateSequence(OS, Rec->getValueAsListOfDefs("Predicates"), in expandPredicate()
375 OS, Rec->getValueAsString("MCInstFnName"), in expandPredicate()
381 OS, Rec->getValueAsString("MCInstFnName"), in expandPredicate()
387 return expandCheckNonPortable(OS, Rec->getValueAsString("CodeBlock")); in expandPredicate()
390 return expandTIIFunctionCall(OS, Rec->getValueAsString("FunctionName")); in expandPredicate()
395 void STIPredicateExpander::expandHeader(raw_ostream &OS, in expandHeader() argument
400 OS.indent(getIndentLevel() * 2); in expandHeader()
401 OS << "bool "; in expandHeader()
403 OS << getClassPrefix() << "::"; in expandHeader()
404 OS << FunctionName << "("; in expandHeader()
406 OS << "const MCInst " << (isByRef() ? "&" : "*") << "MI"; in expandHeader()
408 OS << "const MachineInstr " << (isByRef() ? "&" : "*") << "MI"; in expandHeader()
410 OS << ", APInt &Mask"; in expandHeader()
411 OS << (shouldExpandForMC() ? ", unsigned ProcessorID) const " : ") const "); in expandHeader()
413 OS << "{\n"; in expandHeader()
418 OS << "override"; in expandHeader()
419 OS << ";\n"; in expandHeader()
422 void STIPredicateExpander::expandPrologue(raw_ostream &OS, in expandPrologue() argument
431 OS.indent(IndentLevel * 2); in expandPrologue()
432 OS << "if (" << Delegate->getValueAsString("Name") << "(MI"; in expandPrologue()
434 OS << ", Mask"; in expandPrologue()
436 OS << ", ProcessorID"; in expandPrologue()
437 OS << "))\n"; in expandPrologue()
438 OS.indent((1 + IndentLevel) * 2); in expandPrologue()
439 OS << "return true;\n\n"; in expandPrologue()
445 OS.indent(IndentLevel * 2); in expandPrologue()
446 OS << "unsigned ProcessorID = getSchedModel().getProcessorID();\n"; in expandPrologue()
449 void STIPredicateExpander::expandOpcodeGroup(raw_ostream &OS, const OpcodeGroup &Group, in expandOpcodeGroup() argument
460 OS.indent(getIndentLevel() * 2); in expandOpcodeGroup()
461 OS << "if (ProcessorID == " << I; in expandOpcodeGroup()
463 OS << " || ProcessorID == " << I; in expandOpcodeGroup()
468 OS << ") {\n"; in expandOpcodeGroup()
471 OS.indent(getIndentLevel() * 2); in expandOpcodeGroup()
474 OS << "Mask.clearAllBits();\n"; in expandOpcodeGroup()
476 OS << "Mask = " << PI.OperandMask << ";\n"; in expandOpcodeGroup()
477 OS.indent(getIndentLevel() * 2); in expandOpcodeGroup()
479 OS << "return "; in expandOpcodeGroup()
480 expandPredicate(OS, PI.Predicate); in expandOpcodeGroup()
481 OS << ";\n"; in expandOpcodeGroup()
483 OS.indent(getIndentLevel() * 2); in expandOpcodeGroup()
484 OS << "}\n"; in expandOpcodeGroup()
488 void STIPredicateExpander::expandBody(raw_ostream &OS, in expandBody() argument
494 OS.indent(IndentLevel * 2); in expandBody()
495 OS << "switch(MI" << (isByRef() ? "." : "->") << "getOpcode()) {\n"; in expandBody()
496 OS.indent(IndentLevel * 2); in expandBody()
497 OS << "default:\n"; in expandBody()
498 OS.indent(IndentLevel * 2); in expandBody()
499 OS << " break;"; in expandBody()
503 OS << '\n'; in expandBody()
504 OS.indent(IndentLevel * 2); in expandBody()
505 OS << "case " << getTargetName() << "::" << Opcode->getName() << ":"; in expandBody()
508 OS << '\n'; in expandBody()
510 expandOpcodeGroup(OS, Group, UpdatesOpcodeMask); in expandBody()
512 OS.indent(getIndentLevel() * 2); in expandBody()
513 OS << "break;\n"; in expandBody()
517 OS.indent(IndentLevel * 2); in expandBody()
518 OS << "}\n"; in expandBody()
521 void STIPredicateExpander::expandEpilogue(raw_ostream &OS, in expandEpilogue() argument
523 OS << '\n'; in expandEpilogue()
524 OS.indent(getIndentLevel() * 2); in expandEpilogue()
525 OS << "return "; in expandEpilogue()
526 expandPredicate(OS, Fn.getDefaultReturnPredicate()); in expandEpilogue()
527 OS << ";\n"; in expandEpilogue()
530 OS.indent(getIndentLevel() * 2); in expandEpilogue()
532 OS << "} // " << ClassPrefix << "::" << FunctionName << "\n\n"; in expandEpilogue()
535 void STIPredicateExpander::expandSTIPredicate(raw_ostream &OS, in expandSTIPredicate() argument
541 expandHeader(OS, Fn); in expandSTIPredicate()
543 expandPrologue(OS, Fn); in expandSTIPredicate()
544 expandBody(OS, Fn); in expandSTIPredicate()
545 expandEpilogue(OS, Fn); in expandSTIPredicate()