Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dyno: Initial resolution of zip() expressions and parallel iterators #24915

Merged
merged 14 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/include/chpl/framework/ErrorBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class GeneralError : public BasicError {
return owned<ErrorBase>(new Error##NAME__(*this));\
}\
\
ErrorInfo info() const { return info_; }\
const ErrorInfo& info() const { return info_; }\
};
#include "chpl/framework/error-classes-list.h"
#undef DIAGNOSTIC_CLASS
Expand Down
7 changes: 6 additions & 1 deletion frontend/include/chpl/framework/all-global-strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ X(c_ptrConst , "c_ptrConst")
X(c_char , "c_char")
X(class_ , "class")
X(deinit , "deinit")
X(deserialize , "deserialize")
X(dmapped , "dmapped")
X(domain , "domain")
X(false_ , "false")
X(follower , "follower")
X(followThis , "followThis")
X(for_ , "for")
X(forall , "forall")
X(foreach , "foreach")
Expand All @@ -58,6 +61,7 @@ X(init , "init")
X(initequals , "init=")
X(int_ , "int")
X(isCoercible , "isCoercible")
X(leader , "leader")
X(locale , "locale")
X(main , "main")
X(max , "max")
Expand All @@ -79,15 +83,16 @@ X(reduceAssign , "reduce=")
X(RootClass , "RootClass")
X(scan , "scan")
X(serialize , "serialize")
X(deserialize , "deserialize")
X(shared , "shared")
X(single , "single")
X(sparse , "sparse")
X(stable , "stable")
X(standalone , "standalone")
X(string , "string")
X(subdomain , "subdomain")
X(super_ , "super")
X(sync , "sync")
X(tag , "tag")
X(this_ , "this")
X(these_ , "these")
X(true_ , "true")
Expand Down
43 changes: 43 additions & 0 deletions frontend/include/chpl/resolution/resolution-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "chpl/framework/UniqueString.h"
#include "chpl/resolution/scope-types.h"
#include "chpl/types/CompositeType.h"
#include "chpl/types/EnumType.h"
#include "chpl/types/QualifiedType.h"
#include "chpl/types/Type.h"
#include "chpl/uast/AstNode.h"
Expand Down Expand Up @@ -309,6 +310,11 @@ class UntypedFnSignature {
return isMethod_;
}

/** Returns true if this is an iterator */
bool isIterator() const {
return kind_ == uast::Function::ITER;
}

/** Returns true if this function throws */
bool throws() const {
return throws_;
Expand Down Expand Up @@ -949,6 +955,11 @@ class TypedFnSignature {
const TypedFnSignature* parentFn,
Bitmap formalsInstantiated);

/** If this is an iterator, set 'found' to a string representing its
'iterKind', or "" if it is a serial iterator. Returns 'true' only
if this is an iterator and a valid 'iterKind' formal was found. */
bool fetchIterKindStr(Context* context, UniqueString& outIterKindStr) const;

public:
/** Get the unique TypedFnSignature containing these components */
static
Expand Down Expand Up @@ -1094,6 +1105,38 @@ class TypedFnSignature {
return formalTypes_[i];
}

bool isMethod() const {
return untypedSignature_->isMethod();
}

bool isIterator() const {
return untypedSignature_->isIterator();
}

/** Returns 'true' if this signature is for a standalone parallel iterator. */
bool isParallelStandaloneIterator(Context* context) const {
UniqueString str;
return fetchIterKindStr(context, str) && str == USTR("standalone");
}

/** Returns 'true' if this signature is for a parallel leader iterator. */
bool isParallelLeaderIterator(Context* context) const {
UniqueString str;
return fetchIterKindStr(context, str) && str == USTR("leader");
}

/** Returns 'true' if this signature is for a parallel follower iterator. */
bool isParallelFollowerIterator(Context* context) const {
UniqueString str;
return fetchIterKindStr(context, str) && str == USTR("follower");
}

/** Returns 'true' if this signature is for a serial iterator. */
bool isSerialIterator(Context* context) const {
UniqueString str;
return fetchIterKindStr(context, str) && str.isEmpty();
}

/// \cond DO_NOT_DOCUMENT
DECLARE_DUMP;
/// \endcond DO_NOT_DOCUMENT
Expand Down
14 changes: 14 additions & 0 deletions frontend/include/chpl/types/EnumType.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define CHPL_TYPES_ENUM_TYPE_H

#include "chpl/types/Type.h"
#include "chpl/types/QualifiedType.h"

namespace chpl{
namespace types {
Expand Down Expand Up @@ -64,6 +65,19 @@ class EnumType final : public Type {
/** Get the type for a range's boundKind */
static const EnumType* getBoundKindType(Context* context);

/** Get the type representing an iterator's "iteration kind". */
static const EnumType* getIterKindType(Context* context);

/** Given an enum type 'et', get a map from the name of each constant
in 'et' to each constant represented as a param value.
If there are multiple enum constants with the same name (which
means the AST is semantically incorrect), then only the first
constant is added to the map. Returns 'nullptr' if 'et' is
'nullptr' or has an empty ID, or if it does not have any AST
representing it. */
static const std::map<UniqueString, QualifiedType>*
getParamConstantsMapOrNull(Context* context, const EnumType* et);

~EnumType() = default;

virtual void stringify(std::ostream& ss,
Expand Down
4 changes: 4 additions & 0 deletions frontend/include/chpl/types/QualifiedType.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ class QualifiedType final {
return isUnknown() || (genericity() != Type::CONCRETE);
}

bool isUnknownOrErroneous() const {
return isUnknown() || isErroneousType();
}

/** Returns true if kind is TYPE */
bool isType() const { return kind_ == Kind::TYPE; }

Expand Down
Loading
Loading