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()
105 void PredicateExpander::expandCheckRegOperandSimple(raw_ostream &OS, in expandCheckRegOperandSimple() argument
109 OS << "!"; in expandCheckRegOperandSimple()
111 OS << FunctionMapper << "("; in expandCheckRegOperandSimple()
112 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckRegOperandSimple()
115 OS << ")"; in expandCheckRegOperandSimple()
118 void PredicateExpander::expandCheckInvalidRegOperand(raw_ostream &OS, in expandCheckInvalidRegOperand() argument
120 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckInvalidRegOperand()
124 void PredicateExpander::expandCheckSameRegOperand(raw_ostream &OS, int First, in expandCheckSameRegOperand() argument
126 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << First in expandCheckSameRegOperand()
131 void PredicateExpander::expandCheckNumOperands(raw_ostream &OS, int NumOps) { in expandCheckNumOperands() argument
132 OS << "MI" << (isByRef() ? "." : "->") << "getNumOperands() " in expandCheckNumOperands()
136 void PredicateExpander::expandCheckOpcode(raw_ostream &OS, const Record *Inst) { in expandCheckOpcode() argument
137 OS << "MI" << (isByRef() ? "." : "->") << "getOpcode() " in expandCheckOpcode()
142 void PredicateExpander::expandCheckOpcode(raw_ostream &OS, in expandCheckOpcode() argument
148 OS << "( "; in expandCheckOpcode()
149 expandCheckOpcode(OS, Opcodes[0]); in expandCheckOpcode()
150 OS << " )"; in expandCheckOpcode()
154 OS << '('; in expandCheckOpcode()
157 OS << '\n'; in expandCheckOpcode()
158 OS.indent(getIndentLevel() * 2); in expandCheckOpcode()
160 OS << (shouldNegate() ? "&& " : "|| "); in expandCheckOpcode()
162 expandCheckOpcode(OS, Rec); in expandCheckOpcode()
166 OS << '\n'; in expandCheckOpcode()
168 OS.indent(getIndentLevel() * 2); in expandCheckOpcode()
169 OS << ')'; in expandCheckOpcode()
172 void PredicateExpander::expandCheckPseudo(raw_ostream &OS, in expandCheckPseudo() argument
175 expandFalse(OS); in expandCheckPseudo()
177 expandCheckOpcode(OS, Opcodes); in expandCheckPseudo()
180 void PredicateExpander::expandPredicateSequence(raw_ostream &OS, in expandPredicateSequence() argument
185 return expandPredicate(OS, Sequence[0]); in expandPredicateSequence()
189 OS << (shouldNegate() ? "!(" : "("); in expandPredicateSequence()
195 OS << '\n'; in expandPredicateSequence()
196 OS.indent(getIndentLevel() * 2); in expandPredicateSequence()
198 OS << (IsCheckAll ? "&& " : "|| "); in expandPredicateSequence()
199 expandPredicate(OS, Rec); in expandPredicateSequence()
202 OS << '\n'; in expandPredicateSequence()
204 OS.indent(getIndentLevel() * 2); in expandPredicateSequence()
205 OS << ')'; in expandPredicateSequence()
209 void PredicateExpander::expandTIIFunctionCall(raw_ostream &OS, in expandTIIFunctionCall() argument
211 OS << (shouldNegate() ? "!" : ""); in expandTIIFunctionCall()
212 OS << TargetName << (shouldExpandForMC() ? "_MC::" : "InstrInfo::"); in expandTIIFunctionCall()
213 OS << MethodName << (isByRef() ? "(MI)" : "(*MI)"); in expandTIIFunctionCall()
216 void PredicateExpander::expandCheckIsRegOperand(raw_ostream &OS, int OpIndex) { in expandCheckIsRegOperand() argument
217 OS << (shouldNegate() ? "!" : "") << "MI" << (isByRef() ? "." : "->") in expandCheckIsRegOperand()
221 void PredicateExpander::expandCheckIsVRegOperand(raw_ostream &OS, int OpIndex) { in expandCheckIsVRegOperand() argument
222 OS << (shouldNegate() ? "!" : "") << "MI" << (isByRef() ? "." : "->") in expandCheckIsVRegOperand()
226 void PredicateExpander::expandCheckIsImmOperand(raw_ostream &OS, int OpIndex) { in expandCheckIsImmOperand() argument
227 OS << (shouldNegate() ? "!" : "") << "MI" << (isByRef() ? "." : "->") in expandCheckIsImmOperand()
232 raw_ostream &OS, StringRef MCInstFn, StringRef MachineInstrFn, in expandCheckFunctionPredicateWithTII() argument
235 OS << (TIIPtr.empty() ? "TII" : TIIPtr) << "->" << MachineInstrFn; in expandCheckFunctionPredicateWithTII()
236 OS << (isByRef() ? "(MI)" : "(*MI)"); in expandCheckFunctionPredicateWithTII()
240 OS << MCInstFn << (isByRef() ? "(MI" : "(*MI") << ", MCII)"; in expandCheckFunctionPredicateWithTII()
243 void PredicateExpander::expandCheckFunctionPredicate(raw_ostream &OS, in expandCheckFunctionPredicate() argument
246 OS << (shouldExpandForMC() ? MCInstFn : MachineInstrFn) in expandCheckFunctionPredicate()
250 void PredicateExpander::expandCheckNonPortable(raw_ostream &OS, in expandCheckNonPortable() argument
253 return expandFalse(OS); in expandCheckNonPortable()
255 OS << '(' << Code << ')'; in expandCheckNonPortable()
258 void PredicateExpander::expandReturnStatement(raw_ostream &OS, in expandReturnStatement() argument
266 OS << Buffer; in expandReturnStatement()
269 void PredicateExpander::expandOpcodeSwitchCase(raw_ostream &OS, in expandOpcodeSwitchCase() argument
273 OS.indent(getIndentLevel() * 2); in expandOpcodeSwitchCase()
274 OS << "case " << Opcode->getValueAsString("Namespace") in expandOpcodeSwitchCase()
279 OS.indent(getIndentLevel() * 2); in expandOpcodeSwitchCase()
280 expandStatement(OS, Rec->getValueAsDef("CaseStmt")); in expandOpcodeSwitchCase()
284 void PredicateExpander::expandOpcodeSwitchStatement(raw_ostream &OS, in expandOpcodeSwitchStatement() argument
308 OS << Buffer; in expandOpcodeSwitchStatement()
311 void PredicateExpander::expandStatement(raw_ostream &OS, const Record *Rec) { in expandStatement() argument
314 expandOpcodeSwitchStatement(OS, Rec->getValueAsListOfDefs("Cases"), in expandStatement()
320 expandReturnStatement(OS, Rec->getValueAsDef("Pred")); in expandStatement()
327 void PredicateExpander::expandPredicate(raw_ostream &OS, const Record *Rec) { in expandPredicate() argument
331 return expandFalse(OS); in expandPredicate()
332 return expandTrue(OS); in expandPredicate()
337 return expandTrue(OS); in expandPredicate()
338 return expandFalse(OS); in expandPredicate()
343 expandPredicate(OS, Rec->getValueAsDef("Pred")); in expandPredicate()
349 return expandCheckIsRegOperand(OS, Rec->getValueAsInt("OpIndex")); in expandPredicate()
352 return expandCheckIsVRegOperand(OS, Rec->getValueAsInt("OpIndex")); in expandPredicate()
355 return expandCheckIsImmOperand(OS, Rec->getValueAsInt("OpIndex")); in expandPredicate()
358 return expandCheckRegOperand(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
363 return expandCheckRegOperandSimple(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
367 return expandCheckInvalidRegOperand(OS, Rec->getValueAsInt("OpIndex")); in expandPredicate()
370 return expandCheckImmOperand(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
375 return expandCheckImmOperand(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
380 return expandCheckImmOperandLT(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
385 return expandCheckImmOperandGT(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
390 return expandCheckImmOperandSimple(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
394 return expandCheckSameRegOperand(OS, Rec->getValueAsInt("FirstIndex"), in expandPredicate()
398 return expandCheckNumOperands(OS, Rec->getValueAsInt("NumOps")); in expandPredicate()
401 return expandCheckPseudo(OS, Rec->getValueAsListOfDefs("ValidOpcodes")); in expandPredicate()
404 return expandCheckOpcode(OS, Rec->getValueAsListOfDefs("ValidOpcodes")); in expandPredicate()
407 return expandPredicateSequence(OS, Rec->getValueAsListOfDefs("Predicates"), in expandPredicate()
411 return expandPredicateSequence(OS, Rec->getValueAsListOfDefs("Predicates"), in expandPredicate()
416 OS, Rec->getValueAsString("MCInstFnName"), in expandPredicate()
422 OS, Rec->getValueAsString("MCInstFnName"), in expandPredicate()
428 return expandCheckNonPortable(OS, Rec->getValueAsString("CodeBlock")); in expandPredicate()
431 return expandTIIFunctionCall(OS, Rec->getValueAsString("FunctionName")); in expandPredicate()
436 void STIPredicateExpander::expandHeader(raw_ostream &OS, in expandHeader() argument
441 OS.indent(getIndentLevel() * 2); in expandHeader()
442 OS << "bool "; in expandHeader()
444 OS << getClassPrefix() << "::"; in expandHeader()
445 OS << FunctionName << "("; in expandHeader()
447 OS << "const MCInst " << (isByRef() ? "&" : "*") << "MI"; in expandHeader()
449 OS << "const MachineInstr " << (isByRef() ? "&" : "*") << "MI"; in expandHeader()
451 OS << ", APInt &Mask"; in expandHeader()
452 OS << (shouldExpandForMC() ? ", unsigned ProcessorID) const " : ") const "); in expandHeader()
454 OS << "{\n"; in expandHeader()
459 OS << "override"; in expandHeader()
460 OS << ";\n"; in expandHeader()
463 void STIPredicateExpander::expandPrologue(raw_ostream &OS, in expandPrologue() argument
472 OS.indent(IndentLevel * 2); in expandPrologue()
473 OS << "if (" << Delegate->getValueAsString("Name") << "(MI"; in expandPrologue()
475 OS << ", Mask"; in expandPrologue()
477 OS << ", ProcessorID"; in expandPrologue()
478 OS << "))\n"; in expandPrologue()
479 OS.indent((1 + IndentLevel) * 2); in expandPrologue()
480 OS << "return true;\n\n"; in expandPrologue()
486 OS.indent(IndentLevel * 2); in expandPrologue()
487 OS << "unsigned ProcessorID = getSchedModel().getProcessorID();\n"; in expandPrologue()
490 void STIPredicateExpander::expandOpcodeGroup(raw_ostream &OS, const OpcodeGroup &Group, 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()