summaryrefslogtreecommitdiff
path: root/utils
Commit message (Collapse)AuthorAge
* Fixing the position of the supported syntax marker when generating attribute ↵Aaron Ballman2014-06-25
| | | | | | documentation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211692 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace some assert(0)'s with llvm_unreachable.Craig Topper2014-06-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211143 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace some assert(0)'s with llvm_unreachable.Craig Topper2014-06-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211139 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert assert(0) to llvm_unreachable to silence a warning about Addend ↵Craig Topper2014-06-18
| | | | | | being uninitialized in default case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211138 91177308-0d34-0410-b5e6-96231b3b80d8
* Rewrite ARM NEON intrinsic emission completely.James Molloy2014-06-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There comes a time in the life of any amateur code generator when dumb string concatenation just won't cut it any more. For NeonEmitter.cpp, that time has come. There were a bunch of magic type codes which meant different things depending on the context. There were a bunch of special cases that really had no reason to be there but the whole thing was so creaky that removing them would cause something weird to fall over. There was a 1000 line switch statement for code generation involving string concatenation, which actually did lexical scoping to an extent (!!) with a bunch of semi-repeated cases. I tried to refactor this three times in three different ways without success. The only way forward was to rewrite the entire thing. Luckily the testing coverage on this stuff is absolutely massive, both with regression tests and the "emperor" random test case generator. The main change is that previously, in arm_neon.td a bunch of "Operation"s were defined with special names. NeonEmitter.cpp knew about these Operations and would emit code based on a huge switch. Actually this doesn't make much sense - the type information was held as strings, so type checking was impossible. Also TableGen's DAG type actually suits this sort of code generation very well (surprising that...) So now every operation is defined in terms of TableGen DAGs. There are a bunch of operators to use, including "op" (a generic unary or binary operator), "call" (to call other intrinsics) and "shuffle" (take a guess...). One of the main advantages of this apart from making it more obvious what is going on, is that we have proper type inference. This has two obvious advantages: 1) TableGen can error on bad intrinsic definitions easier, instead of just generating wrong code. 2) Calls to other intrinsics are typechecked too. So we no longer need to work out whether the thing we call needs to be the Q-lane version or the D-lane version - TableGen knows that itself! Here's an example: before: case OpAbdl: { std::string abd = MangleName("vabd", typestr, ClassS) + "(__a, __b)"; if (typestr[0] != 'U') { // vabd results are always unsigned and must be zero-extended. std::string utype = "U" + typestr.str(); s += "(" + TypeString(proto[0], typestr) + ")"; abd = "(" + TypeString('d', utype) + ")" + abd; s += Extend(utype, abd) + ";"; } else { s += Extend(typestr, abd) + ";"; } break; } after: def OP_ABDL : Op<(cast "R", (call "vmovl", (cast $p0, "U", (call "vabd", $p0, $p1))))>; As an example of what happens if you do something wrong now, here's what happens if you make $p0 unsigned before the call to "vabd" - that is, $p0 -> (cast "U", $p0): arm_neon.td:574:1: error: No compatible intrinsic found - looking up intrinsic 'vabd(uint8x8_t, int8x8_t)' Available overloads: - float64x2_t vabdq_v(float64x2_t, float64x2_t) - float64x1_t vabd_v(float64x1_t, float64x1_t) - float64_t vabdd_f64(float64_t, float64_t) - float32_t vabds_f32(float32_t, float32_t) ... snip ... This makes it seriously easy to work out what you've done wrong in fairly nasty intrinsics. As part of this I've massively beefed up the documentation in arm_neon.td too. Things still to do / on the radar: - Testcase generation. This was implemented in the previous version and not in the new one, because - Autogenerated tests are not being run. The testcase in test/ differs from the autogenerated version. - There were a whole slew of special cases in the testcase generation that just felt (and looked) like hacks. If someone really feels strongly about this, I can try and reimplement it too. - Big endian. That's coming soon and should be a very small diff on top of this one. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211101 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the ShowInSystemHeader bit consistently for all diagnosticsAlp Toker2014-06-16
| | | | | | | | | | | | By describing system header suppressions directly in tablegen we eliminate special cases in getDiagnosticSeverity(). Dropping the reliance on builtin diagnostic classes when mapping also gets us closer to the goal of reusing the diagnostic machinery for custom diagnostics. No change in functionality. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211023 91177308-0d34-0410-b5e6-96231b3b80d8
* Adds a Pragma spelling for attributes to tablegen and makes use of it for loopTyler Nowicki2014-06-13
| | | | | | | | | | hint attributes. Includes tests for pragma printing and for attribute order which is incorrectly reversed by ParsedAttributes. Reviewed by Aaron Ballman git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210925 91177308-0d34-0410-b5e6-96231b3b80d8
* Complete the switch from mappings to declarative diagnostic severitiesAlp Toker2014-06-12
| | | | | | | | | This begins to address cognitive dissonance caused by treating the Note diagnostic level as a severity in the diagnostic engine. No change in functionality. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210758 91177308-0d34-0410-b5e6-96231b3b80d8
* Removing an "if (this == nullptr)" check from two print methods. The conditionRichard Trieu2014-06-09
| | | | | | | | will never be true in a well-defined context. The checking for null pointers has been moved into the caller logic so it does not rely on undefined behavior. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210498 91177308-0d34-0410-b5e6-96231b3b80d8
* Make Attr::Clone() also clone the Inherited, IsPackExpansion and Implicit flagsHans Wennborg2014-05-31
| | | | | | | | | | I was bitten by this when working with the dll attributes: when a dll attribute was cloned from a class template declaration to its specialization, the Inherited flag didn't get cloned. Differential Revision: http://reviews.llvm.org/D3972 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209950 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactoring. Remove release and take methods from ActionResult. Rename ↵Nikola Smiljanic2014-05-29
| | | | | | takeAs to getAs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209800 91177308-0d34-0410-b5e6-96231b3b80d8
* utils/CmpDriver: add brief documentation to indicate what this doesAlp Toker2014-05-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209268 91177308-0d34-0410-b5e6-96231b3b80d8
* Cleaning up some range-based for loops so that the automatic type deduction ↵Aaron Ballman2014-05-20
| | | | | | is more explicit about pointers and const. Did some minor drive-by const correctness fixes and identifier updates as well. No functional changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209233 91177308-0d34-0410-b5e6-96231b3b80d8
* None of these attributes require FunctionTemplate to be explicitly listed as ↵Aaron Ballman2014-05-20
| | | | | | | | part of their subject definition. FunctionTemplateDecls are not what the attribute appertains to in the first place -- it attaches to the underlying FunctionDecl. The attribute emitter was using FunctionTemplate to map the diagnostic to "functions or methods", but that isn't a particularly clear diagnostic in these cases anyway (since they do not apply to ObjC methods). Updated the attribute emitter to remove custom logic for FunctionTemplateDecl, and updated the test cases for the change in diagnostic wording. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209209 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'.Craig Topper2014-05-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208163 91177308-0d34-0410-b5e6-96231b3b80d8
* tblgen: Modularize the diagnostic emitterTobias Grosser2014-05-06
| | | | | | | | | | | | | | | | | | | Replace a large monolitic function, with per-table functions which all nicely fit on my screen. I also added documentation to each function that describes what kind of tables are generated and which information is contained and switched to range based for loops. Finally, I run clang-format over the moved code. I spent a significant amount of time to understand this code when reasoning about possible extensions to the diagnostic interface to support 'remark' diagnostics. This change will definitely help such an implementation, but already by itself it will save other people a lot of time when trying to understand this functionality. Even though the patch touches the full function, it is mostly mechanical. No functional change intended. The generated tblgen files are identical. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208136 91177308-0d34-0410-b5e6-96231b3b80d8
* Updated the attribute tablegen emitter for variadic arguments to emit a ↵Aaron Ballman2014-05-02
| | | | | | range accessor in addition to the iterators. Updated code using iterators to use range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207837 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixing a FIXME -- no longer using std::memcpy, since that would fail for ↵Aaron Ballman2014-05-01
| | | | | | non-trivial types. Replaced with std::copy. No functional changes intended since all uses of this functionality either use pointers or integers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207766 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing: remove HTML attribute validationDmitri Gribenko2014-04-30
| | | | | | | | | | | | | Since the community says that a blacklist is not good enough, and I don't have enough time now to implement a proper whitelist, let's just remove the attribute validation. But, nevertheless, we can still communicate in the generated XML if our parser found an issue with the HTML. But this bit is best-effort and is specifically called out in the schema as such. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207712 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing: in the generated XML file, mark HTML that is safe to passDmitri Gribenko2014-04-22
| | | | | | | | | | | | through to the output even if the input comment comes from an untrusted source Attribute filtering is currently based on a blacklist, which right now includes all event handler attributes (they contain JavaScipt code). It should be switched to a whitelist, but going over all of the HTML5 spec requires a significant amount of time. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206882 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapplying r204952 a second time.Aaron Ballman2014-03-31
| | | | | | | | | | Clean up the __has_attribute implementation without modifying its behavior. Replaces the tablegen-driven AttrSpellings.inc, which lived in the lexing layer with AttrHasAttributeImpl.inc, which lives in the basic layer. Updates the preprocessor to call through to this new functionality which can take additional information into account (such as scopes and syntaxes). Expose the ability for parts of the compiler to ask whether an attribute is supported for a given spelling (including scope), syntax, triple and language options. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205181 91177308-0d34-0410-b5e6-96231b3b80d8
* Reverting r204968 and r204969; while more build bots are happy with the ↵Aaron Ballman2014-03-27
| | | | | | results, some still have link errors. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204974 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapplying r204952 with fixes which should hopefully resolve linking issues ↵Aaron Ballman2014-03-27
| | | | | | with non-MSVC compilers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204968 91177308-0d34-0410-b5e6-96231b3b80d8
* Reverting r204952, while I figure out what's going on with the makefile build.Aaron Ballman2014-03-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204955 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up the __has_attribute implementation without modifying its behavior. Aaron Ballman2014-03-27
| | | | | | | | Replaces the tablegen-driven AttrSpellings.inc, which lived in the lexing layer with AttrHasAttributeImpl.inc, which lives in the basic layer. Updates the preprocessor to call through to this new functionality which can take additional information into account (such as scopes and syntaxes). Expose the ability for parts of the compiler to ask whether an attribute is supported for a given spelling (including scope), syntax, triple and language options. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204952 91177308-0d34-0410-b5e6-96231b3b80d8
* When generating the Attribute dumper code, do not dead-initialize MoreChildrenArnaud A. de Grandmaison2014-03-21
| | | | | | No functional change. This will cleanup a bunch of scan-build warnings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204529 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-11
| | | | | | class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203543 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-11
| | | | | | class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203537 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Adding override specifiers where appropriate, and removing virtual ↵Aaron Ballman2014-03-06
| | | | | | | | specifiers where not needed. No functional changes intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203122 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Using std::unique_ptr to ensure that Argument objects do not leak ↵Aaron Ballman2014-03-05
| | | | | | (since clang-tblgen isn't long-lived, the old leak is probably acceptable, but it offended my senses nonetheless). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202989 91177308-0d34-0410-b5e6-96231b3b80d8
* Pass llvm::Triple objects by const reference.Benjamin Kramer2014-03-04
| | | | | | Copying isn't cheap as it contains a std::string. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202880 91177308-0d34-0410-b5e6-96231b3b80d8
* [cleanup] Re-sort includes with llvm/utils/sort_includes.py and fixChandler Carruth2014-03-04
| | | | | | | | | | | | a missing include from CLog.h. CLog.h referenced most of the core libclang types but never directly included Index.h that provides them. Previously it got lucky and other headers were always included first but with the sorting it ended up first in one case and stopped compiling. Adding the Index.h include fixes it right up. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202810 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplifying attribute generation with range-based for loops. No functional ↵Aaron Ballman2014-03-02
| | | | | | changes intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202654 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replace llvm::next and llvm::prior with std::next and std::prev.Benjamin Kramer2014-03-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202635 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replace verbose functors with succinct lambdasBenjamin Kramer2014-03-01
| | | | | | No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202590 91177308-0d34-0410-b5e6-96231b3b80d8
* Add 'remark' diagnostic type in 'clang'Tobias Grosser2014-02-28
| | | | | | | | | | | | | | | | | | | | | | | A 'remark' is information that is not an error or a warning, but rather some additional information provided to the user. In contrast to a 'note' a 'remark' is an independent diagnostic, whereas a 'note' always depends on another diagnostic. A typical use case for remark nodes is information provided to the user, e.g. information provided by the vectorizer about loops that have been vectorized. This patch provides the initial implementation of 'remarks'. It includes the actual definiton of the remark nodes, their printing as well as basic parameter handling. We are reusing the existing diagnostic parameters which means a remark can be enabled with normal '-Wdiagnostic-name' flags and can be upgraded to an error using '-Werror=diagnostic-name'. '-Werror' alone does not upgrade remarks. This patch is by intention minimal in terms of parameter handling. More experience and more discussions will most likely lead to further enhancements in the parameter handling. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202475 91177308-0d34-0410-b5e6-96231b3b80d8
* ARM NEON: add _f16 support to a couple of vector-shuffling intrinsics.Tim Northover2014-02-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202137 91177308-0d34-0410-b5e6-96231b3b80d8
* [AArch64] Change int64_t from 'long long int' to 'long int' for AArch64 target.Kevin Qin2014-02-24
| | | | | | | | | | Most 64-bit targets define int64_t as long int, and AArch64 should make same definition to follow LP64 model. In GNU tool chain, int64_t is defined as long int for 64-bit target. So to get consistent with GNU, it's better Changing int64_t from 'long long int' to 'long int', otherwise clang will get different name mangling suffix compared with g++. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202004 91177308-0d34-0410-b5e6-96231b3b80d8
* Moving the documentation for the type safety checking attributes into ↵Aaron Ballman2014-02-21
| | | | | | AttrDocs. If a custom heading is provided, do not automatically generate the alternate spelling list. This is necessary because some attributes have distinct semantic spellings and meanings, but use the same semantic attribute internally. Such attributes should have multiple elements in their documentation list, but not show all spellings. At some point, it would be nice to have a way to attach the documentation element to a specific spelling for these cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201851 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactored the way attribute category headers are handled so that it is ↵Aaron Ballman2014-02-19
| | | | | | possible to use custom categories. This allows for moving the consumable attributes (consumable, callable_when, return_typestate, etc) to be grouped together, with a content heading, like they were in the language extensions documentation. Moved the consumable attribute documentation from the language extensions into the attribute documentation table. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201732 91177308-0d34-0410-b5e6-96231b3b80d8
* Added a documentation category for statement attributes so that things like ↵Aaron Ballman2014-02-19
| | | | | | clang::fallthrough can be documented. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201714 91177308-0d34-0410-b5e6-96231b3b80d8
* AArch64: look up EmitAArch64Scalar support before calling.Tim Northover2014-02-19
| | | | | | | | | | | | This fixes one immediate bug where an expression with side-effects could be emitted twice during a NEON call. It also prepares the way for folding CodeGen for many of the SISD intrinsics into a table, reducing code size and hopefully increasing performance eventually ("binary search + few switch cases" should be better than "lots of switch cases"). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201667 91177308-0d34-0410-b5e6-96231b3b80d8
* ARM & AArch64: move struct definition outside function.Tim Northover2014-02-19
| | | | | | | | Apparently it's not True C++. rdar://problem/16035743 still. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201663 91177308-0d34-0410-b5e6-96231b3b80d8
* ARM NEON: use more flexible TableGen field for defs.Tim Northover2014-02-19
| | | | | | | | | | | | | | | | | | | | We used to have special handling for isCrypto and isA64 bits in the NeonEmitter.cpp file (it knew the former was predicated on __ARM_FEATURE_CRYPTO and the latter on __aarch64__ and went through various contortions to make sure the correct intrinsics were emitted under the correct guard. This is ugly and has obvious scalability problems (e.g. vcvtX intrinsics are needed, which are ARMv8 only but available on both, yet another category). This patch moves the #if predicate into the arm_neon.td file directly and makes NeonEmitter.cpp agnostic about what goes in there. It also deduplicates arm_neon.td so that each desired intrinsic is mentioned in just one place (necessary because of the new mechanism for creating arm_neon.h). rdar://problem/16035743 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201660 91177308-0d34-0410-b5e6-96231b3b80d8
* ARM & AArch64: merge the semantic checking of NEON intrinsicsTim Northover2014-02-19
| | | | | | | | | | | | | | | | | | | | | There are two kinds of automatically generated tests for NEON intrinsics, both of which can be merged without adversely affecting users. 1. We check that a valid kind of __builtin_neon_XYZ overload is requested (e.g. we're not asking for a float32x4_t version when it only accepts integers. Since the __builtin_neon_XYZ intrinsics should only be used in arm_neon.h, relaxing this test and permitting AArch64 types for AArch32 should not cause a problem. The extra arm_neon.h definitions should be #ifdefed out anyway. 2. We check that intrinsics which take immediates are actually given compile-time constants within range. Since all NEON intrinsics should be backwards compatible, these tests should be identical on AArch64 and AArch32 anyway. This patch, therefore, merges the separate AArch64 and 32-bit checks. rdar://problem/16035743 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201659 91177308-0d34-0410-b5e6-96231b3b80d8
* Forcing it to be an error when there is no Documentation list specified for ↵Aaron Ballman2014-02-17
| | | | | | an attribute. This is a bit of a (harmless) hack, but the FIXME explains why and when this hack can be removed. It's a justified hack because this prevents attribute authors from forgetting to add documentation when they add a new attribute. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201524 91177308-0d34-0410-b5e6-96231b3b80d8
* The default assignment operator could not be generated by all of the bots, ↵Aaron Ballman2014-02-17
| | | | | | but it's required by std::vector to operate properly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201518 91177308-0d34-0410-b5e6-96231b3b80d8
* Removing a C++11'ism to also fix the build bots.Aaron Ballman2014-02-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201517 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixing build bot breakage due to using a local type as a template argument.Aaron Ballman2014-02-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201516 91177308-0d34-0410-b5e6-96231b3b80d8
* Implements a declarative approach to documenting individual attributes in ↵Aaron Ballman2014-02-17
| | | | | | | | Clang via a Documentation tablegen class. Also updates the internals manual with information about how to use this new, required, documentation feature. This patch adds some very, very sparse initial documentation for some attributes. Additional effort from attribute authors is greatly appreciated. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201515 91177308-0d34-0410-b5e6-96231b3b80d8