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::expandCheckRegOperand(raw_ostream &OS, int OpIndex, in expandCheckRegOperand() argument
68 OS << FunctionMapper << "("; in expandCheckRegOperand()
69 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckRegOperand()
72 OS << ")"; in expandCheckRegOperand()
73 OS << (shouldNegate() ? " != " : " == "); in expandCheckRegOperand()
76 OS << Str << "::"; in expandCheckRegOperand()
77 OS << Reg->getName(); in expandCheckRegOperand()
81 void PredicateExpander::expandCheckRegOperandSimple(raw_ostream &OS, in expandCheckRegOperandSimple() argument
85 OS << "!"; in expandCheckRegOperandSimple()
87 OS << FunctionMapper << "("; in expandCheckRegOperandSimple()
88 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckRegOperandSimple()
91 OS << ")"; in expandCheckRegOperandSimple()
94 void PredicateExpander::expandCheckInvalidRegOperand(raw_ostream &OS, in expandCheckInvalidRegOperand() argument
96 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << OpIndex in expandCheckInvalidRegOperand()
100 void PredicateExpander::expandCheckSameRegOperand(raw_ostream &OS, int First, in expandCheckSameRegOperand() argument
102 OS << "MI" << (isByRef() ? "." : "->") << "getOperand(" << First in expandCheckSameRegOperand()
107 void PredicateExpander::expandCheckNumOperands(raw_ostream &OS, int NumOps) { in expandCheckNumOperands() argument
108 OS << "MI" << (isByRef() ? "." : "->") << "getNumOperands() " in expandCheckNumOperands()
112 void PredicateExpander::expandCheckOpcode(raw_ostream &OS, const Record *Inst) { in expandCheckOpcode() argument
113 OS << "MI" << (isByRef() ? "." : "->") << "getOpcode() " in expandCheckOpcode()
118 void PredicateExpander::expandCheckOpcode(raw_ostream &OS, in expandCheckOpcode() argument
124 OS << "( "; in expandCheckOpcode()
125 expandCheckOpcode(OS, Opcodes[0]); in expandCheckOpcode()
126 OS << " )"; in expandCheckOpcode()
130 OS << '('; in expandCheckOpcode()
133 OS << '\n'; in expandCheckOpcode()
134 OS.indent(getIndentLevel() * 2); in expandCheckOpcode()
136 OS << (shouldNegate() ? "&& " : "|| "); in expandCheckOpcode()
138 expandCheckOpcode(OS, Rec); in expandCheckOpcode()
142 OS << '\n'; in expandCheckOpcode()
144 OS.indent(getIndentLevel() * 2); in expandCheckOpcode()
145 OS << ')'; in expandCheckOpcode()
148 void PredicateExpander::expandCheckPseudo(raw_ostream &OS, in expandCheckPseudo() argument
151 expandFalse(OS); in expandCheckPseudo()
153 expandCheckOpcode(OS, Opcodes); in expandCheckPseudo()
156 void PredicateExpander::expandPredicateSequence(raw_ostream &OS, in expandPredicateSequence() argument
161 return expandPredicate(OS, Sequence[0]); in expandPredicateSequence()
165 OS << (shouldNegate() ? "!(" : "("); in expandPredicateSequence()
171 OS << '\n'; in expandPredicateSequence()
172 OS.indent(getIndentLevel() * 2); in expandPredicateSequence()
174 OS << (IsCheckAll ? "&& " : "|| "); in expandPredicateSequence()
175 expandPredicate(OS, Rec); in expandPredicateSequence()
178 OS << '\n'; in expandPredicateSequence()
180 OS.indent(getIndentLevel() * 2); in expandPredicateSequence()
181 OS << ')'; in expandPredicateSequence()
185 void PredicateExpander::expandTIIFunctionCall(raw_ostream &OS, in expandTIIFunctionCall() argument
187 OS << (shouldNegate() ? "!" : ""); in expandTIIFunctionCall()
188 OS << TargetName << (shouldExpandForMC() ? "_MC::" : "InstrInfo::"); in expandTIIFunctionCall()
189 OS << MethodName << (isByRef() ? "(MI)" : "(*MI)"); in expandTIIFunctionCall()
192 void PredicateExpander::expandCheckIsRegOperand(raw_ostream &OS, int OpIndex) { in expandCheckIsRegOperand() argument
193 OS << (shouldNegate() ? "!" : "") << "MI" << (isByRef() ? "." : "->") in expandCheckIsRegOperand()
197 void PredicateExpander::expandCheckIsImmOperand(raw_ostream &OS, int OpIndex) { in expandCheckIsImmOperand() argument
198 OS << (shouldNegate() ? "!" : "") << "MI" << (isByRef() ? "." : "->") in expandCheckIsImmOperand()
202 void PredicateExpander::expandCheckFunctionPredicate(raw_ostream &OS, in expandCheckFunctionPredicate() argument
205 OS << (shouldExpandForMC() ? MCInstFn : MachineInstrFn) in expandCheckFunctionPredicate()
209 void PredicateExpander::expandCheckNonPortable(raw_ostream &OS, in expandCheckNonPortable() argument
212 return expandFalse(OS); in expandCheckNonPortable()
214 OS << '(' << Code << ')'; in expandCheckNonPortable()
217 void PredicateExpander::expandReturnStatement(raw_ostream &OS, in expandReturnStatement() argument
226 OS << Buffer; in expandReturnStatement()
229 void PredicateExpander::expandOpcodeSwitchCase(raw_ostream &OS, in expandOpcodeSwitchCase() argument
233 OS.indent(getIndentLevel() * 2); in expandOpcodeSwitchCase()
234 OS << "case " << Opcode->getValueAsString("Namespace") in expandOpcodeSwitchCase()
239 OS.indent(getIndentLevel() * 2); in expandOpcodeSwitchCase()
240 expandStatement(OS, Rec->getValueAsDef("CaseStmt")); in expandOpcodeSwitchCase()
244 void PredicateExpander::expandOpcodeSwitchStatement(raw_ostream &OS, in expandOpcodeSwitchStatement() argument
269 OS << Buffer; in expandOpcodeSwitchStatement()
272 void PredicateExpander::expandStatement(raw_ostream &OS, const Record *Rec) { in expandStatement() argument
275 expandOpcodeSwitchStatement(OS, Rec->getValueAsListOfDefs("Cases"), in expandStatement()
281 expandReturnStatement(OS, Rec->getValueAsDef("Pred")); in expandStatement()
288 void PredicateExpander::expandPredicate(raw_ostream &OS, const Record *Rec) { in expandPredicate() argument
292 return expandFalse(OS); in expandPredicate()
293 return expandTrue(OS); in expandPredicate()
298 return expandTrue(OS); in expandPredicate()
299 return expandFalse(OS); in expandPredicate()
304 expandPredicate(OS, Rec->getValueAsDef("Pred")); in expandPredicate()
310 return expandCheckIsRegOperand(OS, Rec->getValueAsInt("OpIndex")); in expandPredicate()
313 return expandCheckIsImmOperand(OS, Rec->getValueAsInt("OpIndex")); in expandPredicate()
316 return expandCheckRegOperand(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
321 return expandCheckRegOperandSimple(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
325 return expandCheckInvalidRegOperand(OS, Rec->getValueAsInt("OpIndex")); in expandPredicate()
328 return expandCheckImmOperand(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
333 return expandCheckImmOperand(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
338 return expandCheckImmOperandSimple(OS, Rec->getValueAsInt("OpIndex"), in expandPredicate()
342 return expandCheckSameRegOperand(OS, Rec->getValueAsInt("FirstIndex"), in expandPredicate()
346 return expandCheckNumOperands(OS, Rec->getValueAsInt("NumOps")); in expandPredicate()
349 return expandCheckPseudo(OS, Rec->getValueAsListOfDefs("ValidOpcodes")); in expandPredicate()
352 return expandCheckOpcode(OS, Rec->getValueAsListOfDefs("ValidOpcodes")); in expandPredicate()
355 return expandPredicateSequence(OS, Rec->getValueAsListOfDefs("Predicates"), in expandPredicate()
359 return expandPredicateSequence(OS, Rec->getValueAsListOfDefs("Predicates"), in expandPredicate()
364 OS, Rec->getValueAsString("MCInstFnName"), in expandPredicate()
368 return expandCheckNonPortable(OS, Rec->getValueAsString("CodeBlock")); in expandPredicate()
371 return expandTIIFunctionCall(OS, Rec->getValueAsString("FunctionName")); in expandPredicate()
376 void STIPredicateExpander::expandHeader(raw_ostream &OS, in expandHeader() argument
381 OS.indent(getIndentLevel() * 2); in expandHeader()
382 OS << "bool "; in expandHeader()
384 OS << getClassPrefix() << "::"; in expandHeader()
385 OS << FunctionName << "("; in expandHeader()
387 OS << "const MCInst " << (isByRef() ? "&" : "*") << "MI"; in expandHeader()
389 OS << "const MachineInstr " << (isByRef() ? "&" : "*") << "MI"; in expandHeader()
391 OS << ", APInt &Mask"; in expandHeader()
392 OS << (shouldExpandForMC() ? ", unsigned ProcessorID) const " : ") const "); in expandHeader()
394 OS << "{\n"; in expandHeader()
399 OS << "override"; in expandHeader()
400 OS << ";\n"; in expandHeader()
403 void STIPredicateExpander::expandPrologue(raw_ostream &OS, in expandPrologue() argument
412 OS.indent(IndentLevel * 2); in expandPrologue()
413 OS << "if (" << Delegate->getValueAsString("Name") << "(MI"; in expandPrologue()
415 OS << ", Mask"; in expandPrologue()
417 OS << ", ProcessorID"; in expandPrologue()
418 OS << "))\n"; in expandPrologue()
419 OS.indent((1 + IndentLevel) * 2); in expandPrologue()
420 OS << "return true;\n\n"; in expandPrologue()
426 OS.indent(IndentLevel * 2); in expandPrologue()
427 OS << "unsigned ProcessorID = getSchedModel().getProcessorID();\n"; in expandPrologue()
430 void STIPredicateExpander::expandOpcodeGroup(raw_ostream &OS, const OpcodeGroup &Group, in expandOpcodeGroup() argument
441 OS.indent(getIndentLevel() * 2); in expandOpcodeGroup()
442 OS << "if (ProcessorID == " << I; in expandOpcodeGroup()
444 OS << " || ProcessorID == " << I; in expandOpcodeGroup()
449 OS << ") {\n"; in expandOpcodeGroup()
452 OS.indent(getIndentLevel() * 2); in expandOpcodeGroup()
455 OS << "Mask.clearAllBits();\n"; in expandOpcodeGroup()
457 OS << "Mask = " << PI.OperandMask << ";\n"; in expandOpcodeGroup()
458 OS.indent(getIndentLevel() * 2); in expandOpcodeGroup()
460 OS << "return "; in expandOpcodeGroup()
461 expandPredicate(OS, PI.Predicate); in expandOpcodeGroup()
462 OS << ";\n"; in expandOpcodeGroup()
464 OS.indent(getIndentLevel() * 2); in expandOpcodeGroup()
465 OS << "}\n"; in expandOpcodeGroup()
469 void STIPredicateExpander::expandBody(raw_ostream &OS, in expandBody() argument
475 OS.indent(IndentLevel * 2); in expandBody()
476 OS << "switch(MI" << (isByRef() ? "." : "->") << "getOpcode()) {\n"; in expandBody()
477 OS.indent(IndentLevel * 2); in expandBody()
478 OS << "default:\n"; in expandBody()
479 OS.indent(IndentLevel * 2); in expandBody()
480 OS << " break;"; in expandBody()
484 OS << '\n'; in expandBody()
485 OS.indent(IndentLevel * 2); in expandBody()
486 OS << "case " << getTargetName() << "::" << Opcode->getName() << ":"; in expandBody()
489 OS << '\n'; in expandBody()
491 expandOpcodeGroup(OS, Group, UpdatesOpcodeMask); in expandBody()
493 OS.indent(getIndentLevel() * 2); in expandBody()
494 OS << "break;\n"; in expandBody()
498 OS.indent(IndentLevel * 2); in expandBody()
499 OS << "}\n"; in expandBody()
502 void STIPredicateExpander::expandEpilogue(raw_ostream &OS, in expandEpilogue() argument
504 OS << '\n'; in expandEpilogue()
505 OS.indent(getIndentLevel() * 2); in expandEpilogue()
506 OS << "return "; in expandEpilogue()
507 expandPredicate(OS, Fn.getDefaultReturnPredicate()); in expandEpilogue()
508 OS << ";\n"; in expandEpilogue()
511 OS.indent(getIndentLevel() * 2); in expandEpilogue()
513 OS << "} // " << ClassPrefix << "::" << FunctionName << "\n\n"; in expandEpilogue()
516 void STIPredicateExpander::expandSTIPredicate(raw_ostream &OS, in expandSTIPredicate() argument
522 expandHeader(OS, Fn); in expandSTIPredicate()
524 expandPrologue(OS, Fn); in expandSTIPredicate()
525 expandBody(OS, Fn); in expandSTIPredicate()
526 expandEpilogue(OS, Fn); in expandSTIPredicate()