Skip to content

[Documentation] Update parameter and function attribute section in LangRef #114007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 2, 2024

Conversation

rajatbajpai
Copy link
Contributor

Update the documentation for parameter and function attributes to include support for target-dependent string attributes.

@llvmbot
Copy link
Member

llvmbot commented Oct 29, 2024

@llvm/pr-subscribers-llvm-ir

Author: Rajat Bajpai (rajatbajpai)

Changes

Update the documentation for parameter and function attributes to include support for target-dependent string attributes.


Full diff: https://github.com/llvm/llvm-project/pull/114007.diff

1 Files Affected:

  • (modified) llvm/docs/LangRef.rst (+10-6)
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index f9ec33da1b651b..f7e619cc14a24e 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -1161,15 +1161,17 @@ parameters of a function. Parameter 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.
 
-Parameter attributes are simple keywords that follow the type specified.
-If multiple parameter attributes are needed, they are space separated.
-For example:
+Parameter attributes are simple keywords that follow the specified type.
+When multiple parameter attributes are required, they are separated by
+spaces. Additionally, target-dependent attributes can be provided as a
+string. For example:
 
 .. code-block:: llvm
 
     declare i32 @printf(ptr noalias nocapture, ...)
     declare i32 @atoi(i8 zeroext)
     declare signext i8 @returns_signed_char()
+    define void @baz(i32 "amdgpu-flat-work-group-size"="1,256" %x)
 
 Note that any attributes for the function result (``nonnull``,
 ``signext``) come before the result type.
@@ -1843,9 +1845,10 @@ a function. Function attributes are considered to be part of the
 function, not of the function type, so functions with different function
 attributes can have the same function type.
 
-Function attributes are simple keywords that follow the type specified.
-If multiple attributes are needed, they are space separated. For
-example:
+Function attributes are simple keywords that follow the specified type. 
+When multiple attributes are required, they are separated by spaces.
+Additionally, target-dependent attributes can be provided as a string.
+For example:
 
 .. code-block:: llvm
 
@@ -1853,6 +1856,7 @@ example:
     define void @f() alwaysinline { ... }
     define void @f() alwaysinline optsize { ... }
     define void @f() optsize { ... }
+    define void @f() "no-sse" { ... }
 
 ``alignstack(<n>)``
     This attribute indicates that, when emitting the prologue and

@rajatbajpai
Copy link
Contributor Author

Can someone please take a look at this change? Thanks!

For example:
Parameter attributes are simple keywords that follow the specified type.
When multiple parameter attributes are required, they are separated by
spaces. Additionally, target-dependent attributes can be provided as a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the terminology "target-dependent attributes" is really in use anymore, these are simply "string attributes". We have plenty of target-independent string attributes as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Nikita. I have updated the changes.

Update the documentation for parameter and function attributes to
include support for string attributes.
@rajatbajpai rajatbajpai force-pushed the dev/rbajpai-string-attr-docs branch from 596be30 to c21bcdd Compare November 2, 2024 06:56
Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nikic nikic merged commit 7603fea into llvm:main Nov 2, 2024
9 checks passed
@rajatbajpai
Copy link
Contributor Author

Thank you, Nikita!

smallp-o-p pushed a commit to smallp-o-p/llvm-project that referenced this pull request Nov 3, 2024
…ngRef (llvm#114007)

Update the documentation for parameter and function attributes to
include support for target-dependent string attributes.
NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this pull request Nov 4, 2024
…ngRef (llvm#114007)

Update the documentation for parameter and function attributes to
include support for target-dependent string attributes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants