Lines Matching refs:os
64 raw_ostream &os, in interleaveCommaWithError() argument
66 return interleaveWithError(c.begin(), c.end(), eachFn, [&]() { os << ", "; }); in interleaveCommaWithError()
72 explicit CppEmitter(raw_ostream &os, bool declareVariablesAtTop);
154 raw_indented_ostream &ostream() { return os; }; in ostream()
165 raw_indented_ostream os; member
251 raw_ostream &os = emitter.ostream(); in printOperation() local
258 os << emitter.getOrCreateName(argument) << " = " in printOperation()
262 os << "goto "; in printOperation()
265 os << emitter.getOrCreateName(successor); in printOperation()
271 raw_indented_ostream &os = emitter.ostream(); in printOperation() local
275 os << "if (" << emitter.getOrCreateName(condBranchOp.getCondition()) in printOperation()
278 os.indent(); in printOperation()
285 os << emitter.getOrCreateName(argument) << " = " in printOperation()
289 os << "goto "; in printOperation()
293 os << emitter.getOrCreateName(trueSuccessor) << ";\n"; in printOperation()
294 os.unindent() << "} else {\n"; in printOperation()
295 os.indent(); in printOperation()
301 os << emitter.getOrCreateName(argument) << " = " in printOperation()
305 os << "goto "; in printOperation()
310 os << emitter.getOrCreateName(falseSuccessor) << ";\n"; in printOperation()
311 os.unindent() << "}"; in printOperation()
319 raw_ostream &os = emitter.ostream(); in printOperation() local
320 os << callOp.getCallee() << "("; in printOperation()
323 os << ")"; in printOperation()
328 raw_ostream &os = emitter.ostream(); in printOperation() local
333 os << callOp.getCallee(); in printOperation()
345 os << emitter.getOrCreateName(op.getOperand(idx)); in printOperation()
356 os << "<"; in printOperation()
358 interleaveCommaWithError(*callOp.getTemplateArgs(), os, emitArgs))) in printOperation()
360 os << ">"; in printOperation()
363 os << "("; in printOperation()
367 ? interleaveCommaWithError(*callOp.getArgs(), os, emitArgs) in printOperation()
371 os << ")"; in printOperation()
377 raw_ostream &os = emitter.ostream(); in printOperation() local
382 os << applyOp.getApplicableOperator(); in printOperation()
383 os << emitter.getOrCreateName(applyOp.getOperand()); in printOperation()
389 raw_ostream &os = emitter.ostream(); in printOperation() local
394 os << "("; in printOperation()
397 os << ") "; in printOperation()
398 os << emitter.getOrCreateName(castOp.getOperand()); in printOperation()
405 raw_ostream &os = emitter.ostream(); in printOperation() local
407 os << "#include "; in printOperation()
409 os << "<" << includeOp.getInclude() << ">"; in printOperation()
411 os << "\"" << includeOp.getInclude() << "\""; in printOperation()
418 raw_indented_ostream &os = emitter.ostream(); in printOperation() local
435 os << " " << emitter.getOrCreateName(std::get<0>(pair)) << " = "; in printOperation()
436 os << emitter.getOrCreateName(std::get<1>(pair)) << ";"; in printOperation()
437 os << "\n"; in printOperation()
440 os << "for ("; in printOperation()
444 os << " "; in printOperation()
445 os << emitter.getOrCreateName(forOp.getInductionVar()); in printOperation()
446 os << " = "; in printOperation()
447 os << emitter.getOrCreateName(forOp.getLowerBound()); in printOperation()
448 os << "; "; in printOperation()
449 os << emitter.getOrCreateName(forOp.getInductionVar()); in printOperation()
450 os << " < "; in printOperation()
451 os << emitter.getOrCreateName(forOp.getUpperBound()); in printOperation()
452 os << "; "; in printOperation()
453 os << emitter.getOrCreateName(forOp.getInductionVar()); in printOperation()
454 os << " += "; in printOperation()
455 os << emitter.getOrCreateName(forOp.getStep()); in printOperation()
456 os << ") {\n"; in printOperation()
457 os.indent(); in printOperation()
476 os << emitter.getOrCreateName(iterArg) << " = " in printOperation()
480 os.unindent() << "}"; in printOperation()
486 os << "\n" in printOperation()
495 raw_indented_ostream &os = emitter.ostream(); in printOperation() local
505 os << "if ("; in printOperation()
508 os << ") {\n"; in printOperation()
509 os.indent(); in printOperation()
519 os.unindent() << "}"; in printOperation()
523 os << " else {\n"; in printOperation()
524 os.indent(); in printOperation()
533 os.unindent() << "}"; in printOperation()
540 raw_ostream &os = emitter.ostream(); in printOperation() local
553 os << emitter.getOrCreateName(result) << " = "; in printOperation()
557 os << emitter.getOrCreateName(operand); in printOperation()
560 [&]() { os << ";\n"; }))) in printOperation()
568 raw_ostream &os = emitter.ostream(); in printOperation() local
569 os << "return"; in printOperation()
574 os << " " << emitter.getOrCreateName(returnOp.getOperand(0)); in printOperation()
577 os << " std::make_tuple("; in printOperation()
580 os << ")"; in printOperation()
605 raw_indented_ostream &os = emitter.ostream(); in printOperation() local
609 os << " " << functionOp.getName(); in printOperation()
611 os << "("; in printOperation()
613 functionOp.getArguments(), os, in printOperation()
617 os << " " << emitter.getOrCreateName(arg); in printOperation()
621 os << ") {\n"; in printOperation()
622 os.indent(); in printOperation()
657 os << " " << emitter.getOrCreateName(arg) << ";\n"; in printOperation()
680 os.unindent() << "}\n"; in printOperation()
684 CppEmitter::CppEmitter(raw_ostream &os, bool declareVariablesAtTop) in CppEmitter() argument
685 : os(os), declareVariablesAtTop(declareVariablesAtTop) { in CppEmitter()
726 os << "true"; in emitAttribute()
728 os << "false"; in emitAttribute()
732 os << strValue; in emitAttribute()
743 os << "(float)"; in emitAttribute()
746 os << "(double)"; in emitAttribute()
751 os << strValue; in emitAttribute()
753 os << "NAN"; in emitAttribute()
756 os << "-"; in emitAttribute()
757 os << "INFINITY"; in emitAttribute()
767 os << '{'; in emitAttribute()
768 interleaveComma(dense, os, [&](const APFloat &val) { printFloat(val); }); in emitAttribute()
769 os << '}'; in emitAttribute()
789 os << '{'; in emitAttribute()
790 interleaveComma(dense, os, [&](const APInt &val) { in emitAttribute()
793 os << '}'; in emitAttribute()
800 os << '{'; in emitAttribute()
801 interleaveComma(dense, os, in emitAttribute()
803 os << '}'; in emitAttribute()
810 os << oAttr.getValue(); in emitAttribute()
818 os << sAttr.getRootReference().getValue(); in emitAttribute()
833 os << getOrCreateName(result); in emitOperands()
836 return interleaveCommaWithError(op.getOperands(), os, emitOperandName); in emitOperands()
848 os << ", "; in emitOperandsAndAttributes()
857 os << "/* " << attr.getName().getValue() << " */"; in emitOperandsAndAttributes()
862 return interleaveCommaWithError(op.getAttrs(), os, emitNamedAttribute); in emitOperandsAndAttributes()
870 os << getOrCreateName(result) << " = "; in emitVariableAssignment()
882 os << " " << getOrCreateName(result); in emitVariableDeclaration()
884 os << ";\n"; in emitVariableDeclaration()
900 os << " = "; in emitAssignPrefix()
911 os << "std::tie("; in emitAssignPrefix()
912 interleaveComma(op.getResults(), os, in emitAssignPrefix()
913 [&](Value result) { os << getOrCreateName(result); }); in emitAssignPrefix()
914 os << ") = "; in emitAssignPrefix()
924 os.getOStream() << getOrCreateName(block) << ":\n"; in emitLabel()
955 os << (trailingSemicolon ? ";\n" : "\n"); in emitOperation()
963 return (os << "bool"), success(); in emitType()
969 return (os << "uint" << iType.getWidth() << "_t"), success(); in emitType()
971 return (os << "int" << iType.getWidth() << "_t"), success(); in emitType()
979 return (os << "float"), success(); in emitType()
981 return (os << "double"), success(); in emitType()
987 return (os << "size_t"), success(); in emitType()
993 os << "Tensor<"; in emitType()
998 os << ", "; in emitType()
999 os << dimSize; in emitType()
1001 os << ">"; in emitType()
1007 os << oType.getValue(); in emitType()
1013 os << "*"; in emitType()
1022 os << "void"; in emitTypes()
1032 os << "std::tuple<"; in emitTupleType()
1034 types, os, [&](Type type) { return emitType(loc, type); }))) in emitTupleType()
1036 os << ">"; in emitTupleType()
1040 LogicalResult emitc::translateToCpp(Operation *op, raw_ostream &os, in translateToCpp() argument
1042 CppEmitter emitter(os, declareVariablesAtTop); in translateToCpp()