summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
Commit message (Collapse)AuthorAgeFilesLines
...
* Only instantiate a default argument once.John McCall2016-01-065-20/+33
| | | | | | | | | | | | | | | | | | | By storing the instantiated expression back in the ParmVarDecl, we remove the last need for separately storing the sub-expression of a CXXDefaultArgExpr. This makes PCH/Modules merging quite simple: CXXDefaultArgExpr records are serialized as references to the ParmVarDecl, and we ignore redundant attempts to overwrite the instantiated expression. This has some extremely marginal impact on user-facing semantics. However, the major effect is that it avoids IRGen errors about conflicting definitions due to lambdas in the argument being instantiated multiple times while sharing the same mangling. It should also slightly improve memory usage and module file size. rdar://23810407 llvm-svn: 256983
* [OpenMP] Reapply rL256842: [OpenMP] Offloading descriptor registration and ↵Samuel Antao2016-01-062-0/+14
| | | | | | | | | | | | device codegen. This patch attempts to fix the regressions identified when the patch was committed initially. Thanks to Michael Liao for identifying the fix in the offloading metadata generation related with side effects in evaluation of function arguments. llvm-svn: 256933
* [OpenMP] Revert rL256842: [OpenMP] Offloading descriptor registration and ↵Samuel Antao2016-01-052-14/+0
| | | | | | | | device codegen. It was causing two regression, so I'm reverting until the cause is found. llvm-svn: 256858
* [OpenMP] Offloading descriptor registration and device codegen.Samuel Antao2016-01-052-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In order to offloading work properly two things need to be in place: - a descriptor with all the offloading information (device entry functions, and global variable) has to be created by the host and registered in the OpenMP offloading runtime library. - all the device functions need to be emitted for the device and a convention has to be in place so that the runtime library can easily map the host ID of an entry point with the actual function in the device. This patch adds support for these two things. However, only entry functions are being registered given that 'declare target' directive is not yet implemented. About offloading descriptor: The details of the descriptor are explained with more detail in http://goo.gl/L1rnKJ. Basically the descriptor will have fields that specify the number of devices, the pointers to where the device images begin and end (that will be defined by the linker), and also pointers to a the begin and end of table whose entries contain information about a specific entry point. Each entry has the type: ``` struct __tgt_offload_entry{ void *addr; char *name; int64_t size; }; ``` and will be implemented in a pre determined (ELF) section `.omp_offloading.entries` with 1-byte alignment, so that when all the objects are linked, the table is in that section with no padding in between entries (will be like a C array). The code generation ensures that all `__tgt_offload_entry` entries are emitted in the same order for both host and device so that the runtime can have the corresponding entries in both host and device in same index of the table, and efficiently implement the mapping. The resulting descriptor is registered/unregistered with the runtime library using the calls `__tgt_register_lib` and `__tgt_unregister_lib`. The registration is implemented in a high priority global initializer so that the registration happens always before any initializer (that can potentially include target regions) is run. The driver flag -omptargets= was created to specify a comma separated list of devices the user wants to support so that the new functionality can be exercised. Each device is specified with its triple. About target codegen: The target codegen is pretty much straightforward as it reuses completely the logic of the host version for the same target region. The tricky part is to identify the meaningful target regions in the device side. Unlike other programming models, like CUDA, there are no already outlined functions with attributes that mark what should be emitted or not. So, the information on what to emit is passed in the form of metadata in host bc file. This requires a new option to pass the host bc to the device frontend. Then everything is similar to what happens in CUDA: the global declarations emission is intercepted to check to see if it is an "interesting" declaration. The difference is that instead of checking an attribute, the metadata information in checked. Right now, there is only a form of metadata to pass information about the device entry points (target regions). A class `OffloadEntriesInfoManagerTy` was created to manage all the information and queries related with the metadata. The metadata looks like this: ``` !omp_offload.info = !{!0, !1, !2, !3, !4, !5, !6} !0 = !{i32 0, i32 52, i32 77426347, !"_ZN2S12r1Ei", i32 479, i32 13, i32 4} !1 = !{i32 0, i32 52, i32 77426347, !"_ZL7fstatici", i32 461, i32 11, i32 5} !2 = !{i32 0, i32 52, i32 77426347, !"_Z9ftemplateIiET_i", i32 444, i32 11, i32 6} !3 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 99, i32 11, i32 0} !4 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 272, i32 11, i32 3} !5 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 127, i32 11, i32 1} !6 = !{i32 0, i32 52, i32 77426347, !"_Z3fooi", i32 159, i32 11, i32 2} ``` The fields in each metadata entry are (in sequence): Entry 1) an ID of the type of metadata - right now only zero is used meaning "OpenMP target region". Entry 2) a unique ID of the device where the input source file that contain the target region lives. Entry 3) a unique ID of the file where the input source file that contain the target region lives. Entry 4) a mangled name of the function that encloses the target region. Entries 5) and 6) line and column number where the target region was found. Entry 7) is the order the entry was emitted. Entry 2) and 3) are required to distinguish files that have the same function name. Entry 4) is required to distinguish different instances of the same declaration (usually templated ones) Entries 5) and 6) are required to distinguish the particular target region in body of the function (it is possible that a given target region is not an entry point - if clause can evaluate always to zero - and therefore we need to identify the "interesting" target regions. ) This patch replaces http://reviews.llvm.org/D12306. Reviewers: ABataev, hfinkel, tra, rjmccall, sfantao Subscribers: FBrygidyn, piotr.rak, Hahnfeld, cfe-commits Differential Revision: http://reviews.llvm.org/D12614 llvm-svn: 256842
* [TrailingObjects] Convert classes in ExprObjC.hJames Y Knight2015-12-311-2/+4
| | | | llvm-svn: 256659
* [TrailingObjects] Convert remaining classes in Expr.h and ExprCXX.hJames Y Knight2015-12-311-4/+5
| | | | llvm-svn: 256658
* [TrailingObjects] Convert OffsetOfExpr.James Y Knight2015-12-292-23/+22
| | | | | | That necessitated moving the OffsetOfNode class out of OffsetOfExpr. llvm-svn: 256590
* [TrailingObjects] Convert Decl* classes.James Y Knight2015-12-291-6/+9
| | | | | | | | Also remove now-redundant explicit alignment specification on some of the classes converted prior to TrailingObjects automatically ensuring proper alignment. llvm-svn: 256585
* [TrailingObjects] Convert AST classes that had a ASTTemplateKWAndArgsInfo.James Y Knight2015-12-292-32/+47
| | | | | | | | | | | | | | | | | | | | So, also: - Moved the TemplateArgumentLoc array out of the ASTTemplateKWAndArgsInfo class (making it a simple fixed-size object), to avoid needing to have a variable-length object as part of a variable-length object. Now the objects that have a ASTTemplateKWAndArgsInfo also have some TemplateArgumentLoc objects appended directly. - Removed some internal-use accessors which became simply a wrapper on getTrailingObjects. - Moved MemberNameQualifier out of the MemberExpr class, renamed it MemberExprNameQualifier, because the template can't refer to a class nested within the class it's defining. llvm-svn: 256570
* [OPENMP 4.5] Sema/parsing support for extended format of 'schedule' clause.Alexey Bataev2015-12-282-0/+10
| | | | | | | | | OpenMP 4.0-3.1 supports the next format of ‘schedule’ clause: schedule(kind[, chunk_size]) Where kind can be one of ‘static’, ‘dynamic’, ‘guided’, ‘auto’ or ‘runtime’. OpenMP 4.5 defines the format: schedule([modifier [, modifier]:]kind[, chunk_size]) Modifier can be one of ‘monotonic’, ‘nonmonotonic’ or ‘simd’. llvm-svn: 256487
* ArrayRef-ize TemplateParameterList. NFCDavid Majnemer2015-12-271-1/+1
| | | | llvm-svn: 256463
* [TrailingObjects] Convert ASTTemplateKWAndArgsInfo and ↵James Y Knight2015-12-241-1/+1
| | | | | | | | | | | | | | | | | | | ASTTemplateArgumentListInfo. Doing so required separating them so that the former doesn't inherit from the latter anymore. Investigating that, it became clear that the inheritance wasn't actually providing real value in any case. So also: - Remove a bunch of redundant functions (getExplicitTemplateArgs, getOptionalExplicitTemplateArgs) on various Expr subclasses which depended on the inheritance relationship. - Switched external callers to use pre-existing accessors that return the data they're actually interested in (getTemplateArgs, getNumTemplateArgs, etc). - Switched internal callers to use pre-existing getTemplateKWAndArgsInfo. llvm-svn: 256359
* [OPENMP 4.5] Parsing/sema for 'hint' clause of 'critical' directive.Alexey Bataev2015-12-152-1/+18
| | | | | | OpenMP 4.5 adds 'hint' clause to critical directive. Patch adds parsing/semantic analysis for this clause. llvm-svn: 255625
* Add parse and sema of OpenMP distribute directive with all clauses except ↵Carlo Bertolli2015-12-142-0/+17
| | | | | | dist_schedule llvm-svn: 255498
* [modules] If the semantic and lexical DC of a decl are the same, write out theRichard Smith2015-12-112-17/+32
| | | | | | | second one as 0 instead of writing the same bits to the module file twice. This typically reduces PCM file size by about 1%. llvm-svn: 255384
* Revert r255001, "Add parse and sema for OpenMP distribute directive and all ↵NAKAMURA Takumi2015-12-092-17/+0
| | | | | | | | its clauses excluding dist_schedule." It causes memory leak. Some tests in test/OpenMP would fail. llvm-svn: 255094
* Module file extensions: pass a Sema through to the extension writer.Douglas Gregor2015-12-081-3/+4
| | | | | | | | Module file extensions are likely to need access to Sema/Preprocessor/ASTContext, and cannot get it through other sources. llvm-svn: 255065
* Use range loops and autos in lib/Serialization/ASTWriter.cpp.Eugene Zelenko2015-12-081-127/+103
| | | | | | Differential revision: http://reviews.llvm.org/D15311 llvm-svn: 255033
* [OPENMP 4.5] Parsing/sema for 'num_tasks' clause.Alexey Bataev2015-12-082-0/+13
| | | | | | OpenMP 4.5 adds directives 'taskloop' and 'taskloop simd'. These directives support clause 'num_tasks'. Patch adds parsing/semantic analysis for this clause. llvm-svn: 255008
* Add parse and sema for OpenMP distribute directive and all its clauses ↵Carlo Bertolli2015-12-082-0/+17
| | | | | | excluding dist_schedule. llvm-svn: 255001
* [OPENMP 4.5] parsing/sema support for 'grainsize' clause.Alexey Bataev2015-12-072-0/+13
| | | | | | OpenMP 4.5 adds 'taksloop' and 'taskloop simd' directives, which have 'grainsize' clause. Patch adds parsing/sema analysis of this clause. llvm-svn: 254903
* [OPENMP 4.5] parsing/sema support for 'nogroup' clause.Alexey Bataev2015-12-072-0/+7
| | | | | | OpenMP 4.5 adds 'taskloop' and 'taskloop simd' directives. These directives have new 'nogroup' clause. Patch adds basic parsing/sema support for this clause. llvm-svn: 254899
* Use llvm::make_range to reduce mentions of iterator type. NFCCraig Topper2015-12-061-3/+2
| | | | llvm-svn: 254870
* [AST] ArrayRef-ize CompoundStmt::setStmts.Craig Topper2015-12-041-1/+1
| | | | llvm-svn: 254703
* [OPENMP 4.5] Parsing/sema support for 'omp taskloop simd' directive.Alexey Bataev2015-12-032-0/+17
| | | | | | OpenMP 4.5 adds directive 'taskloop simd'. Patch adds parsing/sema analysis for 'taskloop simd' directive and its clauses. llvm-svn: 254597
* [OPENMP 4.5] Parsing/sema analysis for 'priority' clause.Alexey Bataev2015-12-012-0/+13
| | | | | | OpenMP 4.5 defines new clause 'priority' for 'task', 'taskloop' and 'taskloop simd' directives. Added parsing and sema analysis for 'priority' clause in 'task' and 'taskloop' directives. llvm-svn: 254398
* [OPENMP 4.5] Parsing/sema analysis for 'taskloop' directive.Alexey Bataev2015-12-012-0/+17
| | | | | | Adds initial parsing and semantic analysis for 'taskloop' directive. llvm-svn: 254367
* [modules] Don't reject multiple modules providing contents for the same ↵Richard Smith2015-12-011-1/+2
| | | | | | embedded file. llvm-svn: 254365
* [OpenMP] Parsing and sema support for thread_limit clause.Kelvin Li2015-11-272-0/+13
| | | | | | http://reviews.llvm.org/D15029 llvm-svn: 254207
* [modules] Refactor handling of -fmodules-embed-*. Track this properly ratherRichard Smith2015-11-262-22/+30
| | | | | | | than reusing the "overridden buffer" mechanism. This will allow us to make embedded files and overridden files behave differently in future. llvm-svn: 254121
* [MSVC] 'property' with an empty array in array subscript expression.Alexey Bataev2015-11-252-0/+18
| | | | | | | | | | | | MSVC supports 'property' attribute and allows to apply it to the declaration of an empty array in a class or structure definition. For example: ``` __declspec(property(get=GetX, put=PutX)) int x[]; ``` The above statement indicates that x[] can be used with one or more array indices. In this case, i=p->x[a][b] will be turned into i=p->GetX(a, b), and p->x[a][b] = i will be turned into p->PutX(a, b, i); Differential Revision: http://reviews.llvm.org/D13336 llvm-svn: 254067
* [OpenMP] Parsing and sema support for num_teams clauseKelvin Li2015-11-242-0/+13
| | | | | | http://reviews.llvm.org/D14802 llvm-svn: 254019
* [OpenMP] Parsing and sema support for map clauseKelvin Li2015-11-232-0/+31
| | | | | | http://reviews.llvm.org/D14134 llvm-svn: 253849
* Add support for GCC's '__auto_type' extension, per the GCC manual:Richard Smith2015-11-112-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | https://gcc.gnu.org/onlinedocs/gcc/Typeof.html Differences from the GCC extension: * __auto_type is also permitted in C++ (but only in places where it could appear in C), allowing its use in headers that might be shared across C and C++, or used from C++98 * __auto_type can be combined with a declarator, as with C++ auto (for instance, "__auto_type *p") * multiple variables can be declared in a single __auto_type declaration, with the C++ semantics (the deduced type must be the same in each case) This patch also adds a missing restriction on applying typeof to a bit-field, which GCC has historically rejected in C (due to lack of clarity as to whether the operand should be promoted). The same restriction also applies to __auto_type in C (in both GCC and Clang). This also fixes PR25449. Patch by Nicholas Allegra! llvm-svn: 252690
* Moving FileManager::removeDotPaths to llvm::sys::path::remove_dotsMike Aizatsky2015-11-091-1/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D14394 llvm-svn: 252501
* [modules] If we're given a module file, via -fmodule-file=, for a module, butRichard Smith2015-11-051-6/+12
| | | | | | | | | we can't load that file due to a configuration mismatch, and implicit module building is disabled, and the user turns off the error-by-default warning for that situation, then fall back to textual inclusion for the module rather than giving an error if any of its headers are included. llvm-svn: 252114
* [Sema] Implement __make_integer_seqDavid Majnemer2015-11-044-0/+11
| | | | | | | | | | | | | | | | | | This new builtin template allows for incredibly fast instantiations of templates like std::integer_sequence. Performance numbers follow: My work station has 64 GB of ram + 20 Xeon Cores at 2.8 GHz. __make_integer_seq<std::integer_sequence, int, 90000> takes 0.25 seconds. std::make_integer_sequence<int, 90000> takes unbound time, it is still running. Clang is consuming gigabytes of memory. Differential Revision: http://reviews.llvm.org/D13786 llvm-svn: 252036
* Introduce module file extensions to piggy-back data onto module files.Douglas Gregor2015-11-035-50/+273
| | | | | | | | | | | | | | | | | | | | | Introduce the notion of a module file extension, which introduces additional information into a module file at the time it is built that can then be queried when the module file is read. Module file extensions are identified by a block name (which must be unique to the extension) and can write any bitstream records into their own extension block within the module file. When a module file is loaded, any extension blocks are matched up with module file extension readers, that are per-module-file and are given access to the input bitstream. Note that module file extensions can only be introduced by programmatic clients that have access to the CompilerInvocation. There is only one such extension at the moment, which is used for testing the module file extension harness. As a future direction, one could imagine allowing the plugin mechanism to introduce new module file extensions. llvm-svn: 251955
* Eliminate "rewritten decls" from the AST writer. NFCDouglas Gregor2015-11-032-23/+10
| | | | llvm-svn: 251877
* Stop back-patching 'readonly' Objective-C properties with 'readwrite' ones.Douglas Gregor2015-11-031-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | A 'readonly' Objective-C property declared in the primary class can effectively be shadowed by a 'readwrite' property declared within an extension of that class, so long as the types and attributes of the two property declarations are compatible. Previously, this functionality was implemented by back-patching the original 'readonly' property to make it 'readwrite', destroying source information and causing some hideously redundant, incorrect code. Simplify the implementation to express how this should actually be modeled: as a separate property declaration in the extension that shadows (via the name lookup rules) the declaration in the primary class. While here, correct some broken Fix-Its, eliminate a pile of redundant code, clean up the ARC migrator's handling of properties declared in extensions, and fix debug info's naming of methods that come from categories. A wonderous side effect of doing this write is that it eliminates the "AddedObjCPropertyInClassExtension" method from the AST mutation listener, which in turn eliminates the last place where we rewrite entire declarations in a chained PCH file or a module file. This change (which fixes rdar://problem/18475765) will allow us to eliminate the rewritten-decls logic from the serialization library, and fixes a crash (rdar://problem/23247794) illustrated by the test/PCH/chain-categories.m example. llvm-svn: 251874
* Fix missing builtin identifier infos with PCH+modulesBen Langmuir2015-10-281-2/+4
| | | | | | | | | | | | | | Use the *current* state of "is-moduleness" rather than the state at serialization time so that if we read a builtin identifier from a module that wasn't "interesting" to that module, we will still write it out to a PCH that imports that module. Otherwise, we would get mysterious "unknown builtin" errors when using PCH+modules. rdar://problem/23287656 llvm-svn: 251565
* [coroutines] Creation of promise object, lookup of operator co_await, buildingRichard Smith2015-10-272-3/+45
| | | | | | of await_* calls, and AST representation for same. llvm-svn: 251387
* Change MacroInfo::setArgumentList to take an ArrayRef instead of pointer and ↵Craig Topper2015-10-221-2/+1
| | | | | | size. While there use std::copy intead of a manual loop. llvm-svn: 250987
* Fix use-after-free in ModuleManagerBen Langmuir2015-10-211-0/+3
| | | | | | | | | | | | | When removing out-of-date modules we might have left behind a VisitOrder that contains pointers to freed ModuleFiles. This was very rarely seen, because it only happens when modules go out of date and the VisitOrder happens to have the right size to not be recomputed. Thanks ASan! rdar://23181512 llvm-svn: 250963
* Roll-back r250822.Angel Garcia Gomez2015-10-204-4/+5
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-204-5/+4
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
* No functionality change, just fix whitespace, a typo and remove an unnecessaryNick Lewycky2015-10-181-2/+2
| | | | | | | emacs mode marker. (Changes left behind from another patch that ended up not working out.) llvm-svn: 250666
* [modules] Improve error message on failed module load due to a missing file toRichard Smith2015-10-131-1/+3
| | | | | | say which module file referenced the missing file. llvm-svn: 250140
* [modules] Fix merging of __va_list_tag's implicit special member functions.Richard Smith2015-10-131-6/+31
| | | | | | | | | | | We model predefined declarations as not being from AST files, but in most ways they act as if they come from some implicit prebuilt module file imported before all others. Therefore, if we see an update to the predefined 'struct __va_list_tag' declaration (and we've already loaded any modules), it needs a corresponding update record, even though it didn't technically come from an AST file. llvm-svn: 250134
* [OPENMP 4.1] Codegen for array sections/subscripts in 'reduction' clause.Alexey Bataev2015-10-082-0/+6
| | | | | | OpenMP 4.1 adds support for array sections/subscripts in 'reduction' clause. Patch adds codegen for this feature. llvm-svn: 249672
OpenPOWER on IntegriCloud