[flang-commits] [flang] [llvm] [mlir] [flang][mlir][OpenMP] Add support for COPYPRIVATE (PR #73128)
Leandro Lupori via flang-commits
flang-commits at lists.llvm.org
Thu Dec 21 07:29:04 PST 2023
================
@@ -880,6 +884,156 @@ createReductionDecl(fir::FirOpBuilder &builder, llvm::StringRef reductionOpName,
return decl;
}
+/// Class that extracts information from the specified type.
+class TypeInfo {
+public:
+ TypeInfo(mlir::Location loc, mlir::Type ty) : loc(loc) {
+ name = typeScan(ty);
+ }
+
+ // Returns a textual representation of the type, with characters that are
+ // valid in identifiers.
+ const std::string &getName() const { return name; }
+
+ // Returns the length of character types.
+ std::optional<fir::CharacterType::LenType> getCharLength() const {
+ return charLen;
+ }
+
+ // Returns the shape of array types.
+ const llvm::SmallVector<int64_t> &getShape() const { return shape; }
+
+ // Is the type inside a box?
+ bool isBox() const { return inBox; }
+
+private:
+ // Scan type and return an unique name for it.
+ std::string typeScan(mlir::Type type);
+
+ mlir::Location loc;
+ std::string name;
+ std::optional<fir::CharacterType::LenType> charLen;
+ llvm::SmallVector<int64_t> shape;
+ bool inBox = false;
+};
+
+std::string TypeInfo::typeScan(mlir::Type ty) {
----------------
luporl wrote:
Yes, it works. I wish I had found this earlier.
https://github.com/llvm/llvm-project/pull/73128
More information about the flang-commits
mailing list