summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmtAttr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add new llvm.loop.unroll.enable metadata for use with "#pragma unroll".Mark Heffernan2015-08-101-29/+41
| | | | | | | | | | | | | | | | | | | | | | This change adds the new unroll metadata "llvm.loop.unroll.enable" which directs the optimizer to unroll a loop fully if the trip count is known at compile time, and unroll partially if the trip count is not known at compile time. This differs from "llvm.loop.unroll.full" which explicitly does not unroll a loop if the trip count is not known at compile time With this change "#pragma unroll" generates "llvm.loop.unroll.enable" rather than "llvm.loop.unroll.full" metadata. This changes the semantics of "#pragma unroll" slightly to mean "unroll aggressively (fully or partially)" rather than "unroll fully or not at all". The motivating example for this change was some internal code with a loop marked with "#pragma unroll" which only sometimes had a compile-time trip count depending on template magic. When the trip count was a compile-time constant, everything works as expected and the loop is fully unrolled. However, when the trip count was not a compile-time constant the "#pragma unroll" explicitly disabled unrolling of the loop(!). Removing "#pragma unroll" caused the loop to be unrolled partially which was desirable from a performance perspective. llvm-svn: 244467
* Add assume_safety option for pragma loop vectorize and interleave.Tyler Nowicki2015-06-111-1/+3
| | | | | | | | Specifying #pragma clang loop vectorize(assume_safety) on a loop adds the mem.parallel_loop_access metadata to each load/store operation in the loop. This metadata tells loop access analysis (LAA) to skip memory dependency checking. llvm-svn: 239572
* Allow constant expressions in pragma loop hints.Tyler Nowicki2014-10-121-9/+3
| | | | | | | | Previously loop hints such as #pragma loop vectorize_width(#) required a constant. This patch allows a constant expression to be used as well. Such as a non-type template parameter or an expression (2 * c + 1). Reviewed by Richard Smith llvm-svn: 219589
* Add a state variable to the loop hint attribute.Tyler Nowicki2014-07-311-58/+46
| | | | | | | | | | This patch is necessary to support constant expressions which replaces the integer value in the loop hint attribute with an expression. The integer value was also storing the pragma’s state for options like vectorize(enable/disable) and the pragma unroll and nounroll directive. The state variable is introduced to hold the state of those options/pragmas. This moves the validation of the state (keywords) from SemaStmtAttr handler to the loop hint annotation token handler. Resubmit with changes to try to fix the build-bot issue. Reviewed by Aaron Ballman llvm-svn: 214432
* Revert r214333, "Add a state variable to the loop hint attribute."NAKAMURA Takumi2014-07-311-46/+58
| | | | | | It brought undefined behavior. llvm-svn: 214376
* Add a state variable to the loop hint attribute.Tyler Nowicki2014-07-301-58/+46
| | | | | | | | This patch is necessary to support constant expressions which replaces the integer value in the loop hint attribute with an expression. The integer value was also storing the pragma’s state for options like vectorize(enable/disable) and the pragma unroll and nounroll directive. The state variable is introduced to hold the state of those options/pragmas. This moves the validation of the state (keywords) from SemaStmtAttr handler to the loop hint annotation token handler. Reviewed by Aaron Ballman llvm-svn: 214333
* Modify how the loop hint attribute is printed as a lead-up to supporting ↵Tyler Nowicki2014-07-291-7/+9
| | | | | | | | constant expression values. Reviewed by Aaron Ballman llvm-svn: 214185
* Add support for #pragma nounroll.Mark Heffernan2014-07-241-3/+11
| | | | llvm-svn: 213885
* In unroll pragma syntax and loop hint metadata, change "enable" forms to a ↵Mark Heffernan2014-07-231-16/+26
| | | | | | new form using the string "full". llvm-svn: 213771
* Add support for '#pragma unroll'.Mark Heffernan2014-07-211-66/+60
| | | | llvm-svn: 213574
* Fix PR20069: bad loop pragma arguments crash FEEli Bendersky2014-06-191-14/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes a crash when handling malformed arguments to loop pragmas such as: "#pragma clang loop vectorize(()". Essentially any argument which is not an identifier or constant resulted in a crash. This patch also changes a couple of the error messages which weren't quite correct. New behavior with this patch vs old behavior: #pragma clang loop vectorize(1) OLD: error: missing keyword; expected 'enable' or 'disable' NEW: error: invalid argument; expected 'enable' or 'disable' #pragma clang loop vectorize() OLD: error: expected ')' NEW: error: missing argument to loop pragma 'vectorize' #pragma clang loop vectorize_width(bad) OLD: error: missing value; expected a positive integer value NEW: error: invalid argument; expected a positive integer value #pragma clang loop vectorize(bad) OLD: invalid keyword 'bad'; expected 'enable' or 'disable' NEW: error: invalid argument; expected 'enable' or 'disable' http://reviews.llvm.org/D4197 Patch by Mark Heffernan llvm-svn: 211292
* Explicitly initialize all fields to avoid -Wmissing-field-initializers warning.Eli Bendersky2014-06-121-5/+6
| | | | llvm-svn: 210791
* Add loop unroll pragma supportEli Bendersky2014-06-111-53/+60
| | | | | | | | http://reviews.llvm.org/D4089 Patch by Mark Heffernan. llvm-svn: 210667
* Avoid dubious IdentifierInfo::getNameStart() usesAlp Toker2014-06-071-1/+1
| | | | | | | | These cases in particular were incurring an extra strlen() when we already knew the length. They appear to be leftovers from when the interfaces worked with C strings that have continued to compile due to the implicit StringRef ctor. llvm-svn: 210403
* Fix DOS-style newlines.Eli Bendersky2014-06-061-181/+181
| | | | | | | | | A previous patch r210330 (and possibly another) introduced DOS-style newlines into a UNIX newline formatted file. Patch by Mark Heffernan (http://reviews.llvm.org/D4046) llvm-svn: 210369
* Replacing r210333 with an improved solution; we should never reach this code ↵Aaron Ballman2014-06-061-2/+3
| | | | | | with any other loop hint options. llvm-svn: 210338
* Quieting a false-positive which was causing the sanitizer bots to go red.Aaron Ballman2014-06-061-1/+1
| | | | llvm-svn: 210333
* Adding a new #pragma for the vectorize and interleave optimization hints.Aaron Ballman2014-06-061-25/+180
| | | | | | Patch thanks to Tyler Nowicki! llvm-svn: 210330
* [C++11] Use 'nullptr'. Sema edition.Craig Topper2014-05-261-4/+4
| | | | llvm-svn: 209613
* Fix a bunch of mislayered clang/Lex includes from SemaAlp Toker2014-05-031-3/+1
| | | | llvm-svn: 207896
* Distinguish between attributes explicitly written at the request of the ↵Aaron Ballman2014-01-161-1/+2
| | | | | | | | user, and attributes implicitly generated to assist in bookkeeping by the compiler. This is done so by table generating a CreateImplicit method for each attribute. Additionally, remove the optional nature of the spelling list index when creating attributes. This is supported by table generating a Spelling enumeration when the spellings for an attribute are distinct enough to warrant it. llvm-svn: 199378
* Removing the notion of TargetAttributesSema and replacing it with one where ↵Aaron Ballman2014-01-091-1/+0
| | | | | | the parsed attributes are responsible for knowing their target-specific nature, instead of letting Sema figure it out. This is necessary so that __has_attribute can eventually determine whether a parsed attribute applies to the given target or not. llvm-svn: 198896
* PR15300: Support C++11 attributes on base-specifiers. We don't support any suchRichard Smith2013-02-191-2/+2
| | | | | | | | attributes yet, so just issue the appropriate diagnostics. Also generalize the fixit for attributes-in-the-wrong-place code and reuse it here, if attributes are placed after the access-specifier or 'virtual' in a base specifier. llvm-svn: 175575
* Improve C++11 attribute parsing.Michael Han2012-10-031-2/+7
| | | | | | | | - General C++11 attributes were previously parsed and ignored. Now they are parsed and stored in AST. - Add support to parse arguments of attributes that in 'gnu' namespace. - Differentiate unknown attributes and known attributes that can't be applied to statements when emitting diagnostic. llvm-svn: 165082
* Inline storage of attributes in AttributedStmt.Alexander Kornienko2012-07-091-1/+1
| | | | llvm-svn: 159925
* Reapply r158700 and fixup patches, minus one hunk that slipped through andAlexis Hunt2012-06-191-1/+1
| | | | | | | caused a crash in an obscure case. On the plus side, it caused me to catch another bug by inspection. llvm-svn: 158767
* Revert r158700 and dependent patches r158716, r158717, and r158731.Jakob Stoklund Olesen2012-06-191-1/+1
| | | | | | | | The original r158700 caused crashes in the gcc test suite, g++.abi/vtable3a.C among others. It also caused failures in the libc++ test suite. llvm-svn: 158749
* Improve the specification of spellings in Attr.td.Alexis Hunt2012-06-191-1/+1
| | | | | | | | | | | | | | | | | Note that this is mostly a structural patch that handles the change from the old spelling style to the new one. One consequence of this is that all AT_foo_bar enum values have changed to not be based off of the first spelling, but rather off of the class name, so they are now AT_FooBar and the like (a straw poll on IRC showed support for this). Apologies for code churn. Most attributes have GNU spellings as a temporary solution until everything else is sorted out (such as a Keyword spelling, which I intend to add if someone else doesn't beat me to it). This is definitely a WIP. I've also killed BaseCheckAttr since it was unused, and I had to go through every attribute anyway. llvm-svn: 158700
* Handle C++11 attribute namespaces automatically.Alexis Hunt2012-06-181-1/+1
| | | | | | | | Now, as long as the 'Namespaces' variable is correct inside Attr.td, the generated code will correctly admit a C++11 attribute only when it has the appropriate namespace(s). llvm-svn: 158661
* Add -Wimplicit-fallthrough warning flag, which warns on fallthrough betweenRichard Smith2012-05-031-4/+30
| | | | | | | | | | | | cases in switch statements. Also add a [[clang::fallthrough]] attribute, which can be used to suppress the warning in the case of intentional fallthrough. Patch by Alexander Kornienko! The handling of C++11 attribute namespaces in this patch is temporary, and will be replaced with a cleaner mechanism in a subsequent patch. llvm-svn: 156086
* Add an AttributedStmt type to represent a statement with C++11 attributesRichard Smith2012-04-141-0/+48
attached. Since we do not support any attributes which appertain to a statement (yet), testing of this is necessarily quite minimal. Patch by Alexander Kornienko! llvm-svn: 154723
OpenPOWER on IntegriCloud