X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FLangRef.rst;h=3540bdec8acef3b54790081a1113fb588d8b6213;hb=38f68c5a2e3993a3ae51421d82e57ccca8f6ec38;hp=ffe3f09d83b46fa494da69726b90eb19cdc4c390;hpb=a9ad60c412327bc124258d4b9926436087e68ac4;p=oota-llvm.git diff --git a/docs/LangRef.rst b/docs/LangRef.rst index ffe3f09d83b..3540bdec8ac 100644 --- a/docs/LangRef.rst +++ b/docs/LangRef.rst @@ -274,27 +274,8 @@ linkage: visible, meaning that it participates in linkage and can be used to resolve external symbol references. -The next two types of linkage are targeted for Microsoft Windows -platform only. They are designed to support importing (exporting) -symbols from (to) DLLs (Dynamic Link Libraries). - -``dllimport`` - "``dllimport``" linkage causes the compiler to reference a function - or variable via a global pointer to a pointer that is set up by the - DLL exporting the symbol. On Microsoft Windows targets, the pointer - name is formed by combining ``__imp_`` and the function or variable - name. -``dllexport`` - "``dllexport``" linkage causes the compiler to provide a global - pointer to a pointer in a DLL, so that it can be referenced with the - ``dllimport`` attribute. On Microsoft Windows targets, the pointer - name is formed by combining ``__imp_`` and the function or variable - name. Since this linkage exists for defining a dll interface, the - compiler, assembler and linker know it is externally referenced and - must refrain from deleting the symbol. - It is illegal for a function *declaration* to have any linkage type -other than ``external``, ``dllimport`` or ``extern_weak``. +other than ``external`` or ``extern_weak``. .. _callingconv: @@ -416,6 +397,25 @@ styles: .. _namedtypes: +DLL Storage Classes +------------------- + +All Global Variables, Functions and Aliases can have one of the following +DLL storage class: + +``dllimport`` + "``dllimport``" causes the compiler to reference a function or variable via + a global pointer to a pointer that is set up by the DLL exporting the + symbol. On Microsoft Windows targets, the pointer name is formed by + combining ``__imp_`` and the function or variable name. +``dllexport`` + "``dllexport``" causes the compiler to provide a global pointer to a pointer + in a DLL, so that it can be referenced with the ``dllimport`` attribute. On + Microsoft Windows targets, the pointer name is formed by combining + ``__imp_`` and the function or variable name. Since this storage class + exists for defining a dll interface, the compiler, assembler and linker know + it is externally referenced and must refrain from deleting the symbol. + Named Types ----------- @@ -529,6 +529,15 @@ assume that the globals are densely packed in their section and try to iterate over them as an array, alignment padding would break this iteration. +Globals can also have a :ref:`DLL storage class `. + +Syntax:: + + [@ =] [Linkage] [Visibility] [DLLStorageClass] [ThreadLocal] + [AddrSpace] [unnamed_addr] [ExternallyInitialized] + + [, section "name"] [, align ] + For example, the following defines a global in a numbered address space with an initializer, section, and alignment: @@ -556,7 +565,8 @@ Functions LLVM function definitions consist of the "``define``" keyword, an optional :ref:`linkage type `, an optional :ref:`visibility -style `, an optional :ref:`calling convention `, +style `, an optional :ref:`DLL storage class `, +an optional :ref:`calling convention `, an optional ``unnamed_addr`` attribute, a return type, an optional :ref:`parameter attribute ` for the return type, a function name, a (possibly empty) argument list (each with optional :ref:`parameter @@ -567,7 +577,8 @@ curly brace, a list of basic blocks, and a closing curly brace. LLVM function declarations consist of the "``declare``" keyword, an optional :ref:`linkage type `, an optional :ref:`visibility -style `, an optional :ref:`calling convention `, +style `, an optional :ref:`DLL storage class `, +an optional :ref:`calling convention `, an optional ``unnamed_addr`` attribute, a return type, an optional :ref:`parameter attribute ` for the return type, a function name, a possibly empty list of arguments, an optional alignment, an optional @@ -603,7 +614,7 @@ be significant and two identical functions can be merged. Syntax:: - define [linkage] [visibility] + define [linkage] [visibility] [DLLStorageClass] [cconv] [ret attrs] @ ([argument list]) [fn Attrs] [section "name"] [align N] @@ -616,12 +627,13 @@ Aliases Aliases act as "second name" for the aliasee value (which can be either function, global variable, another alias or bitcast of global value). -Aliases may have an optional :ref:`linkage type `, and an optional -:ref:`visibility style `. +Aliases may have an optional :ref:`linkage type `, an optional +:ref:`visibility style `, and an optional :ref:`DLL storage class +`. Syntax:: - @ = alias [Linkage] [Visibility] @ + @ = [Visibility] [DLLStorageClass] alias [Linkage] @ The linkage must be one of ``private``, ``linker_private``, ``linker_private_weak``, ``internal``, ``linkonce``, ``weak``,