summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert r259977 - [OpenMP] Reorganize code to allow specialized code ↵Samuel Antao2016-02-061-18/+1
| | | | | | | | generation for different devices. It triggered some problem in the configuration related with zlib and exposed in the driver. llvm-svn: 259984
* [OpenMP] Reorganize code to allow specialized code generation for different ↵Samuel Antao2016-02-061-1/+18
| | | | | | | | | | | | | | | | | | | | | | | devices. Summary: Different devices may in some cases require different code generation schemes in order to implement OpenMP. This is required not only for performance reasons, but also because it may not be possible to have the current (default) implementation working for these devices. E.g. GPU's cannot implement the same scheme a target such as powerpc or x86b would use, in the sense that it does not have the ability to fork threads, instead all the threads are always executing and need to be managed by the implementation. This patch proposes a reorganization of the code in the OpenMP code generation to pave the way to have specialized implementation of OpenMP support. More than a "real" patch this is more a request for comments in order to understand if what is proposed is acceptable or if there are better/easier ways to do it. In this patch part of the common OpenMP codegen infrastructure is moved to a new file under a new namespace (CGOpenMPCommon) so it can be shared between the default implementation and the specialized one. When CGOpenMPRuntime is created, an attempt to select a specialized implementation is done. In the patch a specialization for nvptx targets is done which currently checks if the target is an OpenMP device and trap if it is not. Let me know comments suggestions you may have. Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev Subscribers: Hahnfeld, cfe-commits, fraggamuffin, caomhin, jholewinski Differential Revision: http://reviews.llvm.org/D16784 llvm-svn: 259977
* Eliminate an unnecessary enum, use the LLVM version. NFCPaul Robinson2016-02-051-4/+4
| | | | llvm-svn: 259950
* [PGO] cc1 option name change for profile instrumentationRong Xu2016-02-041-3/+22
| | | | | | | | | | | | This patch changes cc1 option -fprofile-instr-generate to an enum option -fprofile-instrument={clang|none}. It also changes cc1 options -fprofile-instr-generate= to -fprofile-instrument-path=. The driver level option -fprofile-instr-generate and -fprofile-instr-generate= remain intact. This change will pave the way to integrate new PGO instrumentation in IR level. Review: http://reviews.llvm.org/D16730 llvm-svn: 259811
* Move DebugInfoKind into its own header to cut the cyclic dependency edge ↵Benjamin Kramer2016-02-021-6/+6
| | | | | | from Driver to Frontend. llvm-svn: 259489
* Do not define GXX_RTTI macro for C.Yunzhong Gao2016-01-261-1/+1
| | | | | | | | This is same as GCC behavior (tested with GCC 4.8.2). Differential Revision: http://reviews.llvm.org/D16365 llvm-svn: 258850
* [CUDA] Add -fcuda-allow-variadic-functions.Justin Lebar2016-01-261-0/+3
| | | | | | | | | | | | | | | | | Summary: Turns out the variadic function checking added in r258643 was too strict for some existing users; give them an escape valve. When -fcuda-allow-variadic-functions is passed, the front-end makes no attempt to disallow C-style variadic functions. Calls to va_arg are still not allowed. Reviewers: tra Subscribers: cfe-commits, jhen, echristo, bkramer Differential Revision: http://reviews.llvm.org/D16559 llvm-svn: 258822
* Introduce -fsanitize-stats flag.Peter Collingbourne2016-01-161-0/+2
| | | | | | | | | This is part of a new statistics gathering feature for the sanitizers. See clang/docs/SanitizerStats.rst for further info and docs. Differential Revision: http://reviews.llvm.org/D16175 llvm-svn: 257971
* Module debugging: Make the module format part of the module hash insteadAdrian Prantl2016-01-121-2/+5
| | | | | | | | | | of the file name. This is consistent with how other HeaderSearchOptions are handled. Due to the other inputs of the module hash (revision number) this is not really testable in a meaningful way. llvm-svn: 257520
* Accidentally removed part of the file header. Restoring it back.Ekaterina Romanova2016-01-101-1/+1
| | | | llvm-svn: 257291
* [Driver] Add support for -fno-builtin-foo options.Chad Rosier2016-01-061-1/+20
| | | | | | | Addresses PR4941 and rdar://6756912. http://reviews.llvm.org/D15195 llvm-svn: 256937
* [OpenMP] Reapply rL256842: [OpenMP] Offloading descriptor registration and ↵Samuel Antao2016-01-061-0/+24
| | | | | | | | | | | | 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
* Avoid assert failure on some invalid cc1 options.Douglas Katzman2016-01-061-8/+19
| | | | | | | | Addressing review comment in D13221. Differential Revision: http://reviews.llvm.org/D15882 llvm-svn: 256897
* [OpenMP] Revert rL256842: [OpenMP] Offloading descriptor registration and ↵Samuel Antao2016-01-051-24/+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-051-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Some minor correction based on David Blaikie post-commit code review for ↵Ekaterina Romanova2015-12-241-3/+2
| | | | | | r255281. llvm-svn: 256396
* [clang-cl] Add support for /BreproDavid Majnemer2015-12-211-0/+2
| | | | | | | | | | | | The /Brepro flag controls whether or not the compiler should embed timestamps into the object file. Object files which do not embed timestamps are not suitable for incremental linking but are suitable for hermetic build systems and staged self-hosts of clang. A normal clang spelling of this flag has been added, -mincremental-linker-compatible. llvm-svn: 256204
* Recommit CC1 part of debugger tuning; pass through setting from driver to LLVM.Paul Robinson2015-12-191-0/+7
| | | | | | | | | Reapplies r256063, except instead of frugally re-using an LLVM enum, we define a Clang enum, to avoid exposing too much LLVM interface. Differential Revision: http://reviews.llvm.org/D15650 llvm-svn: 256078
* Revert r256063, it's killing clang-tools-extraPaul Robinson2015-12-191-7/+0
| | | | llvm-svn: 256066
* CC1 part of debugger tuning; pass through setting from driver to LLVM.Paul Robinson2015-12-181-0/+7
| | | | | | Differential Revision: http://reviews.llvm.org/D15650 llvm-svn: 256063
* Cross-DSO control flow integrity (Clang part).Evgeniy Stepanov2015-12-151-0/+1
| | | | | | | | | | | | | | Clang-side cross-DSO CFI. * Adds a command line flag -f[no-]sanitize-cfi-cross-dso. * Links a runtime library when enabled. * Emits __cfi_slowpath calls is bitset test fails. * Emits extra hash-based bitsets for external CFI checks. * Sets a module flag to enable __cfi_check generation during LTO. This mode does not yet support diagnostics. llvm-svn: 255694
* Do not generate DW_TAG_imported_module for anonymous namespaces (even ↵Ekaterina Romanova2015-12-101-0/+3
| | | | | | | | | | nested) for all the platforms except PS4. For PS4, generate explicit import for anonymous namespaces and mark it by DW_AT_artificial attribute. Differential Revision: http://reviews.llvm.org/D12624 llvm-svn: 255281
* [ThinLTO] Option to invoke ThinLTO backend passes and importingTeresa Johnson2015-12-071-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Adds new option -fthinlto-index=<file> to invoke the LTO pipeline along with function importing via clang using the supplied function summary index file. This supports invoking the parallel ThinLTO backend processes in a distributed build environment via clang. Additionally, this causes the module linker to be invoked on the bitcode file being compiled to perform any necessary promotion and renaming of locals that are exported via the function summary index file. Add a couple tests that confirm we get expected errors when we try to use the new option on a file that isn't bitcode, or specify an invalid index file. The tests also confirm that we trigger the expected function import pass. Depends on D15024 Reviewers: joker.eph, dexonsmith Subscribers: joker.eph, davidxl, cfe-commits Differential Revision: http://reviews.llvm.org/D15025 llvm-svn: 254927
* [modules] Add -cc1 flag -fmodules-embed-all-files.Richard Smith2015-11-241-0/+1
| | | | | | | | | | | | | | This flag causes all files that were read by the compilation to be embedded into a produced module file. This is useful for distributed build systems that use an include scanning system to determine which files are "needed" by a compilation, and only provide those files to remote compilation workers. Since using a module can require any file that is part of that module (or anything it transitively includes), files that are not found by an include scanner can be required in a regular build using explicit modules. With this flag, only files that are actually referenced by transitively-#included files are required to be present on the build machine. llvm-svn: 253950
* Disable frame pointer elimination when using -pg Xinliang David Li2015-11-231-1/+2
| | | | | | | | | | | | | | | | (Re-apply patch after bug fixing) This diff makes sure that the driver does not pass -fomit-frame-pointer or -momit-leaf-frame-pointer to the frontend when -pg is used. Currently, clang gives an error if -fomit-frame-pointer is used in combination with -pg, but -momit-leaf-frame-pointer was forgotten. Also, disable frame pointer elimination in the frontend when -pg is set. Patch by Stefan Kempf. llvm-svn: 253886
* Revert r253846 (build bot failure))Xinliang David Li2015-11-231-2/+1
| | | | llvm-svn: 253851
* Disable frame pointer elimination when using -pgXinliang David Li2015-11-231-1/+2
| | | | | | | | | | | | | | This diff makes sure that the driver does not pass -fomit-frame-pointer or -momit-leaf-frame-pointer to the frontend when -pg is used. Currently, clang gives an error if -fomit-frame-pointer is used in combination with -pg, but -momit-leaf-frame-pointer was forgotten. Also, disable frame pointer elimination in the frontend when -pg is set. Patch by Stefan Kempf. llvm-svn: 253846
* Revert "Make FP_CONTRACT ON the default."Manuel Klimek2015-11-171-0/+1
| | | | | | | | | This reverts commit r253269. This leads to assert / segfault triggering on the following reduced example: float foo(float U, float base, float cell) { return (U = 2 * base) - cell; } llvm-svn: 253337
* Make FP_CONTRACT ON the default.Stephen Canon2015-11-161-1/+0
| | | | | | Differential Revision: D14200 llvm-svn: 253269
* Revert r240335.Richard Smith2015-11-121-2/+0
| | | | | | | | | | | | | | | This failed to solve the problem it was aimed at, and introduced just as many issues as it resolved. Realistically, we need to deal with the possibility that multiple modules might define different internal linkage symbols with the same name, and this isn't a problem unless two such symbols are simultaneously visible. The case where two modules define equivalent internal linkage symbols is handled by r252063: if lookup finds multiple sufficiently-similar entities from different modules, we just pick one of them as an extension (but we keep them separate). llvm-svn: 252957
* [EABI] Add Clang support for -meabi flagRenato Golin2015-11-091-0/+15
| | | | | | | | | | | | | | The -meabi flag to control LLVM EABI version. Without '-meabi' or with '-meabi default' imply LLVM triple default. With '-meabi gnu' sets EABI GNU. With '-meabi 4' or '-meabi 5' set EABI version 4 and 5 respectively. A similar patch was introduced in LLVM. Patch by Vinicius Tinti. llvm-svn: 252463
* After some discussion, promote -fobjc-weak to a driver option.John McCall2015-11-051-7/+10
| | | | | | rdar://problem/23415863 llvm-svn: 252187
* Introduce module file extensions to piggy-back data onto module files.Douglas Gregor2015-11-031-0/+52
| | | | | | | | | | | | | | | | | | | | | 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
* Allow linking multiple bitcode files.Artem Belevich2015-10-271-4/+8
| | | | | | | | | | | | | | | | | | Linking options for particular file depend on the option that specifies the file. Currently there are two: * -mlink-bitcode-file links in complete content of the specified file. * -mlink-cuda-bitcode links in only the symbols needed by current TU. Linked symbols are internalized. This bitcode linking mode is used to link device-specific bitcode provided by CUDA. Files are linked in order they are specified on command line. -mlink-cuda-bitcode replaces -fcuda-uses-libdevice flag. Differential Revision: http://reviews.llvm.org/D13913 llvm-svn: 251427
* Define weak and __weak to mean ARC-style weak references, even in MRC.John McCall2015-10-221-5/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, __weak was silently accepted and ignored in MRC mode. That makes this a potentially source-breaking change that we have to roll out cautiously. Accordingly, for the time being, actual support for __weak references in MRC is experimental, and the compiler will reject attempts to actually form such references. The intent is to eventually enable the feature by default in all non-GC modes. (It is, of course, incompatible with ObjC GC's interpretation of __weak.) If you like, you can enable this feature with -Xclang -fobjc-weak but like any -Xclang option, this option may be removed at any point, e.g. if/when it is eventually enabled by default. This patch also enables the use of the ARC __unsafe_unretained qualifier in MRC. Unlike __weak, this is being enabled immediately. Since variables are essentially __unsafe_unretained by default in MRC, the only practical uses are (1) communication and (2) changing the default behavior of by-value block capture. As an implementation matter, this means that the ObjC ownership qualifiers may appear in any ObjC language mode, and so this patch removes a number of checks for getLangOpts().ObjCAutoRefCount that were guarding the processing of these qualifiers. I don't expect this to be a significant drain on performance; it may even be faster to just check for these qualifiers directly on a type (since it's probably in a register anyway) than to do N dependent loads to grab the LangOptions. rdar://9674298 llvm-svn: 251041
* [coroutines] Add lexer support for co_await, co_yield, and co_return keywords.Richard Smith2015-10-221-0/+1
| | | | | | | Add -fcoroutines flag (just for -cc1 for now) to enable the feature. Early indications are that this will be part of -std=c++1z. llvm-svn: 250980
* [Driver] Alias -fvisibility=internal to -fvisibility=hiddenReid Kleckner2015-10-211-1/+1
| | | | | | | | | | | | | | | | | | The ELF symbol visibilities are: - internal: Not visibile across DSOs, cannot pass address across DSOs - hidden: Not visibile across DSOs, can be called indirectly - default: Usually visible across DSOs, possibly interposable - protected: Visible across DSOs, not interposable LLVM only supports the latter 3 visibilities. Internal visibility is in theory useful, as it allows you to assume that the caller is maintaining a PIC register for you in %ebx, or in some other pre-arranged location. As far as LLVM is concerned, this isn't worth the trouble. Using hidden visibility is always correct, so we can just do that. Resolves PR9183. llvm-svn: 250954
* Roll-back r250822.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | 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-201-1/+1
| | | | | | | | | | | | 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
* [Frontend] Name variable correctly.Davide Italiano2015-10-171-2/+2
| | | | | | Reported by: Kim Grasman! llvm-svn: 250605
* [Frontend/CompilerInvocation] Use range-based loop. NFC.Davide Italiano2015-10-161-2/+2
| | | | llvm-svn: 250559
* Recommit "Clang support for -flto=thin."Teresa Johnson2015-10-151-1/+3
| | | | | | | | | This recommits r250398 with fixes to the tests for bot failures. Add "-target x86_64-unknown-linux" to the clang invocations that check for the gold plugin. llvm-svn: 250455
* Revert "Clang support for -flto=thin." (bot failures)Teresa Johnson2015-10-151-3/+1
| | | | | | | | | | | Rolling this back for now since there are a couple of bot failures on the new tests I added, and I won't have a chance to look at them in detail until later this afternoon. I think the new tests need some restrictions on having the gold plugin available. This reverts commit r250398. llvm-svn: 250402
* Clang support for -flto=thin.Teresa Johnson2015-10-151-1/+3
| | | | | | | | | | | | | | | | | | | Summary: Add clang support for -flto=thin option, which is used to set the EmitFunctionSummary code gen option on compiles. Add -flto=full as an alias to the existing -flto. Add tests to check for proper overriding of -flto variants on the command line, and convert grep tests to FileCheck. Reviewers: dexonsmith, joker.eph Subscribers: davidxl, cfe-commits Differential Revision: http://reviews.llvm.org/D11908 llvm-svn: 250398
* Support Debug Info path remappingSaleem Abdulrasool2015-10-121-0/+3
| | | | | | | | | | | | | | | | Add support for the `-fdebug-prefix-map=` option as in GCC. The syntax is `-fdebug-prefix-map=OLD=NEW`. When compiling files from a path beginning with OLD, change the debug info to indicate the path as start with NEW. This is particularly helpful if you are preprocessing in one path and compiling in another (e.g. for a build cluster with distcc). Note that the linearity of the implementation is not as terrible as it may seem. This is normally done once per file with an expectation that the map will be small (1-2) entries, making this roughly linear in the number of input paths. Addresses PR24619. llvm-svn: 250094
* Stop messing with the 'g' group of options in CompilerInvocation.Douglas Katzman2015-10-081-29/+9
| | | | | | | | | | | | | | | | With this change, most 'g' options are rejected by CompilerInvocation. They remain only as Driver options. The new way to request debug info from cc1 is with "-debug-info-kind={line-tables-only|limited|standalone}" and "-dwarf-version={2|3|4}". In the absence of a command-line option to specify Dwarf version, the Toolchain decides it, rather than placing Toolchain-specific logic in CompilerInvocation. Also fix a bug in the Windows compatibility argument parsing in which the "rightmost argument wins" principle failed. Differential Revision: http://reviews.llvm.org/D13221 llvm-svn: 249655
* [WinEH] Remove NewMSEH and enable its behavior by defaultReid Kleckner2015-10-081-1/+0
| | | | | | | Testing has shown that it is at least as reliable as the old landingpad pattern matching code. llvm-svn: 249647
* Add -f[no-]declspec to control recognition of __declspec as a keywordSaleem Abdulrasool2015-10-041-0/+11
| | | | | | | | | | | | | | | In versions of clang prior to r238238, __declspec was recognized as a keyword in all modes. It was then changed to only be enabled when Microsoft or Borland extensions were enabled (and for CUDA, as a temporary measure). There is a desire to support __declspec in Playstation code, and possibly other environments. This commit adds a command-line switch to allow explicit enabling/disabling of the recognition of __declspec as a keyword. Recognition is enabled by default in Microsoft, Borland, CUDA, and PS4 environments, and disabled in all other environments. Patch by Warren Ristow! llvm-svn: 249279
* Implement ACLE 2.0 macros of chapters 6.6 and 6.7 for [ARM] and [Aarch64] ↵Alexandros Lamprineas2015-10-021-0/+3
| | | | | | | | targets. Differential Revision: http://reviews.llvm.org/D12633 llvm-svn: 249140
* [CUDA] Allow parsing of host and device code simultaneously.Artem Belevich2015-09-221-0/+3
| | | | | | | | | | | | * adds -aux-triple option to specify target triple * propagates aux target info to AST context and Preprocessor * pulls in target specific preprocessor macros. * pulls in target-specific builtins from aux target. * sets appropriate host or device attribute on builtins. Differential Revision: http://reviews.llvm.org/D12917 llvm-svn: 248299
OpenPOWER on IntegriCloud