13#ifndef FORTRAN_LOWER_MANGLER_H
14#define FORTRAN_LOWER_MANGLER_H
16#include "flang/Evaluate/expression.h"
17#include "flang/Optimizer/Dialect/FIRType.h"
18#include "llvm/ADT/StringRef.h"
33namespace lower::mangle {
35using ScopeBlockIdMap =
36 llvm::DenseMap<Fortran::semantics::Scope *, std::int64_t>;
44std::string mangleName(
const semantics::Symbol &, ScopeBlockIdMap &,
45 bool keepExternalInScope =
false,
46 bool underscoring =
true);
47std::string mangleName(
const semantics::Symbol &,
48 bool keepExternalInScope =
false,
49 bool underscoring =
true);
52std::string mangleName(
const semantics::DerivedTypeSpec &, ScopeBlockIdMap &);
55std::string mangleName(std::string &,
const Fortran::semantics::Scope &,
59std::string demangleName(llvm::StringRef name);
62mangleArrayLiteral(
size_t size,
63 const Fortran::evaluate::ConstantSubscripts &shape,
64 Fortran::common::TypeCategory cat,
int kind = 0,
65 Fortran::common::ConstantSubscript charLen = -1,
66 llvm::StringRef derivedName = {});
68template <Fortran::common::TypeCategory TC,
int KIND>
69std::string mangleArrayLiteral(
71 const Fortran::evaluate::Constant<Fortran::evaluate::Type<TC, KIND>> &x) {
72 return mangleArrayLiteral(x.values().size() *
sizeof(x.values()[0]),
78mangleArrayLiteral(mlir::Type,
79 const Fortran::evaluate::Constant<Fortran::evaluate::Type<
80 Fortran::common::TypeCategory::Character, KIND>> &x) {
81 return mangleArrayLiteral(x.values().size() *
sizeof(x.values()[0]),
82 x.shape(), Fortran::common::TypeCategory::Character,
86inline std::string mangleArrayLiteral(
88 const Fortran::evaluate::Constant<Fortran::evaluate::SomeDerived> &x) {
89 return mangleArrayLiteral(x.values().size() *
sizeof(x.values()[0]),
90 x.shape(), Fortran::common::TypeCategory::Derived,
92 mlir::cast<fir::RecordType>(eleTy).getName());
96std::string globalNamelistDescriptorName(
const Fortran::semantics::Symbol &sym);
102std::string getRecordTypeFieldName(
const Fortran::semantics::Symbol &component,
Definition reference.h:18
Definition bit-population-count.h:20
Definition bit-population-count.h:20