Explicitly sets "fast math" for a function, enabling aggressive math optimizations. These optimizations may dramatically change the outcome of floating point calculations (e.g. because of reassociation).
Adds LLVM's "cold" attribute to a function, indicating that this function is rarely called. Control-flow paths calling cold functions are thus considered to be cold too.
Adds LLVM's "naked" attribute to a function, disabling function prologue / epilogue emission, incl. LDC's. Intended to be used in combination with a function body defined via ldc.llvmasm.__asm() and/or ldc.simd.inlineIR().
Add LLVM's "nonlazybind" attribute to a function, suppresses lazy symbol binding. This may make calls to function faster, at the cost of extra program startup time if the function is not called during program startup.
Adds LLVM's "noalias" attribute to a function parameter, with semantics very similar to C99 "restrict". The parameter needs to boil down to a pointer, e.g., be a D pointer, class reference or a ref parameter.
Specifies that the function returns null or a pointer to at least a certain number of allocated bytes. sizeArgIdx and numArgIdx specify the 0-based index of the function arguments that should be used to calculate the number of bytes returned:
Meant for expert use. Overrides the default calling convention. The supported names for calling conventions depends on the target. If specified multiple times, the last applied UDA is used. The calling convention is not part of the type of the function, which means that this attribute cannot be used in combination with function pointers (the function referenced by a function pointer will be called using the default calling convention). Semantic analysis does NOT (yet?) check for correctness. For example when this is applied to a class function, it is up to the user to ensure that the base function and all overrides (in child classes) have the same calling convention applied.
Adds an LLVM attribute to a function, without checking the validity or applicability of the attribute. The attribute is specified as key-value pair: @llvmAttr("key", "value") If the value string is empty, just the key is added as attribute.
Sets LLVM's fast-math flags for floating point operations in the function this attribute is applied to. See LLVM LangRef for possible values: http://llvm.org/docs/LangRef.html#fast-math-flags
@llvmFastMathFlag("clear") clears all flags.
Disables a particular sanitizer for this function. Valid sanitizer names are all names accepted by -fsanitize= commandline option. Multiple sanitizers can be disabled by applying this UDA multiple times, e.g. @noSanitize("address") @noSanitize("thread")` to disable both ASan and TSan.
Sets the optimization strategy for a function. Valid strategies are "none", "optsize", "minsize". The strategies are mutually exclusive.
When applied to a global variable or function, causes it to be emitted to a non-standard object file/executable section.
When applied to a function, specifies that the function should be compiled with different target options than on the command line.
When applied to a global symbol, the compiler, assembler, and linker are required to treat the symbol as if there is a reference to the symbol that it cannot see (which is why they have to be named). For example, it prevents the deletion by the linker of an unreferenced symbol.
When applied to a function, marks this function for dynamic compilation. Calls to the function will be to the dynamically compiled function, instead of to the statically compiled function (the statically compiled function is still emitted into the object file). All functions marked with this attribute must be explicitly compiled in runtime via ldc.dynamic_compile api before usage.
When applied to global variable, this variable will be treated as constant by any dynamically compiled functions and is subject to optimizations. All dynamically compiled functions must be recompiled after any update to such variable.
When applied to a function, makes this function available for dynamic compilation. In contrast to @dynamicCompile, calls to the function will be to the statically compiled function (like normal functions). The function body is made available for dynamic compilation with the jit facilities (e.g. jit bind). If both @dynamicCompile and @dynamicCompileEmit attributes are applied to function, @dynamicCompile will get precedence.
Sets the visibility of a function or global variable to "hidden". Such symbols aren't directly accessible from outside the DSO (executable or DLL/.so/.dylib) and are resolved inside the DSO during linking. If unreferenced within the DSO, the linker can strip a hidden symbol. An export visibility overrides this attribute.
Disables split-stack instrumentation for this function, overriding the -fsplit-stack commandline function.
When applied to a function, specifies that the function should be optimzed by Polly, LLVM's polyhedral optimizer. Useful for optimizing loops for data locatily, vectorization and parallelism.
When applied to a global symbol, specifies that the symbol should be emitted with weak linkage. An example use case is a library function that should be overridable by user code.
Contains compiler-recognized user-defined attribute types.