summaryrefslogtreecommitdiffstats
path: root/clang/utils
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang,ARM] Initial ACLE intrinsics for MVE.Simon Tatham2019-10-244-0/+1729
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit sets up the infrastructure for auto-generating <arm_mve.h> and doing clang-side code generation for the builtins it relies on, and demonstrates that it works by implementing a representative sample of the ACLE intrinsics, more or less matching the ones introduced in LLVM IR by D67158,D68699,D68700. Like NEON, that header file will provide a set of vector types like uint16x8_t and C functions with names like vaddq_u32(). Unlike NEON, the ACLE spec for <arm_mve.h> includes a polymorphism system, so that you can write plain vaddq() and disambiguate by the vector types you pass to it. Unlike the corresponding NEON code, I've arranged to make every user- facing ACLE intrinsic into a clang builtin, and implement all the code generation inside clang. So <arm_mve.h> itself contains nothing but typedefs and function declarations, with the latter all using the new `__attribute__((__clang_builtin))` system to arrange that the user- facing function names correspond to the right internal BuiltinIDs. So the new MveEmitter tablegen system specifies the full sequence of IRBuilder operations that each user-facing ACLE intrinsic should translate into. Where possible, the ACLE intrinsics map to standard IR operations such as vector-typed `add` and `fadd`; where no standard representation exists, I call down to the sample IR intrinsics introduced in an earlier commit. Doing it like this means that you get the polymorphism for free just by using __attribute__((overloadable)): the clang overload resolution decides which function declaration is the relevant one, and _then_ its BuiltinID is looked up, so by the time we're doing code generation, that's all been resolved by the standard system. It also means that you get really nice error messages if the user passes the wrong combination of types: clang will show the declarations from the header file and explain why each one doesn't match. (The obvious alternative approach would be to have wrapper functions in <arm_mve.h> which pass their arguments to the underlying builtins. But that doesn't work in the case where one of the arguments has to be a constant integer: the wrapper function can't pass the constantness through. So you'd have to do that case using a macro instead, and then use C11 `_Generic` to handle the polymorphism. Then you have to add horrible workarounds because `_Generic` requires even the untaken branches to type-check successfully, and //then// if the user gets the types wrong, the error message is totally unreadable!) Reviewers: dmgreen, miyuki, ostannard Subscribers: mgorny, javed.absar, kristof.beyls, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67161
* [analyzer] exploded-graph-rewriter: Rename Environment to Expressions.Artem Dergachev2019-10-181-1/+1
| | | | | | It's less confusing for newcomers. llvm-svn: 375282
* [analyzer] exploded-graph-rewriter: Fix dump for state 0.Artem Dergachev2019-10-181-2/+12
| | | | | | It shouldn't say "unspecified" when the state is specified to be empty. llvm-svn: 375279
* [analyzer] Assign truly stable identifiers to exploded nodes.Artem Dergachev2019-10-171-18/+25
| | | | | | | | | | | ExplodedGraph nodes will now have a numeric identifier stored in them which will keep track of the order in which the nodes were created and it will be fully deterministic both accross runs and across machines. This is extremely useful for debugging as it allows reliably setting conditional breakpoints by node IDs. llvm-svn: 375186
* [analyzer] Display cast kinds in program point dumps.Artem Dergachev2019-10-171-1/+5
| | | | | | | Because cast expressions have their own hierarchy, it's extremely useful to have some information about what kind of casts are we dealing with. llvm-svn: 375185
* [analyzer] exploded-graph-rewriter: Make node headers a bit lighter.Artem Dergachev2019-10-171-1/+1
| | | | | | The 50% grey color is too dark on some monitors. llvm-svn: 375184
* [ARM] Fix arm_neon.h with -flax-vector-conversions=none, part 3Eli Friedman2019-10-171-1/+2
| | | | | | | | | | | | | | It's completely impossible to check that I've actually found all the issues, due to the use of macros in arm_neon.h, but hopefully this time it'll take more than a few hours for someone to find another issue. I have no idea why, but apparently there's a rule that some, but not all, builtins which should take an fp16 vector actually take an int8 vector as an argument. Fix this, and add test coverage. Differential Revision: https://reviews.llvm.org/D68838 llvm-svn: 375179
* [ARM] Fix arm_neon.h with -flax-vector-conversions=none, part 2.Eli Friedman2019-10-101-1/+4
| | | | | | | | | | | | | | | | | | | | | Just running -fsyntax-only over arm_neon.h doesn't cover some intrinsics which are defined using macros. Add more test coverage for that. arm-neon-header.c wasn't checking the full set of available NEON target features; change the target architecture of the test to account for that. Fix the generator for arm_neon.h to generate casts in more cases where they are necessary. Fix VFMLAL_LOW etc. to express their signatures differently, so the builtins have the expected type. Maybe the TableGen backend should detect intrinsics that are defined the wrong way, and produce an error. The rules here are sort of strange. Differential Revision: https://reviews.llvm.org/D68743 llvm-svn: 374419
* [ARM] Fix arm_neon.h with -flax-vector-conversions=noneEli Friedman2019-10-091-2/+2
| | | | | | | | | | | | | | Really, we were already 99% of the way there; just needed a couple minor fixes that affected 64-bit-only builtins. Based on D61717. Note that the change to builtin_str changes the type of a few __builtin_neon_* intrinsics that had the "wrong" type. Fixes https://bugs.llvm.org/show_bug.cgi?id=43341 Differential Revision: https://reviews.llvm.org/D68683 llvm-svn: 374191
* [clang] [cmake] Add distribution install targets for remaining componentsMichal Gorny2019-10-041-1/+8
| | | | | | | | | Add install targets as necessary to install bash-autocomplete, scan-build and scan-view via LLVM_DISTRIBUTION_TARGETS. Differential Revision: https://reviews.llvm.org/D68413 llvm-svn: 373695
* Emit TypeNodes.def with tblgen.John McCall2019-10-014-0/+228
| | | | | | | | | | | | | | | | | | The primary goal here is to make the type node hierarchy available to other tblgen backends, although it should also make it easier to generate more selective x-macros in the future. Because tblgen doesn't seem to allow backends to preserve the source order of defs, this is not NFC because it significantly re-orders IDs. I've fixed the one (fortunately obvious) place where we relied on the old order. Unfortunately, I wasn't able to share code with the existing AST-node x-macro generators because the x-macro schema we use for types is different in a number of ways. The main loss is that subclasses aren't ordered together, which doesn't seem important for types because the hierarchy is generally very shallow with little clustering. llvm-svn: 373407
* Use scope qualifiers in Clang's tblgen backends to get usefulJohn McCall2019-10-0111-64/+37
| | | | | | redeclaration checking. NFC. llvm-svn: 373406
* [OpenCL] Add version handling and add vector ld/st builtinsSven van Haastregt2019-09-191-7/+15
| | | | | | | | | | | | | | | | | | | Allow setting a MinVersion, stating from which OpenCL version a builtin function is available, and a MaxVersion, stating from which OpenCL version a builtin function should not be available anymore. Guard some definitions of the "work-item" builtin functions according to the OpenCL versions from which they are available. Add the "vector data load and store" builtin functions (e.g. vload/vstore), whose signatures differ before and after OpenCL 2.0 in the pointer argument address spaces. Patch by Pierre Gondois and Sven van Haastregt. Differential Revision: https://reviews.llvm.org/D63504 llvm-svn: 372321
* Add SpellingNotCalculated to Attribute Enums to suppress UBSan warningsErich Keane2019-09-171-0/+8
| | | | | | | UBSan downstreams noticed that the assignment of SpellingNotCalculated to the spellings caused warnings. llvm-svn: 372124
* Move some definitions from Sema to Basic to fix shared libs buildErich Keane2019-09-161-17/+17
| | | | | | | | r371875 moved some functionality around to a Basic header file, but didn't move its definitions as well. This patch moves some things around so that shared library building can work. llvm-svn: 371985
* Fix build error in 371875Erich Keane2019-09-131-2/+2
| | | | | | | | | Apparently Clang complains about the name hiding here in a way that my GCC build does not, so a shocking number of buildbots decided to tell me about it. Change the name of the variable to prevent the name hiding and hope we don't have to fix this again. llvm-svn: 371876
* [NFCI]Create CommonAttributeInfo Type as base type of *Attr and ParsedAttr.Erich Keane2019-09-131-57/+107
| | | | | | | | | | | | In order to enable future improvements to our attribute diagnostics, this moves info from ParsedAttr into CommonAttributeInfo, then makes this type the base of the *Attr and ParsedAttr types. Quite a bit of refactoring took place, including removing a bunch of redundant Spelling Index propogation. Differential Revision: https://reviews.llvm.org/D67368 llvm-svn: 371875
* [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-09-134-0/+368
| | | | | | | | | | | | | | | | | | Summary: This patch introduces the skeleton of the constexpr interpreter, capable of evaluating a simple constexpr functions consisting of if statements. The interpreter is described in more detail in the RFC. Further patches will add more features. Reviewers: Bigcheese, jfb, rsmith Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64146 llvm-svn: 371834
* [OpenCL] Add image type handling for builtinsSven van Haastregt2019-09-051-3/+67
| | | | | | | | | | | | | | | | | | | Image types were previously available, but not working. This patch adds image type handling. Rename the image type definitions in the .td file to make them consistent with other type names. Use abstract types to represent the unqualified types. Instantiate access-qualified image types at the point of use using, e.g. `ImageType<Image2d, "RO">`. Add/update TableGen definitions for the read_image/write_image builtin functions. Patch by Pierre Gondois and Sven van Haastregt. Differential Revision: https://reviews.llvm.org/D63480 llvm-svn: 371046
* Revert "[Clang Interpreter] Initial patch for the constexpr interpreter"Roman Lebedev2019-09-044-368/+0
| | | | | | | | | Breaks BUILD_SHARED_LIBS build, introduces cycles in library dependency graphs. (clangInterp depends on clangAST which depends on clangInterp) This reverts r370839, which is an yet another recommit of D64146. llvm-svn: 370874
* [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-09-044-0/+368
| | | | | | | | | | | | | | | | | | Summary: This patch introduces the skeleton of the constexpr interpreter, capable of evaluating a simple constexpr functions consisting of if statements. The interpreter is described in more detail in the RFC. Further patches will add more features. Reviewers: Bigcheese, jfb, rsmith Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64146 llvm-svn: 370839
* [OpenCL] Drop spurious semicolon in generated file; NFCSven van Haastregt2019-09-031-1/+1
| | | | llvm-svn: 370744
* [ARM NEON] Avoid duplicated decarationsDiogo N. Sampaio2019-09-031-3/+22
| | | | | | | | | | | | | | | | | | | | | | Summary: The declaration of arm neon intrinsics that are "big endian safe" print the same code for big and small endian targets. This patch avoids duplicates by checking if an intrinsic is safe to have a single definition. (decreases header 11k lines out of 73k). Reviewers: t.p.northover, ostannard, labrinea Reviewed By: ostannard Subscribers: kristof.beyls, cfe-commits, olista01 Tags: #clang Differential Revision: https://reviews.llvm.org/D66588 llvm-svn: 370716
* Revert [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-09-024-368/+0
| | | | | | This reverts r370636 (git commit 8327fed9475a14c3376b4860c75370c730e08f33) llvm-svn: 370642
* [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-09-024-0/+368
| | | | | | | | | | | | | | | | | | Summary: This patch introduces the skeleton of the constexpr interpreter, capable of evaluating a simple constexpr functions consisting of if statements. The interpreter is described in more detail in the RFC. Further patches will add more features. Reviewers: Bigcheese, jfb, rsmith Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64146 llvm-svn: 370636
* Revert [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-08-314-368/+0
| | | | | | This reverts r370584 (git commit afcb3de117265a69d21e5673356e925a454d7d02) llvm-svn: 370588
* [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-08-314-0/+368
| | | | | | | | | | | | | | | | | | Summary: This patch introduces the skeleton of the constexpr interpreter, capable of evaluating a simple constexpr functions consisting of if statements. The interpreter is described in more detail in the RFC. Further patches will add more features. Reviewers: Bigcheese, jfb, rsmith Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64146 llvm-svn: 370584
* Revert [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-08-304-368/+0
| | | | | | This reverts r370531 (git commit d4c1002e0bbbbab50f6891cdd2f5bd3a8f3a3584) llvm-svn: 370535
* [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-08-304-0/+368
| | | | | | | | | | | | | | | | | | Summary: This patch introduces the skeleton of the constexpr interpreter, capable of evaluating a simple constexpr functions consisting of if statements. The interpreter is described in more detail in the RFC. Further patches will add more features. Reviewers: Bigcheese, jfb, rsmith Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64146 llvm-svn: 370531
* Revert [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-08-304-368/+0
| | | | | | This reverts r370476 (git commit a5590950549719d0d9ea69ed164b0c8c0f4e02e6) llvm-svn: 370481
* [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-08-304-0/+368
| | | | | | | | | | | | | | | | | | Summary: This patch introduces the skeleton of the constexpr interpreter, capable of evaluating a simple constexpr functions consisting of if statements. The interpreter is described in more detail in the RFC. Further patches will add more features. Reviewers: Bigcheese, jfb, rsmith Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64146 llvm-svn: 370476
* [OpenCL] Microoptimize OCL2Qual a bitBenjamin Kramer2019-08-241-9/+11
| | | | | | Still not optimal, but makes clang 25k smaller. llvm-svn: 369846
* Retire llvm::less_ptr. llvm::deref is much more flexible.Benjamin Kramer2019-08-221-2/+2
| | | | llvm-svn: 369675
* [OpenCL] Add const, volatile and pointer builtin handlingSven van Haastregt2019-08-201-2/+36
| | | | | | | | | | | | | | Const, volatile, and pointer types were previously available, but not working. This patch adds handling for OpenCL builtin functions. Add TableGen definitions for some atomic and asynchronous builtins to make use of the new functionality. Patch by Pierre Gondois and Sven van Haastregt. Differential Revision: https://reviews.llvm.org/D63442 llvm-svn: 369373
* [OpenCL] Add generic type handling for builtin functionsSven van Haastregt2019-08-191-103/+326
| | | | | | | | | | | | | | | | | | Generic types are an abstraction of type sets. It mimics the way functions are defined in the OpenCL specification. For example, floatN can abstract all the vector sizes of the float type. This allows to * stick more closely to the specification, which uses generic types; * factorize definitions of functions with numerous prototypes in the tablegen file; and * reduce the memory impact of functions with many overloads. Patch by Pierre Gondois and Sven van Haastregt. Differential Revision: https://reviews.llvm.org/D65456 llvm-svn: 369253
* [Clang] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-142-26/+26
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368942
* [analyzer] exploded-graph-rewriter: Implement displaying Store pointers.Artem Dergachev2019-08-131-0/+4
| | | | | | | | | They're useful when trying to understand what's going on inside your LazyCompoundValues. Differential Revision: https://reviews.llvm.org/D65427 llvm-svn: 368769
* [analyzer] exploded-graph-rewriter: Implement manual graph trimming.Artem Dergachev2019-08-131-0/+54
| | | | | | | | | | | | | | | | | | | When -trim-egraph is unavailable (say, when you're debugging a crash on a real-world code that takes too long to reduce), it makes sense to view the untrimmed graph up to the crashing node's predecessor, then dump the ID (or a pointer) of the node in the attached debugger, and then trim the dumped graph in order to keep only paths from the root to the node. The newly added --to flag does exactly that: $ exploded-graph-rewriter.py ExprEngine.dot --to 0x12229acd0 Multiple nodes can be specified. Stable IDs of nodes can be used instead of pointers. Differential Revision: https://reviews.llvm.org/D65345 llvm-svn: 368768
* [analyzer] exploded-graph-rewriter: NFC: Refactor explorers into trimmers.Artem Dergachev2019-08-131-26/+33
| | | | | | | | | | | | | | | | | | | | | | | Explorers aren't the right abstraction. For the purposes of displaying svg files we don't care in which order do we explore the nodes. We may care about this for other analyses, but we're not there yet. The function of cutting out chunks of the graph is performed poorly by the explorers, because querying predecessors/successors on the explored nodes yields original successors/predecessors even if they aren't being explored. Introduce a new entity, "trimmers", that do one thing but to it right: cut out chunks of the graph. Trimmers mutate the graph, so stale edges aren't even visible to their consumers in the pipeline. Additionally, trimmers are intrinsically composable: multiple trimmers can be applied to the graph sequentially. Refactor the single-path explorer into the single-path trimmer. Rename the test file for consistency. Differential Revision: https://reviews.llvm.org/D65344 llvm-svn: 368767
* [analyzer] exploded-graph-rewriter: Open the converted graph immediately.Artem Dergachev2019-08-131-7/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | Change the default behavior: the tool no longer dumps the rewritten .dot file to stdout, but instead it automatically converts it into an .html file (which essentially wraps an .svg file) and immediately opens it with the default web browser. This means that the tool should now be fairly easy to use: $ exploded-graph-rewriter.py /tmp/ExprEngine.dot The benefits of wrapping the .svg file into an .html file are: - It'll open in a web browser, which is the intended behavior. An .svg file would be open with an image viewer/editor instead. - It avoids the white background around the otherwise dark svg area in dark mode. The feature can be turned off by passing a flag '--rewrite-only'. The LIT substitution is updated to enforce the old mode because we don't want web browsers opening on our buildbots. Differential Revision: https://reviews.llvm.org/D65250 llvm-svn: 368766
* Improve MSVC visualizations so the parser shows where we are in the codeMike Spertus2019-08-061-0/+46
| | | | | | Also provide a visualizer for lambda introducers llvm-svn: 368029
* Improve MSVC visualizers for DeclSpec and TemplateNameMike Spertus2019-07-291-2/+79
| | | | | | | | DeclSpec now shows the TypeRep, ExprRep, or DeclRep as appropriate TemplateName decodes and displays the StorageType A few minor refinements to other types llvm-svn: 367199
* Add lifetime categories attributesMatthias Gehre2019-07-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is the first part of work announced in "[RFC] Adding lifetime analysis to clang" [0], i.e. the addition of the [[gsl::Owner(T)]] and [[gsl::Pointer(T)]] attributes, which will enable user-defined types to participate in the lifetime analysis (which will be part of the next PR). The type `T` here is called "DerefType" in the paper, and denotes the type that an Owner owns and a Pointer points to. E.g. `std::vector<int>` should be annotated with `[[gsl::Owner(int)]]` and a `std::vector<int>::iterator` with `[[gsl::Pointer(int)]]`. [0] http://lists.llvm.org/pipermail/cfe-dev/2018-November/060355.html Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63954 llvm-svn: 367040
* Revert "NFC: utils/perf-training: Python 3 compatibility for lit.cfg"Azharuddin Mohammed2019-07-241-1/+1
| | | | | | | | | This reverts commit 9178b10163f758cbf8a5290ea6a827990427ddc0 (r365969). We are back to using Python2 and this is failing. This should instead be made to be compatible with both Python 2 and 3. llvm-svn: 366953
* [OpenCL] Make TableGen'd builtin tables and helper functions staticTom Stellard2019-07-151-3/+3
| | | | | | | | | | | | | | Reviewers: Pierre, Anastasia Reviewed By: Anastasia Subscribers: yaxunl, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64608 llvm-svn: 366143
* Template-related improvements to Visual Studio visualizersMike Spertus2019-07-131-7/+48
| | | | llvm-svn: 366007
* This reverts commit 632a36bfcfc8273c1861f04ff6758d863c47c784.Sylvestre Ledru2019-07-131-0/+1
| | | | | | | | | | | | Some targets such as Python 2.7.16 still use VERSION in their builds. Without VERSION defined, the source code has syntax errors. Reverting as it will probably break many other things. Noticed by Sterling Augustine llvm-svn: 365992
* NFC: utils/perf-training: Python 3 compatibility for lit.cfgAlex Lorenz2019-07-121-1/+1
| | | | | | The output of subprocess.check_output is now bytes. We need to decode it. llvm-svn: 365969
* Remove __VERSION__Sylvestre Ledru2019-07-121-1/+0
| | | | | | | | | | | | | | | | | | | | Summary: It has been introduced in 2011 for gcc compat: https://github.com/llvm-mirror/clang/commit/ad1a4c6e89594e704775ddb6b036ac982fd68cad it is probably time to remove it Reviewers: rnk, dexonsmith Reviewed By: rnk Subscribers: dschuff, aheejin, fedor.sergeev, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64062 llvm-svn: 365962
* [analyzer] exploded-graph-rewriter: Improve source location dumps.Artem Dergachev2019-07-121-26/+38
| | | | | | | | - Correctly display macro expansion and spelling locations. - Use the same procedure to display location context call site locations. - Display statement IDs for program points. llvm-svn: 365861
OpenPOWER on IntegriCloud