🌐
LLVM
llvm.org › docs › HowToUseAttributes.html
How To Use Attributes — LLVM 23.0.0git documentation
A function’s attributes are at index AttributeList::FunctionIndex; the return type’s attributes are at index AttributeList::ReturnIndex; and the function’s parameters’ attributes are at indices 1, …, n (where ‘n’ is the number of parameters).
🌐
LLVM
llvm.org › docs › LangRef.html
LLVM Language Reference Manual — LLVM 23.0.0git documentation
May 12, 2026 - LLVM function declarations consist of the “declare” keyword, an optional linkage type, an optional visibility style, an optional DLL storage class, an optional calling convention, an optional unnamed_addr or local_unnamed_addr attribute, an optional address space, a return type, an optional parameter attribute for the return type, a function name, a possibly empty list of arguments, an optional alignment, an optional garbage collector name, an optional prefix, and an optional prologue.
Discussions

clang - Accessing arguments to llvm function attributes - Stack Overflow
This question refers specifically to LLVM 3.9. Questions up front: Do I need to do anything else to get a function attribute to take an argument? I've included the changes to the LLVM codebase I've More on stackoverflow.com
🌐 stackoverflow.com
ubuntu - LLVM. Add function attributes info - Stack Overflow
With LLVM 3.4 I create a function with attributes: attributes #0 = { nounwind uwtable } . It seems not bad, but clang++ writes much more information in same function: attributes #0 = { nounwind u... More on stackoverflow.com
🌐 stackoverflow.com
February 8, 2016
compiler construction - Adding the inreg attribute to LLVM IR function parameters - Stack Overflow
Assigning an attribute to a function argument actually means replacing the set representing all function and argument attributes with a new one. Fortunately, there are at least helper functions that makes that job a bit easier. I suggest using llvm::Function::addAttribute() method. More on stackoverflow.com
🌐 stackoverflow.com
How to add an attribute group to a function call in LLVM? - Stack Overflow
When compiling a program with clang I observe the following in the LLVM IR: Given the following function declaration: declare i32 @atoi(i8*) #2 Which has the following attributes: attributes #2 ... More on stackoverflow.com
🌐 stackoverflow.com
November 19, 2018
🌐
LLVM
llvm.org › doxygen › classllvm_1_1Function.html
LLVM: llvm::Function Class Reference
Add return value attributes to this function. Definition at line 662 of file Function.cpp. Definition at line 868 of file Function.h. Referenced by args(), args(), llvm::CloneFunction(), llvm::orc::cloneFunctionDecl(), createMergedFunction(), doPromotion(), hasSameArgumentList(), hostParallelCallback(), llvm::InlineFunctionImpl(), llvm::Attributor::internalizeFunctions(), LLVMGetNextParam(), LLVMGetParam(), llvm::instrumentor::FunctionIO::setArguments(), and targetParallelCallback().
🌐
LLVM
llvm.org › doxygen › classllvm_1_1Attribute.html
LLVM: llvm::Attribute Class Reference
Functions, function parameters, and return types can have attributes to indicate how they should be treated by optimizations and code generation.
🌐
Yossarian.net
blog.yossarian.net › 2021 › 11 › 29 › LLVM-internals-part-4-attributes-and-attribute-groups
LLVM internals, part 4: attributes and attribute groups
November 29, 2021 - Consequently, LLVM’s intrinsics ... substitute function4. Attributes are markers that define special properties on a small subset of program features: functions (and their callsites), individual parameters, and return values....
🌐
Clang
clang.llvm.org › docs › AttributeReference.html
Attributes in Clang — Clang 23.0.0git documentation
For __arm_in, the function takes the state S as input and returns with the state S unchanged. The attribute takes string arguments to instruct the compiler which state is shared.
🌐
LLVM
llvm.org › devmtg › 2016-11 › Slides › Finkel-IntrinsicsMetadataAttributes.pdf pdf
Intrinsics, Metadata, and Attributes: The story continues!
LLVM has both target- ... Properties of functions, function parameters and function return values that are part of the function ... The object pointed to by %a is passed “by value” (a copy is made for use by the callee). This is indicated by the “byval” attribute, which cannot generally ...
🌐
GitHub
gist.github.com › colematt › b440ba3bd610585d6ce1311f706d10e8
[Adding Attributes to LLVM] #llvm · GitHub
Look at code for an existing attribute that functions similarly and imitate it. Use grep -R <attribute> over the $(LLVM_SRC) and $(CLANG_SRC) directories to find every file in which the existing attribute has a presence.
🌐
Google Groups
groups.google.com › g › llvm-dev › c › 1ptivB6H6_c › m › XNFPzxRrAAAJ
[llvm-dev] Function attributes for memory side-effects
The Attributor does internally derive more "locations", basically any combination of: local memory constant memory internal global memory external global memory argument memory inaccessible memory malloced memory (returned by a function with the `noalias` return attribute) unknown memory I want to add some/all of these as attributes but didn't find the time yet. ... > > HTH > > > _______________________________________________ > LLVM Developers mailing list > llvm...@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Find elsewhere
🌐
Carnegie Mellon University
cs.cmu.edu › ~seth › llvm › llvmannotation.html
Adding an annotation that gets to the backend
(All paths to source files are relative to $LLVMBASE ... // mark functions which can be called as a PRSC def YourAttribute : InheritableAttr { let Spellings = [GNU<"yourAttribute">]; let Subjects = SubjectList<[Function]>; let Documentation = [YourAttributeDocs]; } add the docs for the new __attribute__ to AttrDocs.td:
🌐
Stack Overflow
stackoverflow.com › questions › 41350749 › accessing-arguments-to-llvm-function-attributes
clang - Accessing arguments to llvm function attributes - Stack Overflow
Even though I set the functions' attribute argument to an increasing counter beginning at 1, I still get outputs as such: Found member function named: _ZN8simple_t8getValueEv with function ID: 0 · The LLVM IR has the following attribute data for this function:
🌐
LLVM
releases.llvm.org › 7.0.0 › tools › clang › docs › AttributeReference.html
Attributes in Clang — Clang 7 documentation
The compiler will generate a diagnostic for a function declared as _Noreturn that appears to be capable of returning to its caller. The abi_tag attribute can be applied to a function, variable, class or inline namespace declaration to modify the mangled name of the entity.
🌐
Haskell
downloads.haskell.org › ~ghc › 7.4.1 › docs › html › libraries › ghc-7.4.1 › Llvm.html
Llvm
Function attributes are considered to be part of the function, not of the function type, so functions with different parameter attributes can have the same function type. Functions can have multiple attributes. Descriptions taken from http://llvm.org/docs/LangRef.html#fnattrs
🌐
LLVM
releases.llvm.org › 6.0.0 › docs › LangRef.html
LLVM Language Reference Manual — LLVM 6 documentation
March 2, 2018 - LLVM function declarations consist of the “declare” keyword, an optional linkage type, an optional visibility style, an optional DLL storage class, an optional calling convention, an optional unnamed_addr or local_unnamed_addr attribute, a return type, an optional parameter attribute for the return type, a function name, a possibly empty list of arguments, an optional alignment, an optional garbage collector name, an optional prefix, and an optional prologue.
🌐
Google Groups
groups.google.com › g › llvm-dev › c › C9TSp3u9MxI › m › XFcLLReF_oYJ
[LLVMdev] Adding function attributes
Any help is much appreciated Code ==== virtual bool runOnModule(Module& m) { Module* module = &m; for (Module::iterator functionIter = module->begin(); functionIter != module->end(); functionIter++) functionIter->addFnAttr(llvm::Attributes::AlwaysInline); return true; } Command line =========== clang -O0 -S -emit-llvm -o test.S test.c && opt -S -mem2reg -load <path to lib> -mypass < test.S > test_opt.S
🌐
LLVM
llvm.org › doxygen › Attributes_8h.html
LLVM: include/llvm/IR/Attributes.h File Reference
This file contains the simple types necessary to represent the attributes associated with functions and their calls. Definition in file Attributes.h.
🌐
LLVM
llvm.org › doxygen › Attributes_8h_source.html
LLVM: include/llvm/IR/Attributes.h Source File
This class holds the attributes for a particular argument, parameter, function, or return value. ... Return true if attributes exists in this set. ... Remove the specified attribute from this set. ... Add attributes to the attribute set. ... Return true if the attribute exists in this set. ... Try to intersect this AttributeSet with Other. ... Return true if this attribute set belongs to the LLVMContext.
🌐
Stack Overflow
stackoverflow.com › questions › 53379088 › how-to-add-an-attribute-group-to-a-function-call-in-llvm
How to add an attribute group to a function call in LLVM? - Stack Overflow
November 19, 2018 - attributes #2 = { nounwind readonly "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }