Skip to content
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

Attribute to always inline a function #561

Closed
dnadlinger opened this issue Dec 28, 2013 · 9 comments
Closed

Attribute to always inline a function #561

dnadlinger opened this issue Dec 28, 2013 · 9 comments

Comments

@dnadlinger
Copy link
Member

It should map to the alwaysinline IR attribute, and also cause such functions from imported modules to be emitted as available_externally to support cross-module inlining (similar to the extra semantic3s we run with inlining enabled).

We might want to implement this as a "blessed" UDA in a runtime module, e.g. ldc.attributes.

redstar added a commit to redstar/ldc that referenced this issue Dec 30, 2013
Introduces an attribute @ldc.attribute which can be used to annotate functions.
Examples:
@ldc.attribute("alwaysinline") void foo() {}

Valid attribute names can be found in the LLVM manual at
http://www.llvm.org/docs/LangRef.html#function-attributes.

This fixes issue ldc-developers#561 and creates a base for issue ldc-developers#547.
redstar added a commit to redstar/ldc that referenced this issue Dec 30, 2013
Introduces an attribute @ldc.attribute which can be used to annotate functions.
Examples:
@ldc.attribute("alwaysinline") void foo() {}

Valid attribute names can be found in the LLVM manual at
http://www.llvm.org/docs/LangRef.html#function-attributes.

This fixes issue ldc-developers#561 and creates a base for issue ldc-developers#547.
@redstar
Copy link
Member

redstar commented Dec 30, 2013

#563 is a first implementation of UDAs. It can handle all function attributes except alignstack(<n>). It is currently for LLVM 3.4 only and also misses checks (e.g. a function cannot have the alwaysinline and noinline attribute at the same time).

@dnadlinger
Copy link
Member Author

@redstar: See my comment there.

redstar added a commit to redstar/ldc that referenced this issue Dec 30, 2013
Introduces an attribute @ldc.attribute which can be used to annotate functions.
Examples:
@ldc.attribute("alwaysinline") void foo() {}

Valid attribute names can be found in the LLVM manual at
http://www.llvm.org/docs/LangRef.html#function-attributes.

This fixes issue ldc-developers#561 and creates a base for issue ldc-developers#547.
redstar added a commit to redstar/ldc that referenced this issue Dec 30, 2013
Introduces an attribute @ldc.attribute which can be used to annotate functions.
Examples:
@ldc.attribute("alwaysinline") void foo() {}

Valid attribute names can be found in the LLVM manual at
http://www.llvm.org/docs/LangRef.html#function-attributes.

This fixes issue ldc-developers#561 and creates a base for issue ldc-developers#547.
redstar added a commit to redstar/ldc that referenced this issue Dec 30, 2013
Introduces an attribute @ldc.attribute which can be used to annotate functions.
Examples:
@ldc.attribute("alwaysinline") void foo() {}

Valid attribute names can be found in the LLVM manual at
http://www.llvm.org/docs/LangRef.html#function-attributes.

This fixes issue ldc-developers#561 and creates a base for issue ldc-developers#547.
redstar added a commit to redstar/ldc that referenced this issue Dec 31, 2013
Introduces an attribute @ldc.attribute which can be used to annotate functions.
Examples:
@ldc.attribute("alwaysinline") void foo() {}

Valid attribute names can be found in the LLVM manual at
http://www.llvm.org/docs/LangRef.html#function-attributes.

This fixes issue ldc-developers#561 and creates a base for issue ldc-developers#547.
@jkrempus
Copy link
Contributor

jkrempus commented Jan 2, 2014

I've been working on inlining of functions imported from modules not given on the command line. The code is here. It seems to work, but I am not sure whether my changes can cause some other issues.

redstar added a commit to redstar/ldc that referenced this issue Jan 2, 2014
Introduces an attribute @ldc.attribute which can be used to annotate functions.
Examples:
@ldc.attribute("alwaysinline") void foo() {}

Valid attribute names can be found in the LLVM manual at
http://www.llvm.org/docs/LangRef.html#function-attributes.

This fixes issue ldc-developers#561 and creates a base for issue ldc-developers#547.
jkrempus pushed a commit to jkrempus/ldc that referenced this issue Jan 5, 2014
Introduces an attribute @ldc.attribute which can be used to annotate functions.
Examples:
@ldc.attribute("alwaysinline") void foo() {}

Valid attribute names can be found in the LLVM manual at
http://www.llvm.org/docs/LangRef.html#function-attributes.

This fixes issue ldc-developers#561 and creates a base for issue ldc-developers#547.
jkrempus pushed a commit to jkrempus/ldc that referenced this issue Jan 7, 2014
Introduces an attribute @ldc.attribute which can be used to annotate functions.
Examples:
@ldc.attribute("alwaysinline") void foo() {}

Valid attribute names can be found in the LLVM manual at
http://www.llvm.org/docs/LangRef.html#function-attributes.

This fixes issue ldc-developers#561 and creates a base for issue ldc-developers#547.
redstar added a commit to redstar/ldc that referenced this issue Jan 8, 2014
Introduces an attribute @ldc.attribute which can be used to annotate functions.
Examples:
@ldc.attribute("alwaysinline") void foo() {}

Valid attribute names can be found in the LLVM manual at
http://www.llvm.org/docs/LangRef.html#function-attributes.

This fixes issue ldc-developers#561 and creates a base for issue ldc-developers#547.
@dnadlinger
Copy link
Member Author

@jerro: Sorry for my delayed reply, I was hoping that @redstar would get around to look at your changes. The basic concept seems good, thanks a lot for you work. However, I'm a bit wary of making an LDC-only change to name mangling/derivation. Could you maybe submit them as a DMD pull request to see what @9rnsr and the others have to say?

redstar added a commit to redstar/ldc that referenced this issue Jan 13, 2014
Introduces an attribute @ldc.attribute which can be used to annotate functions.
Examples:
@ldc.attribute("alwaysinline") void foo() {}

Valid attribute names can be found in the LLVM manual at
http://www.llvm.org/docs/LangRef.html#function-attributes.

This fixes issue ldc-developers#561 and creates a base for issue ldc-developers#547.
redstar added a commit to redstar/ldc that referenced this issue Jan 20, 2014
Introduces an attribute @ldc.attribute which can be used to annotate functions.
Examples:
@ldc.attribute("alwaysinline") void foo() {}

Valid attribute names can be found in the LLVM manual at
http://www.llvm.org/docs/LangRef.html#function-attributes.

This fixes issue ldc-developers#561 and creates a base for issue ldc-developers#547.
@Trass3r
Copy link
Contributor

Trass3r commented Jul 3, 2014

ldc.attributes is fine for ldc-specific attributes but especially ones that are so commonly used like alwaysinline should be short (@alwaysinline) and supported by all compilers.
Otherwise you get a situation as messy as in C++.

@dnadlinger
Copy link
Member Author

@Trass3r: attribute("alwaysinline") isn't enough for supporting a proper "always inline" feature anyway, as it needs to trigger emission of code that might not have otherwise been emitted (marked with available_externally, of course).

@Trass3r
Copy link
Contributor

Trass3r commented Aug 30, 2014

Yeah I don't see how this relates to my post though.
I'm saying there needs to be a common way across compilers for doing common things like force inlining (in fact I could really use it right now). In C++ you can hide the compiler-specific attributes behind macros but still it's a huge mess.

redstar pushed a commit that referenced this issue Sep 27, 2014
move _moduleXXX functions from dmain2.d to minfo.d
redstar added a commit to redstar/ldc that referenced this issue Nov 12, 2014
Introduces an attribute @ldc.attribute which can be used to annotate functions.
Example:

    @ldc.attribute("alwaysinline") void foo() {}

Valid attribute names can be found in the LLVM manual at http://www.llvm.org/docs/LangRef.html#function-attributes.

This fixes issue ldc-developers#561 and creates a base for issue ldc-developers#547.
redstar added a commit to redstar/ldc that referenced this issue Nov 12, 2014
Introduces an attribute @ldc.attribute which can be used to annotate functions.
Example:

    @ldc.attribute("alwaysinline") void foo() {}

Valid attribute names can be found in the LLVM manual at http://www.llvm.org/docs/LangRef.html#function-attributes.

This fixes issue ldc-developers#561 and creates a base for issue ldc-developers#547.
@JohanEngelen
Copy link
Member

A relevant PR: #1172.

@dnadlinger
Copy link
Member Author

#1577 has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants