summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add XCOFF triple object format type for AIXJason Liu2019-03-121-0/+2
| | | | | | | | | This patch adds an XCOFF triple object format type into LLVM. This XCOFF triple object file type will be used later by object file and assembly generation for the AIX platform. Differential Revision: https://reviews.llvm.org/D58930 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355989 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP 5.0]Add initial support for 'allocate' directive.Alexey Bataev2019-03-071-0/+3
| | | | | | | Added parsing/sema analysis/serialization/deserialization support for 'allocate' directive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355614 91177308-0d34-0410-b5e6-96231b3b80d8
* [PGO] Use the explicit parameter in ProfileSummary API. NFCRong Xu2019-03-011-1/+4
| | | | | | | | Use the explicit parameter in setProfileSummary() and getSummary(). This is a follow-up of r355131. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355209 91177308-0d34-0410-b5e6-96231b3b80d8
* [HIP] change kernel stub nameYaxun Liu2019-02-271-2/+11
| | | | | | | | | | | Add .stub to kernel stub function name so that it is different from kernel name in device code. This is necessary to let debugger find correct symbol for kernel. Differential Revision: https://reviews.llvm.org/D58518 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354948 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeGen] Fix string literal address space casting.Michael Liao2019-02-211-2/+4
| | | | | | | | | | | | | | | | Summary: - If a string literal is reused directly, need to add necessary address space casting if the target requires that. Reviewers: yaxunl Subscribers: jvesely, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58509 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354610 91177308-0d34-0410-b5e6-96231b3b80d8
* [CUDA][HIP] Use device side kernel and variable names when registering themYaxun Liu2019-02-141-1/+1
| | | | | | | | | | | | | | | | | | | __hipRegisterFunction and __hipRegisterVar need to accept device side kernel and variable names so that HIP runtime can associate kernel stub functions in host code with kernel symbols in fat binaries, and associate shadow variables in host code with device variables in fat binaries. Currently, clang assumes kernel functions and device variables have the same name as the kernel stub functions and shadow variables. However, when host is compiled in windows with MSVC C++ ABI and device is compiled with Itanium C++ ABI (e.g. AMDGPU), kernels and device symbols in fat binary are mangled differently than host. This patch gets the device side kernel and variable name by mangling them in the mangle context of aux target. Differential Revision: https://reviews.llvm.org/D58163 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354004 91177308-0d34-0410-b5e6-96231b3b80d8
* [AMDGPU] Require at least protected visibility for certain symbolsScott Linder2019-02-121-0/+3
| | | | | | | | | This allows the global visibility controls to be restrictive while still populating the dynamic symbol table where required. Differential Revision: https://reviews.llvm.org/D56871 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353870 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix r350643 to limit COFF emission to <= 32 BYTES instead of BITS.Erich Keane2019-02-071-3/+5
| | | | | | | | | | The patch in r350643 incorrectly sets the COFF emission based on bits instead of bytes. This patch converts the 32 via CharUnits to bits to compare the correct values. Change-Id: Icf38a16470ad5ae3531374969c033557ddb0d323 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353411 91177308-0d34-0410-b5e6-96231b3b80d8
* [opaque pointer types] Pass function types for runtime function calls.James Y Knight2019-02-051-10/+2
| | | | | | | | | | | | | Emit{Nounwind,}RuntimeCall{,OrInvoke} have been modified to take a FunctionCallee as an argument, and CreateRuntimeFunction has been modified to return a FunctionCallee. All callers have been updated. Additionally, CreateBuiltinFunction is removed, as it was redundant with CreateRuntimeFunction after some previous changes. Differential Revision: https://reviews.llvm.org/D57668 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353184 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove redundant FunctionDecl argument from a couple functions.James Y Knight2019-02-021-4/+2
| | | | | | | | | | | | | | | | | | This argument was added in r254554 in order to support the pass_object_size attribute. However, in r296076, the attribute's presence is now also represented in FunctionProtoType's ExtParameterInfo, and thus it's unnecessary to pass along a separate FunctionDecl. The functions modified are: RequiredArgs::forPrototype{,Plus}, and CodeGenTypes::ConvertFunctionType. After this, it's also (again) unnecessary to have a separate ConvertFunctionType function ConvertType, so convert callers back to the latter, leaving the former as an internal helper function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352946 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenMP 5.0] Parsing/sema support for "omp declare mapper" directive.Michael Kruse2019-02-011-0/+8
| | | | | | | | | | | | | | | | | This patch implements parsing and sema for "omp declare mapper" directive. User defined mapper, i.e., declare mapper directive, is a new feature in OpenMP 5.0. It is introduced to extend existing map clauses for the purpose of simplifying the copy of complex data structures between host and device (i.e., deep copy). An example is shown below: struct S { int len; int *d; }; #pragma omp declare mapper(struct S s) map(s, s.d[0:s.len]) // Memory region that d points to is also mapped using this mapper. Contributed-by: Lingda Li <lildmh@gmail.com> Differential Revision: https://reviews.llvm.org/D56326 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352906 91177308-0d34-0410-b5e6-96231b3b80d8
* Cleanup: replace uses of CallSite with CallBase.James Y Knight2019-01-301-22/+21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352595 91177308-0d34-0410-b5e6-96231b3b80d8
* Add -fapply-global-visibility-to-externs for -cc1Scott Linder2019-01-281-2/+4
| | | | | | | | | | | | | Introduce an option to request global visibility settings be applied to declarations without a definition or an explicit visibility, rather than the existing behavior of giving these default visibility. When the visibility of all or most extern definitions are known this allows for the same optimisations -fvisibility permits without updating source code to annotate all declarations. Differential Revision: https://reviews.llvm.org/D56868 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352391 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeGen] Implement isTriviallyRecursive with StmtVisitor instead of ↵Reid Kleckner2019-01-251-19/+21
| | | | | | | | | | | | | | | | | | | RecursiveASTVisitor This code doesn't need to traverse types, lambdas, template arguments, etc to detect trivial recursion. We can do a basic statement traversal instead. This reduces the time spent compiling CodeGenModule.cpp, the object file size (mostly reduced debug info), and the final executable size by a small amount. I measured the exe mostly to check how much of the overhead is from debug info, object file section headers, etc, vs actual code. metric | before | after | diff time (s) | 47.4 | 38.5 | -8.9 obj (kb) | 12888 | 12012 | -876 exe (kb) | 86072 | 85996 | -76 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352232 91177308-0d34-0410-b5e6-96231b3b80d8
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
* Emit !callback metadata and introduce the callback attributeJohannes Doerfert2019-01-191-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | With commit r351627, LLVM gained the ability to apply (existing) IPO optimizations on indirections through callbacks, or transitive calls. The general idea is that we use an abstraction to hide the middle man and represent the callback call in the context of the initial caller. It is described in more detail in the commit message of the LLVM patch r351627, the llvm::AbstractCallSite class description, and the language reference section on callback-metadata. This commit enables clang to emit !callback metadata that is understood by LLVM. It does so in three different cases: 1) For known broker functions declarations that are directly generated, e.g., __kmpc_fork_call for the OpenMP pragma parallel. 2) For known broker functions that are identified by their name and source location through the builtin detection, e.g., pthread_create from the POSIX thread API. 3) For user annotated functions that carry the "callback(callee, ...)" attribute. The attribute has to include the name, or index, of the callback callee and how the passed arguments can be identified (as many as the callback callee has). See the callback attribute documentation for detailed information. Differential Revision: https://reviews.llvm.org/D55483 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351629 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Remove debug printf unintentionally added in r351228.Peter Collingbourne2019-01-151-4/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351241 91177308-0d34-0410-b5e6-96231b3b80d8
* [MSP430] Provide a toolchain descriptionAnton Korobeynikov2019-01-151-2/+4
| | | | | | | | | | | | | | | | This is an initial implementation for msp430 toolchain including -mmcu option support -mhwmult options support -integrated-as by default The toolchain uses msp430-elf-as as a linker and supports msp430-gcc toolchain tree. Patch by Kristina Bessonova! Differential Revision: https://reviews.llvm.org/D56658 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351228 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeGen] Clarify comment about COFF common symbol alignmentShoaib Meenai2019-01-091-2/+6
| | | | | | | | | | | | | After a discussion on the commit thread, it seems the 32 byte alignment limitation is an MSVC toolchain artifact, not an inherent COFF restriction. Clarify the comment accordingly, since saying COFF in the comment but using isKnownWindowsMSVCEnvironment in the conditional is confusing. Also add a newline before the comment, which is consistent with the local style. Differential Revision: https://reviews.llvm.org/D56466 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350754 91177308-0d34-0410-b5e6-96231b3b80d8
* Limit COFF 'common' emission to <=32 alignment types.Erich Keane2019-01-081-0/+5
| | | | | | | | | | | | | | | | | As reported in PR33035, LLVM crashes if given a common object with an alignment of greater than 32 bits. This is because the COFF file format does not support these alignments, so emitting them is broken anyway. This patch changes any global definitions greater than 32 bit alignment to no longer be in 'common'. https://bugs.llvm.org/show_bug.cgi?id=33035 Differential Revision: https://reviews.llvm.org/D56391 Change-Id: I48609289753b7f3b58c5e2bc1712756750fbd45a git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350643 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: fix autolink emission on ELFSaleem Abdulrasool2019-01-051-5/+15
| | | | | | | | | The autolinking extension for ELF uses a slightly different format for encoding the autolink information compared to COFF and MachO. Account for this in the CGM to ensure that we do not assert when emitting assembly or an object file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350476 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: switch iteration to range based for loop (NFC)Saleem Abdulrasool2019-01-051-6/+4
| | | | | | | Change a loop to range based instead while working on cleaning up some modules autolinking issues on Linux. NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350472 91177308-0d34-0410-b5e6-96231b3b80d8
* [CUDA] Treat extern global variable shadows same as regular extern vars.Artem Belevich2018-12-221-10/+5
| | | | | | | | | | | This fixes compiler crash when we attempted to compile this code: extern __device__ int data; __device__ int data = 1; Differential Revision: https://reviews.llvm.org/D56033 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349981 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement -frecord-command-line (-frecord-gcc-switches)Scott Linder2018-12-141-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | Implement options in clang to enable recording the driver command-line in an ELF section. Implement a new special named metadata, llvm.commandline, to support frontends embedding their command-line options in IR/ASM/ELF. This differs from the GCC implementation in some key ways: * In GCC there is only one command-line possible per compilation-unit, in LLVM it mirrors llvm.ident and multiple are allowed. * In GCC individual options are separated by NULL bytes, in LLVM entire command-lines are separated by NULL bytes. The advantage of the GCC approach is to clearly delineate options in the face of embedded spaces. The advantage of the LLVM approach is to support merging multiple command-lines unambiguously, while handling embedded spaces with escaping. Differential Revision: https://reviews.llvm.org/D54487 Clang Differential Revision: https://reviews.llvm.org/D54489 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349155 91177308-0d34-0410-b5e6-96231b3b80d8
* [CUDA] Make all host-side shadows of device-side variables undef.Artem Belevich2018-12-131-2/+9
| | | | | | | | | | The host-side code can't (and should not) access the values that may only exist on the device side. E.g. address of a __device__ function does not exist on the host side as we don't generate the code for it there. Differential Revision: https://reviews.llvm.org/D55663 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349087 91177308-0d34-0410-b5e6-96231b3b80d8
* Move CodeGenOptions from Frontend to BasicRichard Trieu2018-12-111-1/+1
| | | | | | | Basic uses CodeGenOptions and should not depend on Frontend. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348827 91177308-0d34-0410-b5e6-96231b3b80d8
* Make CPUDispatch resolver emit dependent functions.Erich Keane2018-12-071-2/+13
| | | | | | | | | | | Inline cpu_specific versions referenced before the cpu_dispatch function weren't properly emitted, since they hadn't been referred to. This patch ensures that during resolver generation that all appropriate versions are emitted. Change-Id: I94c3766aaf9c75ca07a0ad8258efdbb834654ff8 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348600 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove CodeGen dependencies on Sema.Richard Trieu2018-12-061-1/+1
| | | | | | | | Move diagnostics from Sema to Frontend (or Common) so that CodeGen no longer needs to include the Sema diagnostic IDs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348458 91177308-0d34-0410-b5e6-96231b3b80d8
* Correct 'target' default behavior on redecl, allow forward declaration.Erich Keane2018-11-281-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | Declarations without the attribute were disallowed because it would be ambiguous which 'target' it was supposed to be on. For example: void ___attribute__((target("v1"))) foo(); void foo(); // Redecl of above, or fwd decl of below? void ___attribute__((target("v2"))) foo(); However, a first declaration doesn't have that problem, and erroring prevents it from working in cases where the forward declaration is useful. Additionally, a forward declaration of target==default wouldn't properly cause multiversioning, so this patch fixes that. The patch was not split since the 'default' fix would require implementing the same check for that case, followed by undoing the same change for the fwd-decl implementation. Change-Id: I66f2c5bc2477bcd3f7544b9c16c83ece257077b0 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347805 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC] Move MultIversioning::Type into Decl so that it can be used inErich Keane2018-11-281-2/+9
| | | | | | | | CodeGen Change-Id: I32b14edca3501277e0e65672eafe3eea38c6f9ae git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347791 91177308-0d34-0410-b5e6-96231b3b80d8
* [codeview] Expose -gcodeview-ghash for global type hashingReid Kleckner2018-11-161-0/+3
| | | | | | | | | | | | | | | | | | | | | Summary: Experience has shown that the functionality is useful. It makes linking optimized clang with debug info for me a lot faster, 20s to 13s. The type merging phase of PDB writing goes from 10s to 3s. This removes the LLVM cl::opt and replaces it with a metadata flag. After this change, users can do the following to use ghash: - add -gcodeview-ghash to compiler flags - replace /DEBUG with /DEBUG:GHASH in linker flags Reviewers: zturner, hans, thakis, takuto.ikuta Subscribers: aprantl, hiraditya, JDevlieghere, llvm-commits Differential Revision: https://reviews.llvm.org/D54370 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347072 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC] Move storage of dispatch-version to GlobalDeclErich Keane2018-11-131-47/+46
| | | | | | | | | | | | | | | | | | | | As suggested by Richard Smith, and initially put up for review here: https://reviews.llvm.org/D53341, this patch removes a hack that was used to ensure that proper target-feature lists were used when emitting cpu-dispatch (and eventually, target-clones) implementations. As a part of this, the GlobalDecl object is proliferated to a bunch more locations. Originally, this was put up for review (see above) to get acceptance on the approach, though discussion with Richard in San Diego showed he approved of the approach taken here. Thus, I believe this is acceptable for Review-After-commit Differential Revision: https://reviews.llvm.org/D53341 Change-Id: I0a0bd673340d334d93feac789d653e03d9f6b1d5 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346757 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the correct address space when emitting the ctor function listDylan McKay2018-11-091-2/+3
| | | | | | | | | | | | | | | | | This patch modifies clang so that, if compiling for a target that explicitly specifies a nonzero program memory address space, the constructor list global will have the same address space as the functions it contains. AVR is the only in-tree backend which has a nonzero program memory address space. Without this, the IR verifier would always fail if a constructor was used on a Harvard architecture backend. This has no functional change to any in-tree backends except AVR. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346520 91177308-0d34-0410-b5e6-96231b3b80d8
* CPU-Dispatch- Fix type of a member function, prevent deferralsErich Keane2018-11-011-2/+8
| | | | | | | | | | | The member type creation for a cpu-dispatch function was not correctly including the 'this' parameter, so ensure that the type is properly determined. Also, disable defer in the cases of emitting the functoins, as it can end up resulting in the wrong version being emitted. Change-Id: I0b8fc5e0b0d1ae1a9d98fd54f35f27f6e5d5d083 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345838 91177308-0d34-0410-b5e6-96231b3b80d8
* CPU-Dispatch-- Fix conflict between 'generic' and 'pentium'Erich Keane2018-11-011-0/+16
| | | | | | | | | | | | | | | | | | When a dispatch function was being emitted that had both a generic and a pentium configuration listed, we would assert. This is because neither configuration has any 'features' associated with it so they were both considered the 'default' version. 'pentium' lacks any features because we implement it in terms of __builtin_cpu_supports (instead of Intel proprietary checks), which is unable to decern between the two. The fix for this is to omit the 'generic' version from the dispatcher if both are present. This permits existing code to compile, and still will choose the 'best' version available (since 'pentium' is technically better than 'generic'). Change-Id: I4b69f3e0344e74cbdbb04497845d5895dd05fda0 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345826 91177308-0d34-0410-b5e6-96231b3b80d8
* NFC: Remove the ObjC1/ObjC2 distinction from clang (and related projects)Erik Pilkington2018-10-301-2/+2
| | | | | | | | | | We haven't supported compiling ObjC1 for a long time (and never will again), so there isn't any reason to keep these separate. This patch replaces LangOpts::ObjC1 and LangOpts::ObjC2 with LangOpts::ObjC. Differential revision: https://reviews.llvm.org/D53547 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345637 91177308-0d34-0410-b5e6-96231b3b80d8
* PR31978: Don't crash if CodeGen sees a top-level BindingDecl.Richard Smith2018-10-261-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345362 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: correct the case for swift 4.2, 5.0Saleem Abdulrasool2018-10-261-4/+4
| | | | | | | This corrects the leader for the swift names. The encoding for 4.2 and 5.0 differ by a single bit on the second character and were swapped. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345360 91177308-0d34-0410-b5e6-96231b3b80d8
* Change keep-static-consts to work on static storage duration, notErich Keane2018-10-251-2/+3
| | | | | | | | | | | storage class. To be more in line with what GCC does, switch the condition to be based on the Static Storage duration instead of the storage class. Change-Id: I8e959d762433cda48855099353bf3c950b9d54b8 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345302 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement Function Multiversioning for Non-ELF Systems.Erich Keane2018-10-251-34/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | Similar to how ICC handles CPU-Dispatch on Windows, this patch uses the resolver function directly to forward the call to the proper function. This is not nearly as efficient as IFuncs of course, but is still quite useful for large functions specifically developed for certain processors. This is unfortunately still limited to x86, since it depends on __builtin_cpu_supports and __builtin_cpu_is, which are x86 builtins. The naming for the resolver/forwarding function for cpu-dispatch was taken from ICC's implementation, which uses the unmodified name for this (no mangling additions). This is possible, since cpu-dispatch uses '.A' for the 'default' version. In 'target' multiversioning, this function keeps the '.resolver' extension in order to keep the default function keeping the default mangling. Change-Id: I4731555a39be26c7ad59a2d8fda6fa1a50f73284 Differential Revision: https://reviews.llvm.org/D53586 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345298 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: alter CFConstantString class name for swift 5.0Saleem Abdulrasool2018-10-251-1/+6
| | | | | | | Swift 5.0 has changed the name decoration for swift symbols, using a 'S' sigil rather than 's' as in 4.2. Adopt the new convention. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345291 91177308-0d34-0410-b5e6-96231b3b80d8
* Driver,CodeGen: introduce support for Swift CFString layoutSaleem Abdulrasool2018-10-241-6/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new driver level flag `-fcf-runtime-abi=` that allows one to specify the runtime ABI for CoreFoundation. This controls the language interoperability. In particular, this is relevant for generating the CFConstantString classes (primarily through the `__builtin___CFStringMakeConstantString` builtin) which construct a reference to the "CFObject"'s `isa` field. This type differs between swift 4.1 and 4.2+. Valid values for the new option include: - objc [default behaviour] - enable ObjectiveC interoperability - swift-4.1 - enable interoperability with swift 4.1 - swift-4.2 - enable interoperability with swift 4.2 - swift-5.0 - enable interoperability with swift 5.0 - swift [alias] - target the latest swift ABI Furthermore, swift 4.2+ changed the layout for the CFString when building CoreFoundation *without* ObjectiveC interoperability. In such a case, a field was added to the CFObject base type changing it from: <{ const int*, int }> to <{ uintptr_t, uintptr_t, uint64_t }>. In swift 5.0, the CFString type will be further adjusted to change the length from a uint32_t on everything but BE LP64 targets to uint64_t. Note that the default behaviour for clang remains unchanged and the new layout must be explicitly opted into via `-fcf-runtime-abi=swift*`. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345222 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: extract some local variables in CFConstantString creation (NFC)Saleem Abdulrasool2018-10-241-19/+18
| | | | | | | Extract the reference to the ASTContext and Triple and use them throughout the function. This is simply a cosmetic cleanup while in the area. NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345160 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeGen] Attach InlineHint to more functionsRichard Trieu2018-10-231-3/+13
| | | | | | | | | For instantiated functions, search the template pattern to see if it marked inline to determine if InlineHint attribute should be added to the function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344987 91177308-0d34-0410-b5e6-96231b3b80d8
* Give Multiversion-inline functions linkonce linkageErich Keane2018-10-221-0/+4
| | | | | | | | | | | | | Since multiversion variant functions can be inline, in C they become available-externally linkage. This ends up causing the variants to not be emitted, and not available to the linker. The solution is to make sure that multiversion functions are always emitted by marking them linkonce. Change-Id: I897aa37c7cbba0c1eb2c57ee881d5000a2113b75 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344957 91177308-0d34-0410-b5e6-96231b3b80d8
* NFC: Remove trailing space from CodeGenModule.cppTakuto Ikuta2018-10-171-8/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344668 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a flag to remap manglings when reading profile data information.Richard Smith2018-10-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This can be used to preserve profiling information across codebase changes that have widespread impact on mangled names, but across which most profiling data should still be usable. For example, when switching from libstdc++ to libc++, or from the old libstdc++ ABI to the new ABI, or even from a 32-bit to a 64-bit build. The user can provide a remapping file specifying parts of mangled names that should be treated as equivalent (eg, std::__1 should be treated as equivalent to std::__cxx11), and profile data will be treated as applying to a particular function if its name is equivalent to the name of a function in the profile data under the provided equivalences. See the documentation change for a description of how this is configured. Remapping is supported for both sample-based profiling and instruction profiling. We do not support remapping indirect branch target information, but all other profile data should be remapped appropriately. Support is only added for the new pass manager. If someone wants to also add support for this for the old pass manager, doing so should be straightforward. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344199 91177308-0d34-0410-b5e6-96231b3b80d8
* clang: Allow ifunc resolvers to accept argumentsEd Maste2018-10-101-2/+0
| | | | | | | | | | | | | | | | | | | When ifunc support was added to Clang (r265917) it did not allow resolvers to take function arguments. This was based on GCC's documentation, which states resolvers return a pointer and take no arguments. However, GCC actually allows resolvers to take arguments, and glibc (on non-x86 platforms) and FreeBSD (on x86 and arm64) pass some CPU identification information as arguments to ifunc resolvers. I believe GCC's documentation is simply incorrect / out-of-date. FreeBSD already removed the prohibition in their in-tree Clang copy. Differential Revision: https://reviews.llvm.org/D52703 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344100 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the container form llvm::sort(C, ...)Fangrui Song2018-09-301-3/+2
| | | | | | | | | There are a few leftovers of rC343147 that are not (\w+)\.begin but in the form of ([-[:alnum:]>.]+)\.begin or spanning two lines. Change them to use the container form in this commit. The 12 occurrences have been inspected manually for safety. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343425 91177308-0d34-0410-b5e6-96231b3b80d8
* llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)Fangrui Song2018-09-261-1/+1
| | | | | | | | | | | | | | Summary: The convenience wrapper in STLExtras is available since rL342102. Reviewers: rsmith, #clang, dblaikie Reviewed By: rsmith, #clang Subscribers: mgrang, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52576 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343147 91177308-0d34-0410-b5e6-96231b3b80d8