[PATCH] Add function attribute 'optnone'

Andrea Di Biagio Andrea_DiBiagio at sn.scee.net
Mon Aug 5 10:16:42 PDT 2013


andreadb added you to the CC list for the revision "Add function attribute 'optnone'".

Hi all,

here is the first of a sequence of patches that implements a new function attributed called 'optnone'.
Attribute optnone has been discussed here: http://llvm.1065342.n5.nabble.com/RFC-add-Function-Attribute-to-disable-optimization-td58549.html

Function attribute 'optnone' indicates that the function is not optimized by optimization or code generation passes with the exception of interprocedural optimization passes. This attribute cannot be used together with the 'alwaysinline' attribute; also it is incompatible with both 'minsize' and 'optsize'.
The inliner is not allowed to inline functions marked as 'optnone' in any situation. 'alwaysinline' functions are the only valid candidates for inlining inside the body of 'optnone' functions.

This patch defines the optnone function attribute.
I added rules to check that optnone is never used along with 'alwaysinline' or 'optsize' or 'minsize'.
I added a test under Features to verify that we correctly assemble/disassemble 'optnone'; this also required a small change in the bitcode reader/writer.
This patch also updates LangRef.rst with a short description of the new attribute.

A patch will follow that implements the required changes to the optimizer.
The last patch of the sequence will add support for the attribute to clang.

Please let me know what you think. Any feedback would be appreciated.

Thanks,
Andrea Di Biagio
SN Systems - Sony Computer Entertainment Group

http://llvm-reviews.chandlerc.com/D1288

Files:
  test/Feature/optnone.ll
  test/Bitcode/attributes.ll
  include/llvm/Bitcode/LLVMBitCodes.h
  include/llvm/IR/Attributes.h
  include/llvm-c/Core.h
  docs/LangRef.rst
  utils/kate/llvm.xml
  utils/vim/llvm.vim
  lib/Target/CppBackend/CPPBackend.cpp
  lib/AsmParser/LLParser.cpp
  lib/AsmParser/LLLexer.cpp
  lib/AsmParser/LLToken.h
  lib/Bitcode/Reader/BitcodeReader.cpp
  lib/Bitcode/Writer/BitcodeWriter.cpp
  lib/IR/Verifier.cpp
  lib/IR/Attributes.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1288.1.patch
Type: text/x-patch
Size: 10794 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130805/d71712a8/attachment.bin>


More information about the llvm-commits mailing list