This revision was automatically updated to reflect the committed changes.
Closed by commit rG80bbc05436d9: [clang][Interp] Implement inv and neg unary
operations (authored by tbaeder).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132098/new/
https:
aaron.ballman accepted this revision.
aaron.ballman added a comment.
LGTM!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132098/new/
https://reviews.llvm.org/D132098
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.o
tbaeder updated this revision to Diff 453970.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132098/new/
https://reviews.llvm.org/D132098
Files:
clang/lib/AST/Interp/Boolean.h
clang/lib/AST/Interp/ByteCodeExprGen.cpp
clang/lib/AST/Interp/ByteCodeExprGen.h
clang/lib/AST/Interp/Inte
tbaeder added inline comments.
Comment at: clang/lib/AST/Interp/Integral.h:173
+ }
+
template static Integral from(Integral<0, SrcSign> Value) {
erichkeane wrote:
> aaron.ballman wrote:
> > tbaeder wrote:
> > > aaron.ballman wrote:
> > > > tbaeder wrote:
> >
tbaeder updated this revision to Diff 453968.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132098/new/
https://reviews.llvm.org/D132098
Files:
clang/lib/AST/Interp/Boolean.h
clang/lib/AST/Interp/ByteCodeExprGen.cpp
clang/lib/AST/Interp/ByteCodeExprGen.h
clang/lib/AST/Interp/Inte
erichkeane added inline comments.
Comment at: clang/lib/AST/Interp/Integral.h:173
+ }
+
template static Integral from(Integral<0, SrcSign> Value) {
aaron.ballman wrote:
> tbaeder wrote:
> > aaron.ballman wrote:
> > > tbaeder wrote:
> > > > I'm a bit out of m
aaron.ballman added inline comments.
Comment at: clang/lib/AST/Interp/Integral.h:173
+ }
+
template static Integral from(Integral<0, SrcSign> Value) {
tbaeder wrote:
> aaron.ballman wrote:
> > tbaeder wrote:
> > > I'm a bit out of my element with the templat
erichkeane added inline comments.
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:620
+ case UO_Deref: // *x
+ case UO_Not:// ~x
+ case UO_Real: // __real x
erichkeane wrote:
> tbaeder wrote:
> > aaron.ballman wrote:
> > > tbaeder wrote:
> > > > aa
erichkeane added inline comments.
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:620
+ case UO_Deref: // *x
+ case UO_Not:// ~x
+ case UO_Real: // __real x
tbaeder wrote:
> aaron.ballman wrote:
> > tbaeder wrote:
> > > aaron.ballman wrote:
> > > >
tbaeder added inline comments.
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:620
+ case UO_Deref: // *x
+ case UO_Not:// ~x
+ case UO_Real: // __real x
aaron.ballman wrote:
> tbaeder wrote:
> > aaron.ballman wrote:
> > > This is reachable and wil
aaron.ballman added inline comments.
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:620
+ case UO_Deref: // *x
+ case UO_Not:// ~x
+ case UO_Real: // __real x
tbaeder wrote:
> aaron.ballman wrote:
> > This is reachable and will always return true
tbaeder added inline comments.
Comment at: clang/lib/AST/Interp/Integral.h:173
+ }
+
template static Integral from(Integral<0, SrcSign> Value) {
I'm a bit out of my element with the template magic here.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/
tbaeder updated this revision to Diff 453917.
tbaeder added a comment.
When changing the test to use `-verify=test`, I noticed that
`static_assert(-false)` did not assert.
I had to implement integral casts (only from sint32 to bool for now) in this
patch as well to make it work.
CHANGES SINCE
tbaeder added inline comments.
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:620
+ case UO_Deref: // *x
+ case UO_Not:// ~x
+ case UO_Real: // __real x
aaron.ballman wrote:
> This is reachable and will always return true thanks to the magic of in
shafik added inline comments.
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:131
+
+ return this->emitNE(*T, SubExpr);
+}
shafik wrote:
> Can you explain this line?
Nevermind, I get it, you are emitting a `0` and then doing a not equal to zero
to
aaron.ballman added a comment.
I'd appreciate if we handled unary `~` and `+` soon after this
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:620
+ case UO_Deref: // *x
+ case UO_Not:// ~x
+ case UO_Real: // __real x
This is reachable and will al
shafik added inline comments.
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:131
+
+ return this->emitNE(*T, SubExpr);
+}
Can you explain this line?
Comment at: clang/lib/AST/Interp/Interp.h:183
+
+ S.Stk.push(Val);
+ return tr
tbaeder added inline comments.
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:123
- default: {
-// TODO: implement other casts.
-return this->bail(CE);
- }
+ case CK_IntegralToBoolean:
+if (Optional T = classify(SubExpr->getType())) {
Imple
tbaeder created this revision.
tbaeder added reviewers: erichkeane, aaron.ballman.
Herald added a project: All.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Implement inverting and negating values
Repository:
rG LLVM Github M
19 matches
Mail list logo