Lines Matching defs:o
31 static void ShapeAsFortran(llvm::raw_ostream &o,
35 o << ",shape=";
38 o << ch << dim;
41 o << ']';
43 o << ",%lbound=";
46 o << ch << lb;
49 o << ']';
51 o << ')';
57 llvm::raw_ostream &o) const {
60 o << "reshape(";
63 o << '[' << GetType().AsFortran() << "::";
70 o << ',';
73 o << value.SignedDecimal() << '_' << Result::kind;
75 o << value.UnsignedDecimal() << "U_" << Result::kind;
78 value.AsFortran(o, Result::kind);
80 o << Result::kind << '_' << parser::QuoteCharacterLiteral(value, true);
83 o << "transfer(" << value.word().ToInt64() << "_8,.false._"
86 o << ".true." << '_' << Result::kind;
88 o << ".false." << '_' << Result::kind;
91 StructureConstructor{result_.derivedTypeSpec(), value}.AsFortran(o);
95 o << ']';
97 ShapeAsFortran(o, shape(), lbounds(), hasNonDefaultLowerBound);
98 return o;
103 llvm::raw_ostream &o) const {
106 o << "reshape(";
109 o << '[' << GetType().AsFortran(std::to_string(length_)) << "::";
115 o << ',';
118 o << Result::kind << '_';
120 o << parser::QuoteCharacterLiteral(value);
123 o << ']';
125 ShapeAsFortran(o, shape(), lbounds(), hasNonDefaultLowerBound);
126 return o;
129 llvm::raw_ostream &EmitVar(llvm::raw_ostream &o, const Symbol &symbol,
133 return o << iter->second.ToString();
135 return o << name->ToString();
137 return o << symbol.name().ToString();
141 llvm::raw_ostream &EmitVar(llvm::raw_ostream &o, const std::string &lit) {
142 return o << parser::QuoteCharacterLiteral(lit);
145 llvm::raw_ostream &EmitVar(llvm::raw_ostream &o, const std::u16string &lit) {
146 return o << parser::QuoteCharacterLiteral(lit);
149 llvm::raw_ostream &EmitVar(llvm::raw_ostream &o, const std::u32string &lit) {
150 return o << parser::QuoteCharacterLiteral(lit);
154 llvm::raw_ostream &EmitVar(llvm::raw_ostream &o, const A &x) {
155 return x.AsFortran(o);
159 llvm::raw_ostream &EmitVar(llvm::raw_ostream &o, common::Reference<A> x) {
160 return EmitVar(o, *x);
165 llvm::raw_ostream &o, const A *p, const char *kw = nullptr) {
168 o << kw;
170 EmitVar(o, *p);
172 return o;
177 llvm::raw_ostream &o, const std::optional<A> &x, const char *kw = nullptr) {
180 o << kw;
182 EmitVar(o, *x);
184 return o;
188 llvm::raw_ostream &EmitVar(llvm::raw_ostream &o,
191 o << kw;
193 EmitVar(o, p.value());
194 return o;
198 llvm::raw_ostream &EmitVar(llvm::raw_ostream &o, const std::shared_ptr<A> &p) {
200 return EmitVar(o, *p);
204 llvm::raw_ostream &EmitVar(llvm::raw_ostream &o, const std::variant<A...> &u) {
205 common::visit([&](const auto &x) { EmitVar(o, x); }, u);
206 return o;
210 llvm::raw_ostream &o) const {
211 return EmitVar(o, *symbol_);
214 llvm::raw_ostream &ActualArgument::AsFortran(llvm::raw_ostream &o) const {
216 o << keyword_->ToString() << '=';
219 o << "%VAL(";
221 o << "%REF(";
226 expr.value().AsFortran(o);
228 [&](const AssumedType &assumedType) { assumedType.AsFortran(o); },
229 [&](const common::Label &label) { o << '*' << label; },
233 o << ')';
235 return o;
238 llvm::raw_ostream &SpecificIntrinsic::AsFortran(llvm::raw_ostream &o) const {
239 return o << name;
242 llvm::raw_ostream &ProcedureRef::AsFortran(llvm::raw_ostream &o) const {
245 arg->AsFortran(o) << '%';
249 proc_.AsFortran(o);
254 expr.AsFortran(o << "<<<");
257 expr.AsFortran(o << ",");
260 o << ">>>";
265 arg->AsFortran(o << separator);
270 o << '(';
272 return o << ')';
447 llvm::raw_ostream &o) const {
450 o << spelling.prefix;
454 left().AsFortran(o << '(') << ')';
456 left().AsFortran(o);
462 left().AsFortran(o << '(') << ')';
464 left().AsFortran(o);
466 o << spelling.infix;
469 right().AsFortran(o << '(') << ')';
471 right().AsFortran(o);
474 return o << spelling.suffix;
478 llvm::raw_ostream &Convert<TO, FROMCAT>::AsFortran(llvm::raw_ostream &o) const {
487 this->left().AsFortran(o << "achar(iachar(") << ')';
489 this->left().AsFortran(o << "int(");
491 this->left().AsFortran(o << "real(");
493 this->left().AsFortran(o << "cmplx(");
495 this->left().AsFortran(o << "logical(");
497 this->left().AsFortran(o << "uint(");
499 return o << ",kind=" << TO::kind << ')';
502 llvm::raw_ostream &Relational<SomeType>::AsFortran(llvm::raw_ostream &o) const {
503 common::visit([&](const auto &rel) { rel.AsFortran(o); }, u);
504 return o;
508 llvm::raw_ostream &EmitArray(llvm::raw_ostream &o, const Expr<T> &expr) {
509 return expr.AsFortran(o);
517 llvm::raw_ostream &EmitArray(llvm::raw_ostream &o, const ImpliedDo<T> &implDo) {
518 o << '(';
519 EmitArray(o, implDo.values());
520 o << ',' << ImpliedDoIndex::Result::AsFortran()
522 implDo.lower().AsFortran(o) << ',';
523 implDo.upper().AsFortran(o) << ',';
524 implDo.stride().AsFortran(o) << ')';
525 return o;
530 llvm::raw_ostream &o, const ArrayConstructorValues<T> &values) {
533 o << sep;
534 common::visit([&](const auto &x) { EmitArray(o, x); }, value.u);
537 return o;
541 llvm::raw_ostream &ArrayConstructor<T>::AsFortran(llvm::raw_ostream &o) const {
542 o << '[' << GetType().AsFortran() << "::";
543 EmitArray(o, *this);
544 return o << ']';
550 llvm::raw_ostream &o) const {
551 o << '[';
553 o << GetType().AsFortran(len->AsFortran()) << "::";
555 EmitArray(o, *this);
556 return o << ']';
560 llvm::raw_ostream &o) const {
561 o << '[' << GetType().AsFortran() << "::";
562 EmitArray(o, *this);
563 return o << ']';
576 llvm::raw_ostream &o) const {
579 o << "z'" << x.Hexadecimal() << "'";
581 [&](const NullPointer &) { o << "NULL()"; },
583 s.value().AsFortran(o);
585 [&](const ImpliedDoIndex &i) { o << i.name.ToString(); },
586 [&](const auto &x) { x.AsFortran(o); },
589 return o;
615 llvm::raw_ostream &StructureConstructor::AsFortran(llvm::raw_ostream &o) const {
616 o << DerivedTypeSpecAsFortran(result_.derivedTypeSpec());
618 o << '(';
622 value.value().AsFortran(EmitVar(o << ch, *symbol) << '=');
626 return o << ')';
678 llvm::raw_ostream &BaseObject::AsFortran(llvm::raw_ostream &o) const {
679 return EmitVar(o, u);
682 llvm::raw_ostream &TypeParamInquiry::AsFortran(llvm::raw_ostream &o) const {
684 base_.value().AsFortran(o) << '%';
686 return EmitVar(o, parameter_);
689 llvm::raw_ostream &Component::AsFortran(llvm::raw_ostream &o) const {
690 base_.value().AsFortran(o);
691 return EmitVar(o << '%', symbol_);
694 llvm::raw_ostream &NamedEntity::AsFortran(llvm::raw_ostream &o) const {
696 [&](SymbolRef s) { EmitVar(o, s); },
697 [&](const Component &c) { c.AsFortran(o); },
700 return o;
703 llvm::raw_ostream &Triplet::AsFortran(llvm::raw_ostream &o) const {
704 EmitVar(o, lower_) << ':';
705 EmitVar(o, upper_);
706 EmitVar(o << ':', stride_.value());
707 return o;
710 llvm::raw_ostream &Subscript::AsFortran(llvm::raw_ostream &o) const {
711 return EmitVar(o, u);
714 llvm::raw_ostream &ArrayRef::AsFortran(llvm::raw_ostream &o) const {
715 base_.AsFortran(o);
718 ss.AsFortran(o << separator);
721 return o << ')';
724 llvm::raw_ostream &CoarrayRef::AsFortran(llvm::raw_ostream &o) const {
730 o << '%';
732 EmitVar(o, part);
736 EmitVar(o << separator, sscript);
740 o << ')';
744 EmitVar(o << separator, css);
748 EmitVar(o << separator, stat_, "STAT=");
753 o << separator, team_, teamIsTeamNumber_ ? "TEAM_NUMBER=" : "TEAM=");
755 return o << ']';
758 llvm::raw_ostream &DataRef::AsFortran(llvm::raw_ostream &o) const {
759 return EmitVar(o, u);
762 llvm::raw_ostream &Substring::AsFortran(llvm::raw_ostream &o) const {
763 EmitVar(o, parent_) << '(';
764 EmitVar(o, lower_) << ':';
765 return EmitVar(o, upper_) << ')';
768 llvm::raw_ostream &ComplexPart::AsFortran(llvm::raw_ostream &o) const {
769 return complex_.AsFortran(o) << '%' << EnumToString(part_);
772 llvm::raw_ostream &ProcedureDesignator::AsFortran(llvm::raw_ostream &o) const {
773 return EmitVar(o, u);
777 llvm::raw_ostream &Designator<T>::AsFortran(llvm::raw_ostream &o) const {
779 [&](SymbolRef symbol) { EmitVar(o, symbol); },
780 [&](const auto &x) { x.AsFortran(o); },
783 return o;
786 llvm::raw_ostream &DescriptorInquiry::AsFortran(llvm::raw_ostream &o) const {
789 o << "lbound(";
792 o << "size(";
795 o << "%STRIDE(";
798 o << "int(rank(";
801 o << "int(";
804 base_.AsFortran(o);
806 o << "%len";
808 o << ")";
811 o << ",dim=" << (dimension_ + 1);
814 return o << ",kind=" << DescriptorInquiry::Result::kind << ")";
817 llvm::raw_ostream &Assignment::AsFortran(llvm::raw_ostream &o) const {
821 rhs.AsFortran(lhs.AsFortran(o) << '=');
823 [&](const ProcedureRef &proc) { proc.AsFortran(o << "CALL "); },
825 lhs.AsFortran(o);
829 bound.AsFortran(o << sep) << ':';
832 o << ')';
834 rhs.AsFortran(o << " => ");
837 lhs.AsFortran(o);
841 bound.first.AsFortran(o << sep) << ':';
842 bound.second.AsFortran(o);
845 o << ')';
847 rhs.AsFortran(o << " => ");
851 return o;