[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-08-21 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. In https://reviews.llvm.org/D49511#1206267, @rsmith wrote: > In https://reviews.llvm.org/D49511#1206265, @rsmith wrote: > > > In https://reviews.llvm.org/D49511#1194716, @leonardchan wrote: > > > > > @rsmith any more feedback on this current version? If it still

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-08-21 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: lib/Parse/ParseExpr.cpp:1126 + +Actions.StartCheckingNoDeref(); + rsmith wrote: > This parser-driven start/stop mechanism will not work in C++ templates. > Instead, can you remove the "start" part and check the

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-08-21 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 161785. leonardchan marked 6 inline comments as done and an inline comment as not done. Repository: rC Clang https://reviews.llvm.org/D49511 Files: include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td

[PATCH] D50616: [Fixed Point Arithmetic] FixedPointCast

2018-08-20 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. I made a post on llvm-dev (http://lists.llvm.org/pipermail/llvm-dev/2018-August/125433.html) to see if other people have opinions on this. In the meantime, do you think I should make a separate patch that moves this into an LLVM intrinsic function? Repository:

[PATCH] D50616: [Fixed Point Arithmetic] FixedPointCast

2018-08-17 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. In https://reviews.llvm.org/D50616#1203692, @ebevhan wrote: > In https://reviews.llvm.org/D50616#1203446, @leonardchan wrote: > > > Sorry I forgot to address this also. Just to make sure I understand this > > correctly since I haven't used these before: target hooks

[PATCH] D50616: [Fixed Point Arithmetic] FixedPointCast

2018-08-17 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 161298. leonardchan marked 4 inline comments as done. Repository: rC Clang https://reviews.llvm.org/D50616 Files: include/clang/AST/OperationKinds.def include/clang/AST/Type.h include/clang/Basic/DiagnosticCommonKinds.td lib/AST/Expr.cpp

[PATCH] D50616: [Fixed Point Arithmetic] FixedPointCast

2018-08-16 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. In https://reviews.llvm.org/D50616#1202034, @ebevhan wrote: > I think I've mentioned this before, but I would like to discuss the > possibility of adding a target hook(s) for some of these operations > (conversions, arithmetic when it comes). Precisely matching the

[PATCH] D50616: [Fixed Point Arithmetic] FixedPointCast

2018-08-16 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: lib/CodeGen/CGExprScalar.cpp:331 + SourceLocation Loc); + /// Emit a conversion from the specified complex type to the specified ebevhan wrote: > What's the plan for the other

[PATCH] D50616: [Fixed Point Arithmetic] FixedPointCast

2018-08-15 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: lib/CodeGen/CGExprScalar.cpp:1034 + if (DstFPSema.isSaturated() && + (CGF.getContext().getCorrespondingSaturatedType(SrcTy) != DstTy)) { +auto Mask = APInt::getBitsSetFrom( rjmccall wrote: > leonardchan

[PATCH] D50616: [Fixed Point Arithmetic] FixedPointCast

2018-08-15 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 160964. leonardchan marked 7 inline comments as done. leonardchan added a comment. - Reworked logic for saturation Repository: rC Clang https://reviews.llvm.org/D50616 Files: include/clang/AST/OperationKinds.def include/clang/AST/Type.h

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-08-15 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 160892. leonardchan marked 6 inline comments as done. Repository: rC Clang https://reviews.llvm.org/D49511 Files: include/clang/AST/Type.h include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td include/clang/Basic/DiagnosticGroups.td

[PATCH] D50616: [Fixed Point Arithmetic] FixedPointCast

2018-08-15 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 160884. leonardchan marked 3 inline comments as done. leonardchan added a comment. - Added check for if we should check for saturation when converting to a saturated fixed point type. - Replaced `llvm_unreachable()`s with temporary diagnostic to be

[PATCH] D50616: [Fixed Point Arithmetic] FixedPointCast

2018-08-15 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: lib/CodeGen/CGExprScalar.cpp:1016 + if (DstScale > SrcScale) { +// Need to allocate space before shifting left +ResultWidth = SrcWidth + DstScale - SrcScale; rjmccall wrote: > In IR, this isn't really

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-08-13 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: lib/Sema/SemaExpr.cpp:14249 + +if (Sema::TypeHasNoDeref(Inner)) + DeclRef = E; aaron.ballman wrote: > leonardchan wrote: > > aaron.ballman wrote: > > > The sugar was stripped off at the pointer level, but

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-08-13 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 160451. leonardchan marked 3 inline comments as done. leonardchan added a comment. - Remove sugar from pointee types Repository: rC Clang https://reviews.llvm.org/D49511 Files: include/clang/AST/Type.h include/clang/Basic/Attr.td

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-08-13 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. @rsmith Comment at: lib/Sema/SemaExpr.cpp:14249 + +if (Sema::TypeHasNoDeref(Inner)) + DeclRef = E; aaron.ballman wrote: > The sugar was stripped off at the pointer level, but not at the pointee > level. e.g., > ``` >

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-08-13 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 160403. leonardchan marked an inline comment as done. leonardchan added a comment. - Checks for sugared types and expressions wrapped in parenthesis Repository: rC Clang https://reviews.llvm.org/D49511 Files: include/clang/AST/Type.h

[PATCH] D50616: [Fixed Point Arithmetic] FixedPointCast

2018-08-12 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan created this revision. leonardchan added reviewers: ebevhan, phosek, mcgrathr, jakehehrlich. leonardchan added a project: clang. This patch is a part of https://reviews.llvm.org/D48456 in an attempt to split them up. This contains the code for casting between fixed point types and

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-08-09 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. @rsmith any more feedback on this current version? If it still looks incorrect to use the record this way, I don't mind simplifying it to work on lvalue to rvalue conversions without checking for a leading address space operation. Repository: rC Clang

[PATCH] D43424: [clang-doc] Implement a (simple) Markdown generator

2018-08-09 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan accepted this revision. leonardchan added inline comments. This revision is now accepted and ready to land. Comment at: clang-tools-extra/clang-doc/MDGenerator.cpp:79 + +void writeHeader(const Twine , int Num, raw_ostream ) { + OS << std::string(Num, '#') + " " +

[PATCH] D48909: [clang-doc] Update BitcodeReader to use llvm::Error

2018-08-09 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. Should there be any tests associated with these changes? Comment at: clang-tools-extra/clang-doc/BitcodeReader.cpp:308 - llvm::errs() << "Invalid type for info.\n"; - exit(1); } Probably not important or it's just me being

[PATCH] D50278: [Sema] Fix for crash on conditional operation with address_space pointer

2018-08-07 Thread Leonard Chan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL339167: [Sema] Fix for crash on conditional operation with address_space pointer (authored by leonardchan, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit:

[PATCH] D50278: [Sema] Fix for crash on conditional operation with address_space pointer

2018-08-07 Thread Leonard Chan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC339167: [Sema] Fix for crash on conditional operation with address_space pointer (authored by leonardchan, committed by ). Repository: rL LLVM https://reviews.llvm.org/D50278 Files:

[PATCH] D50278: [Sema] Fix for crash on conditional operation with address_space pointer

2018-08-07 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 159559. leonardchan marked an inline comment as done. leonardchan added a comment. - Removed checks for OpenCL in `checkConditionalPointerCompatibility`. This allows for the error `err_typecheck_op_on_nonoverlapping_address_space_pointers` to be dumped

[PATCH] D50278: [Sema] Fix for crash on conditional operation with address_space pointer

2018-08-07 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: include/clang/Basic/DiagnosticSemaKinds.td:6943 +def err_typecheck_incompatible_conditional_pointer_operands : Error< + "unable to find common type between %0 and %1 for conditional operation">; ebevhan wrote: >

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-08-06 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 159409. leonardchan marked 3 inline comments as done. leonardchan added a comment. - Changed tick to single quote in diagnostic Repository: rC Clang https://reviews.llvm.org/D49511 Files: include/clang/AST/Type.h include/clang/Basic/Attr.td

[PATCH] D50278: [Sema] Fix for crash on conditional operation with address_space pointer

2018-08-06 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 159405. leonardchan marked an inline comment as done. leonardchan added a comment. - Replaced instances of a `pointer type mismatch` warning involving 2 conditional operands with different address spaces with a new error specifically for this situation.

[PATCH] D50278: [Sema] Fix for crash on conditional operation with address_space pointer

2018-08-06 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. In https://reviews.llvm.org/D50278#1189919, @rjmccall wrote: > I would expect this to replace the existing warning, not to appear together > with it. Will do. Comment at: test/Sema/conditional-expr.c:78 + //

[PATCH] D48661: [Fixed Point Arithmetic] Fixed Point Constant

2018-08-06 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. In https://reviews.llvm.org/D48661#1189537, @bricci wrote: > Just a nit but could you please add new-lines to your commit messages. My bad, will remember this for future commits. > Also the 3 bools in FixedPointSemantics are a little bit wasteful. > I don't know

[PATCH] D48661: [Fixed Point Arithmetic] Fixed Point Constant

2018-08-06 Thread Leonard Chan via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rL339028: [Fixed Point Arithmetic] Fixed Point Constant (authored by leonardchan, committed by ). Herald added a

[PATCH] D48661: [Fixed Point Arithmetic] Fixed Point Constant

2018-08-06 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 159320. leonardchan marked an inline comment as done. leonardchan added a comment. - Fixed `Accumum` names Repository: rC Clang https://reviews.llvm.org/D48661 Files: include/clang/AST/ASTContext.h include/clang/Basic/FixedPoint.h

[PATCH] D50278: [Sema] Fix for crash on conditional operation with address_space pointer

2018-08-06 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 159315. leonardchan added reviewers: ebevhan, rjmccall. leonardchan removed a subscriber: ebevhan. leonardchan added a comment. - Changed diff such that an error is dumped instead. The code shouldn't compile in the first place since it involves

[PATCH] D49945: [Fixed Point Arithmetic] Fix for FixedPointValueToString

2018-08-06 Thread Leonard Chan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. leonardchan marked an inline comment as done. Closed by commit rC339026: [Fixed Point Arithmetic] Fix for FixedPointValueToString (authored by leonardchan, committed by ). Repository: rC Clang

[PATCH] D49945: [Fixed Point Arithmetic] Fix for FixedPointValueToString

2018-08-06 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan marked an inline comment as done. leonardchan added inline comments. Comment at: lib/AST/Expr.cpp:788 FixedPointValueToString( - S, llvm::APSInt::getUnsigned(getValue().getZExtValue()), Scale, Radix); + S,

[PATCH] D50278: [Sema] Fix for crash on conditional operation with address_space pointer

2018-08-03 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan created this revision. leonardchan added reviewers: phosek, mcgrathr, rsmith. leonardchan added a project: clang. Compiling the following causes clang to crash void cmp(char *x, __attribute__((address_space(2))) char *y) { 0 ? x : y; } with the message: "wrong cast for

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-07-31 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 158423. leonardchan added a comment. - Moved the counter and set into `ExpressionEvaluationContextRecord` Repository: rC Clang https://reviews.llvm.org/D49511 Files: include/clang/AST/Type.h include/clang/Basic/Attr.td

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-07-31 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. > Your current counter-based approach doesn't work very well in the case where > we switch to another context while processing an expression (for example, > during template instantiation): you'll defer all the diagnostics for the > inner construct until the outer

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-07-31 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. > You shouldn't be adding your own `ExpressionEvaluationContextRecord`s. What I > was suggesting is that you store a list of pending `noderef` expressions on > the record, and diagnose them when the record is popped (if they've not been > removed since). This is

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-07-31 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 158407. leonardchan marked 6 inline comments as done. leonardchan added a comment. - Added tests for checking that `noderef` can only be used for C style pointers and arrays (not usable for references or ObjC pointers) - Added warnings for dereferencing

[PATCH] D49945: [Fixed Point Arithmetic] Fix for FixedPointValueToString

2018-07-27 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan created this revision. leonardchan added reviewers: phosek, mcgrathr, jakehehrlich, ebevhan, rjmccall. leonardchan added a project: clang. Herald added a subscriber: mgorny. - Print negative numbers correctly - Handle APInts of different sizes - Add formal unit tests for

[PATCH] D49876: [Fixed Point Arithmetic] Addition of intrinsic/builtin functions

2018-07-26 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan created this revision. leonardchan added a project: clang. Herald added a subscriber: cfe-commits. This patch is not actually up for review and meant to hold the remaining work done after https://reviews.llvm.org/D47017 but haven't submitted for review yet. This patch contains: -

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-07-25 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. @aaron.ballman @rsmith Any more feedback on this patch? Repository: rC Clang https://reviews.llvm.org/D49511 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-07-23 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: include/clang/Basic/AttrDocs.td:3426 + let Content = [{ +The ``noderef`` attribute causes clang to throw a warning whenever a pointer marked with +this attribute is dereferenced. This is ideally used with pointers that point to

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-07-23 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 156826. leonardchan marked 21 inline comments as done. Repository: rC Clang https://reviews.llvm.org/D49511 Files: include/clang/AST/Type.h include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td include/clang/Basic/DiagnosticSemaKinds.td

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-07-20 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. In https://reviews.llvm.org/D49511#1168692, @rsmith wrote: > The way in which you're checking for the problematic cases is unnecessarily > expensive. Instead of performing a separate AST traversal, please detect > whether you should be producing the warning

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-07-20 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 156634. leonardchan marked 2 inline comments as done. Repository: rC Clang https://reviews.llvm.org/D49511 Files: include/clang/AST/Type.h include/clang/Basic/Attr.td include/clang/Basic/AttrDocs.td include/clang/Basic/DiagnosticGroups.td

[PATCH] D48661: [Fixed Point Arithmetic] Fixed Point Constant

2018-07-19 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 156280. leonardchan marked an inline comment as done. Repository: rC Clang https://reviews.llvm.org/D48661 Files: include/clang/AST/ASTContext.h include/clang/Basic/FixedPoint.h include/clang/Basic/TargetInfo.h lib/AST/ASTContext.cpp

[PATCH] D48661: [Fixed Point Arithmetic] Fixed Point Constant

2018-07-18 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 156174. leonardchan marked 3 inline comments as done. Repository: rC Clang https://reviews.llvm.org/D48661 Files: include/clang/AST/ASTContext.h include/clang/Basic/FixedPoint.h include/clang/Basic/TargetInfo.h lib/AST/ASTContext.cpp

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-07-18 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 156167. leonardchan added a comment. - Added checks for expressions in statements other than declarations or expression statements Repository: rC Clang https://reviews.llvm.org/D49511 Files: include/clang/AST/Type.h include/clang/Basic/Attr.td

[PATCH] D49511: [Sema/Attribute] Check for noderef attribute

2018-07-18 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan created this revision. leonardchan added reviewers: phosek, mcgrathr. leonardchan added a project: clang. This patch adds the `noderef` attribute in clang and checks for dereferences of types that have this attribute. This attribute is currently used by sparse and would like to be

[PATCH] D49327: [Fixed Point Arithmetic] Fix for bug where integer literals could be treated as fixed point literals

2018-07-17 Thread Leonard Chan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC337289: [Fixed Point Arithmetic] Fix for bug where integer literals could be treated as… (authored by leonardchan, committed by ). Changed prior to commit:

[PATCH] D48661: [Fixed Point Arithmetic] Fixed Point Constant

2018-07-13 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. @ebevhan Any followup on the patch/my previous comments? Repository: rC Clang https://reviews.llvm.org/D48661 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-07-13 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. @erichkeane I created a patch at https://reviews.llvm.org/D49327 with the fix for this and added you as a reviewer. Repository: rC Clang https://reviews.llvm.org/D46915 ___ cfe-commits mailing list

[PATCH] D49327: [Fixed Point Arithmetic] Fix for bug where integer literals could be treated as fixed point literals

2018-07-13 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan created this revision. leonardchan added reviewers: erichkeane, ebevhan, rjmccall, rsmith, jakehehrlich, mcgrathr, phosek. leonardchan added a project: clang. This addresses a bug brought up in https://bugs.llvm.org/show_bug.cgi?id=38161 where integer literals could be treated as

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-07-13 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. In https://reviews.llvm.org/D46915#1162038, @erichkeane wrote: > See this bug here: https://bugs.llvm.org/show_bug.cgi?id=38161 > > This patch doesn't seem to properly consider integers, and ignores octals, > which I suspect shouldn't be the case. I just requested

[PATCH] D48661: [Fixed Point Arithmetic] Fixed Point Constant

2018-07-06 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: lib/Basic/FixedPoint.cpp:40 + if (DstWidth > Val.getBitWidth()) +Val = Val.extend(DstWidth); + if (Upscaling) ebevhan wrote: > leonardchan wrote: > > ebevhan wrote: > > > It should be possible to replace this

[PATCH] D48661: [Fixed Point Arithmetic] Fixed Point Constant

2018-07-06 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 154465. leonardchan marked 4 inline comments as done. Repository: rC Clang https://reviews.llvm.org/D48661 Files: include/clang/AST/ASTContext.h include/clang/Basic/FixedPoint.h include/clang/Basic/TargetInfo.h lib/AST/ASTContext.cpp

[PATCH] D48661: [Fixed Point Arithmetic] Fixed Point Constant

2018-07-03 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 154020. leonardchan marked 2 inline comments as done. leonardchan added a comment. - Renamed `fixedPointSemantics` to `FixedPointSemantics` and hid the members behind getters Repository: rC Clang https://reviews.llvm.org/D48661 Files:

[PATCH] D48661: [Fixed Point Arithmetic] Fixed Point Constant

2018-07-03 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: lib/Basic/FixedPoint.cpp:40 + if (DstWidth > Val.getBitWidth()) +Val = Val.extend(DstWidth); + if (Upscaling) ebevhan wrote: > It should be possible to replace this with `extOrTrunc` and move it below the >

[PATCH] D48661: [Fixed Point Arithmetic] Fixed Point Constant

2018-07-03 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 153924. leonardchan marked 7 inline comments as done. Repository: rC Clang https://reviews.llvm.org/D48661 Files: include/clang/AST/ASTContext.h include/clang/Basic/FixedPoint.h include/clang/Basic/TargetInfo.h lib/AST/ASTContext.cpp

[PATCH] D48661: [Fixed Point Arithmetic] Fixed Point Constant

2018-07-02 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: include/clang/Basic/FixedPoint.h:31 + SatNoPadding, +}; + ebevhan wrote: > rjmccall wrote: > > I figured you'd want this to be a struct which include the scale, width, > > signed-ness, and saturating-ness; and

[PATCH] D48661: [Fixed Point Arithmetic] Fixed Point Constant

2018-07-02 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 153821. leonardchan marked 10 inline comments as done. leonardchan edited the summary of this revision. leonardchan added a comment. - Added tests - Moved all conversion logic into `convert` - Saturation is checked by checking the bits above the sign bit

[PATCH] D48727: [Fixed Point Arithmetic] Rename `-fsame-fbits` flag

2018-06-29 Thread Leonard Chan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC335993: [Fixed Point Arithmetic] Rename `-fsame-fbits` flag (authored by leonardchan, committed by ). Repository: rC Clang https://reviews.llvm.org/D48727 Files: include/clang/Basic/LangOptions.def

[PATCH] D48661: [Fixed Point Arithmetic] Fixed Point Constant

2018-06-28 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 153426. leonardchan marked 8 inline comments as done. leonardchan added a comment. Herald added a subscriber: mgorny. - Renamed to APFixedPoint - Added `FixedPointSemantics` to represent saturation and whether or not padding is involved. Similar to

[PATCH] D48661: [Fixed Point Arithmetic] Fixed Point Constant

2018-06-28 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: include/clang/Basic/FixedPoint.h:23 + +class FixedPointNumber { + public: rjmccall wrote: > ebevhan wrote: > > rjmccall wrote: > > > The established naming convention here — as seen in `APInt`, `APFloat`, > > >

[PATCH] D48727: [Fixed Point Arithmetic] Rename `-fsame-fbits` flag

2018-06-28 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. Oh, having the same number of fractional bits is what leads to unsigned types having one bit of padding, and vice versa. If this flag is set to false, then the integral and fractional parts of the unsigned types take up the whole bit width of the underlying scaled

[PATCH] D48727: [Fixed Point Arithmetic] Rename `-fsame-fbits` flag

2018-06-28 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 153335. leonardchan added a comment. Formatting and forgot to get rid of `Group` and `Flags` Repository: rC Clang https://reviews.llvm.org/D48727 Files: include/clang/Basic/LangOptions.def include/clang/Basic/TargetInfo.h

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-28 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: include/clang/Basic/TargetInfo.h:90 + // by default. + bool SameFBits; + rjmccall wrote: > Sorry for the extremely late review, but this really needs to be renamed. > Please remember that other compiler

[PATCH] D48727: [Fixed Point Arithmetic] Rename `-fsame-fbits` flag

2018-06-28 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan created this revision. leonardchan added reviewers: phosek, mcgrathr, jakehehrlich, rjmccall, ebevhan, rsmith. leonardchan added a project: clang. - Rename the `-fsame-fbits` flag to `-fpadding-on-unsigned-fixed-point` - Move the flag from a driver option to a cc1 option - Rename the

[PATCH] D48661: [Fixed Point Arithmetic] Fixed Point Constant

2018-06-27 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan created this revision. leonardchan added reviewers: phosek, mcgrathr, jakehehrlich, rsmith, ebevhan, rjmccall. leonardchan added a project: clang. This patch proposes an abstract type that represents fixed point numbers, similar to APInt or APSInt that was discussed in

[PATCH] D48456: [Fixed Point Arithmetic] Casting between fixed point types and other arithmetic types

2018-06-22 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 152525. leonardchan added a comment. - Add test case for fix where 0.0r would resolve as -1 when creating a fixed point literal. Repository: rC Clang https://reviews.llvm.org/D48456 Files: include/clang/AST/ASTContext.h

[PATCH] D48456: [Fixed Point Arithmetic] Casting between fixed point types and other arithmetic types

2018-06-21 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 152385. Repository: rC Clang https://reviews.llvm.org/D48456 Files: include/clang/AST/ASTContext.h include/clang/AST/OperationKinds.def include/clang/AST/Type.h include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/TargetInfo.h

[PATCH] D46926: [Fixed Point Arithmetic] Conversion between Fixed Point and Floating Point Numbers

2018-06-21 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan abandoned this revision. leonardchan added a comment. The logic in this patch is moved to https://reviews.llvm.org/D48456 Repository: rC Clang https://reviews.llvm.org/D46926 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D48456: [Fixed Point Arithmetic] Casting between fixed point types and other arithmetic types

2018-06-21 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan created this revision. leonardchan added reviewers: phosek, mcgrathr, jakehehrlich, rsmith, ebevhan. leonardchan added a project: clang. leonardchan added a dependency: D46917: [Fixed Point Arithmetic] Comparison and Unary Operations for Fixed Point Types. Add support for casting

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-20 Thread Leonard Chan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. leonardchan marked an inline comment as done. Closed by commit rC335148: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals (authored by leonardchan, committed by ). Repository: rC Clang

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-19 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 151919. leonardchan marked 2 inline comments as done. Repository: rC Clang https://reviews.llvm.org/D46915 Files: include/clang-c/Index.h include/clang/AST/ASTContext.h include/clang/AST/Expr.h include/clang/AST/RecursiveASTVisitor.h

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-19 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan marked an inline comment as done. leonardchan added inline comments. Comment at: lib/Sema/SemaExpr.cpp:1248 + bool RHSFixed = RHSType->isFixedPointType(); + + if (LHSFixed && RHSFixed) { ebevhan wrote: > leonardchan wrote: > > leonardchan wrote: >

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-18 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: lib/Sema/SemaExpr.cpp:1248 + bool RHSFixed = RHSType->isFixedPointType(); + + if (LHSFixed && RHSFixed) { ebevhan wrote: > ebevhan wrote: > > leonardchan wrote: > > > leonardchan wrote: > > > > ebevhan wrote: > >

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-18 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 151744. leonardchan added a comment. - Removed CK_IntegralToFixedPoint to be added to later patch addressing conversion - Create CXString for FixedPointLiteral Repository: rC Clang https://reviews.llvm.org/D46915 Files: include/clang-c/Index.h

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-14 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 151433. leonardchan added a comment. - Removed the functions for performing casting between fixed point types to a common type when performing a binary operation since operations should be performed on the types as is. Also this patch is meant more for

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-14 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 151431. leonardchan added a comment. Removed FractFBits property. Fractional bits for _Fract types are now one less the _Fract width unless `SameFBits` is specified. In that case, the number of FBits in unsigned _Fract is the same as that of signed

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-14 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: include/clang/Basic/TargetInfo.h:89 + // corresponding unsaturated types. + unsigned char ShortAccumFBits, ShortAccumIBits; + unsigned char AccumFBits, AccumIBits; ebevhan wrote: > leonardchan wrote: > > ebevhan

[PATCH] D46911: [Fixed Point Arithmetic] Addition of the remaining fixed point types and their saturated equivalents

2018-06-14 Thread Leonard Chan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL334718: [Fixed Point Arithmetic] Addition of the remaining fixed point types and their… (authored by leonardchan, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit:

[PATCH] D46911: [Fixed Point Arithmetic] Addition of the remaining fixed point types and their saturated equivalents

2018-06-14 Thread Leonard Chan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC334718: [Fixed Point Arithmetic] Addition of the remaining fixed point types and their… (authored by leonardchan, committed by ). Repository: rL LLVM https://reviews.llvm.org/D46911 Files:

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-13 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: include/clang/Basic/TargetInfo.h:89 + // corresponding unsaturated types. + unsigned char ShortAccumFBits, ShortAccumIBits; + unsigned char AccumFBits, AccumIBits; ebevhan wrote: > leonardchan wrote: > > ebevhan

[PATCH] D46911: [Fixed Point Arithmetic] Addition of the remaining fixed point types and their saturated equivalents

2018-06-13 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: test/Frontend/fixed_point_bit_widths.c:44 + +// CHECK-NEXT: @size_SsF = dso_local global i{{[0-9]+}} 2 +// CHECK-NEXT: @size_SF = dso_local global i{{[0-9]+}} 4 ebevhan wrote: > Wait; should these dso_local be

[PATCH] D46911: [Fixed Point Arithmetic] Addition of the remaining fixed point types and their saturated equivalents

2018-06-13 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 151184. leonardchan marked an inline comment as done. Repository: rC Clang https://reviews.llvm.org/D46911 Files: include/clang/AST/ASTContext.h include/clang/AST/BuiltinTypes.def include/clang/AST/Type.h

[PATCH] D47030: [Fixed Point Arithmetic] Checks for Precision Macros

2018-06-12 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan abandoned this revision. leonardchan added a comment. No longer setting fractional and integral bits at configure time. These values are set and checked in TargetInfo. Repository: rC Clang https://reviews.llvm.org/D47030 ___

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-12 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: include/clang/Basic/TargetInfo.h:89 + // corresponding unsaturated types. + unsigned char ShortAccumFBits, ShortAccumIBits; + unsigned char AccumFBits, AccumIBits; ebevhan wrote: > leonardchan wrote: > > ebevhan

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-12 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 151016. leonardchan marked 9 inline comments as done. Repository: rC Clang https://reviews.llvm.org/D46915 Files: include/clang/AST/ASTContext.h include/clang/AST/Expr.h include/clang/AST/OperationKinds.def

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-08 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: include/clang/AST/Type.h:6552 +// as a scaled integer. +std::string FixedPointValueToString(unsigned Radix, unsigned Scale, +uint64_t Val); ebevhan wrote: > This should probably

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-08 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 150602. leonardchan marked 14 inline comments as done. Repository: rC Clang https://reviews.llvm.org/D46915 Files: include/clang/AST/ASTContext.h include/clang/AST/Expr.h include/clang/AST/OperationKinds.def

[PATCH] D46911: [Fixed Point Arithmetic] Addition of the remaining fixed point types and their saturated equivalents

2018-06-07 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: include/clang/Sema/DeclSpec.h:670 const PrintingPolicy ); + bool SetTypeSpecSat(SourceLocation Loc, const char *, + unsigned ); ebevhan wrote: > This should take a

[PATCH] D46915: [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

2018-06-06 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments. Comment at: lib/AST/ExprConstant.cpp:9323 + if (Value.isSigned() && Value.isMinSignedValue() && E->canOverflow() && + !HandleOverflow(Info, E, -Value.extend(Value.getBitWidth() + 1), + E->getType()))

[PATCH] D46915: [Fixed Point Arithmetic] Set Fixed Point Precision Bits and Create Fixed Point Literals

2018-06-06 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 150248. leonardchan marked 20 inline comments as done. leonardchan added a comment. - Moved definition of the fractional/integral bits to TargetInfo. Checks are also performed to make sure any target specific definitions of the F/IBits follow the

[PATCH] D46911: [Fixed Point Arithmetic] Addition of the remaining fixed point types and their saturated equivalents

2018-06-05 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. @ebevhan Does everything look good in this patch? I'm almost done with the next one. Writing tests for it still. Repository: rC Clang https://reviews.llvm.org/D46911 ___ cfe-commits mailing list

[PATCH] D46084: [Fixed Point Arithmetic] Addition of the Fixed Point _Accum type

2018-06-01 Thread Leonard Chan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL333814: This diff includes changes for supporting the following types. (authored by leonardchan, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit:

[PATCH] D46911: [Fixed Point Arithmetic] Addition of the remaining fixed point types and their saturated equivalents

2018-06-01 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 149533. leonardchan marked an inline comment as done. Repository: rC Clang https://reviews.llvm.org/D46911 Files: include/clang/AST/ASTContext.h include/clang/AST/BuiltinTypes.def include/clang/AST/Type.h

[PATCH] D46084: [Fixed Point Arithmetic] Addition of the Fixed Point _Accum type

2018-06-01 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. Hi all, I'll be attempting to commit this patch around 6pm PT today unless anyone has any more comments on this specific patch. Any other suggestions regarding potential design changes can be discussed in future patches since this is only the first of many.

[PATCH] D46911: [Fixed Point Arithmetic] Addition of the remaining fixed point types and their saturated equivalents

2018-05-31 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 149360. leonardchan marked 7 inline comments as done. Repository: rC Clang https://reviews.llvm.org/D46911 Files: include/clang/AST/ASTContext.h include/clang/AST/BuiltinTypes.def include/clang/AST/Type.h

<    3   4   5   6   7   8   9   >