diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-05-16 20:39:27 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-05-16 20:39:27 +0000 |
commit | 1ce308866915c9eab78486066d28d2107b7fede2 (patch) | |
tree | 9de4e45b4a8b60edb08ccdb8d31577d12b38c2e9 /docs | |
parent | dedd6203ad632d99de7648c43e482af8476ba6ed (diff) | |
download | llvm-1ce308866915c9eab78486066d28d2107b7fede2.tar.gz llvm-1ce308866915c9eab78486066d28d2107b7fede2.tar.bz2 llvm-1ce308866915c9eab78486066d28d2107b7fede2.tar.xz |
Add comdat key field to llvm.global_ctors and llvm.global_dtors
This allows us to put dynamic initializers for weak data into the same
comdat group as the data being initialized. This is necessary for MSVC
ABI compatibility. Once we have comdats for guard variables, we can use
the combination to help GlobalOpt fire more often for weak data with
guarded initialization on other platforms.
Reviewers: nlewycky
Differential Revision: http://reviews.llvm.org/D3499
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209015 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r-- | docs/LangRef.rst | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/docs/LangRef.rst b/docs/LangRef.rst index 54b606d037..d2f9a1d4f1 100644 --- a/docs/LangRef.rst +++ b/docs/LangRef.rst @@ -3152,14 +3152,18 @@ The '``llvm.global_ctors``' Global Variable .. code-block:: llvm - %0 = type { i32, void ()* } - @llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @ctor }] + %0 = type { i32, void ()*, i8* } + @llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @ctor, i8* @data }] The ``@llvm.global_ctors`` array contains a list of constructor -functions and associated priorities. The functions referenced by this -array will be called in ascending order of priority (i.e. lowest first) -when the module is loaded. The order of functions with the same priority -is not defined. +functions, priorities, and an optional associated global or function. +The functions referenced by this array will be called in ascending order +of priority (i.e. lowest first) when the module is loaded. The order of +functions with the same priority is not defined. + +If the third field is present, non-null, and points to a global variable +or function, the initializer function will only run if the associated +data from the current module is not discarded. .. _llvmglobaldtors: @@ -3168,14 +3172,18 @@ The '``llvm.global_dtors``' Global Variable .. code-block:: llvm - %0 = type { i32, void ()* } - @llvm.global_dtors = appending global [1 x %0] [%0 { i32 65535, void ()* @dtor }] + %0 = type { i32, void ()*, i8* } + @llvm.global_dtors = appending global [1 x %0] [%0 { i32 65535, void ()* @dtor, i8* @data }] + +The ``@llvm.global_dtors`` array contains a list of destructor +functions, priorities, and an optional associated global or function. +The functions referenced by this array will be called in descending +order of priority (i.e. highest first) when the module is loaded. The +order of functions with the same priority is not defined. -The ``@llvm.global_dtors`` array contains a list of destructor functions -and associated priorities. The functions referenced by this array will -be called in descending order of priority (i.e. highest first) when the -module is loaded. The order of functions with the same priority is not -defined. +If the third field is present, non-null, and points to a global variable +or function, the destructor function will only run if the associated +data from the current module is not discarded. Instruction Reference ===================== |