Skip to content

Roll up work on folding, descriptors, runtime, RESHAPE #162

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

Merged
merged 17 commits into from
Aug 6, 2018
Merged

Conversation

klausler
Copy link
Collaborator

@klausler klausler commented Aug 3, 2018

Some disconnected changes here related to evaluation and execution. The C++ interface to the ISO standard descriptor is now is much better shape, and can serve to implement a working RESHAPE intrinsic. More to come, but it was past time to checkpoint and merge this work area.

As a readability improvement (I think), I've replaced many instances of return {}; with return std::nullopt; in contexts where the function's type is an instantiation of std::optional<>.

Also, a GNU C++ compiler bug workaround in lib/parser/basic-parsers.h is no longer needed with GNU 8.2.0, and the conditional compilation tests were adjusted accordingly.

@@ -471,7 +472,13 @@ template<int KIND>
auto RealExpr<KIND>::IntPower::FoldScalar(FoldingContext &context,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use auto for these functions? They don't seem to obey the "Don't use auto functions unless..." rule.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an outlined member function definition whose result type uses the name of a type declared in the class. Written without auto, the result type would have to be something like std::optional<typename RealExpr<KIND>::Scalar>. This is exactly the situation in which the "unless..." exceptional language in the style guide is meant to apply.

REAL one{REAL::FromInteger(INT{1}).value};
ValueWithRealFlags<REAL> result;
result.value = one;
if (base.IsNotANumber()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We seem to be using "NaN" everywhere else, so why not "IsNaN" for this function?
(I know this wasn't added in this change -- sorry.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll rename some of the others to avoid the needless use of an obscure term of art.

extent) == CFI_SUCCESS);
raw_.f18Addendum = addendum;
if (addendum) {
new (Addendum()) DescriptorAddendum{};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any of these placement news fail because the expression is nullptr, does that mean there is a bug in the logic of Descriptor? If it could be due to an error in how the client of this class is using it, I think an explicit assertion would be helpful. Otherwise, this is fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, Addendum must be non-null, but it can be made more explicitly so.

case 8: raw_ = CFI_type_int64_t; break;
}
break;
case TypeCategory::Derived: raw_ = CFI_type_struct; break;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang will warn about missing default cases

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't.

{0x40000000, "0x1.0p1"}, {0x3f000000, "0x1.0p-1"},
{0x7f7fffff, "0x1.fffffep127"}, {0x00800000, "0x1.0p-126"},
{0x00400000, "0x0.8p-127"}, {0x00000001, "0x0.000002p-127"},
{0, nullptr}};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this project use clang-format?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, unfortunately it sometimes makes a mess of the code.

In this case, adding a comma after {0, nullptr} would get it back the way it was. I think that would be an improvement.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

Copy link
Collaborator

@tskeith tskeith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@klausler klausler merged commit 967a334 into master Aug 6, 2018
@klausler klausler deleted the pmk0 branch August 6, 2018 16:54
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
Original-commit: flang-compiler/f18@2dc2c2a
Reviewed-on: flang-compiler/f18#162
Tree-same-pre-rewrite: false
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
Original-commit: flang-compiler/f18@6f1ef45
Reviewed-on: flang-compiler/f18#162
Tree-same-pre-rewrite: false
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
Original-commit: flang-compiler/f18@77ed88d
Reviewed-on: flang-compiler/f18#162
Tree-same-pre-rewrite: false
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
Original-commit: flang-compiler/f18@5adc208
Reviewed-on: flang-compiler/f18#162
Tree-same-pre-rewrite: false
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
Original-commit: flang-compiler/f18@5e68ebe
Reviewed-on: flang-compiler/f18#162
Tree-same-pre-rewrite: false
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
Original-commit: flang-compiler/f18@b4423e3
Reviewed-on: flang-compiler/f18#162
Tree-same-pre-rewrite: false
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
Original-commit: flang-compiler/f18@0ab1704
Reviewed-on: flang-compiler/f18#162
Tree-same-pre-rewrite: false
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
Original-commit: flang-compiler/f18@f583987
Reviewed-on: flang-compiler/f18#162
Tree-same-pre-rewrite: false
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
…d with GNU 8.2.0.

Original-commit: flang-compiler/f18@80257ee
Reviewed-on: flang-compiler/f18#162
Tree-same-pre-rewrite: false
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
Original-commit: flang-compiler/f18@c20ce35
Reviewed-on: flang-compiler/f18#162
Tree-same-pre-rewrite: false
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
Original-commit: flang-compiler/f18@0c946be
Reviewed-on: flang-compiler/f18#162
Tree-same-pre-rewrite: false
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
Original-commit: flang-compiler/f18@34eac17
Reviewed-on: flang-compiler/f18#162
Tree-same-pre-rewrite: false
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this pull request Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants