[all-commits] [llvm/llvm-project] c166a4: New calling convention preserve_none (#76868)

weiguozhi via All-commits all-commits at lists.llvm.org
Mon Feb 5 13:28:55 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c166a43c6e6157b1309ea757324cc0a71c078e66
      https://github.com/llvm/llvm-project/commit/c166a43c6e6157b1309ea757324cc0a71c078e66
  Author: weiguozhi <57237827+weiguozhi at users.noreply.github.com>
  Date:   2024-02-05 (Mon, 05 Feb 2024)

  Changed paths:
    M clang/include/clang-c/Index.h
    M clang/include/clang/Basic/Attr.td
    M clang/include/clang/Basic/AttrDocs.td
    M clang/include/clang/Basic/Specifiers.h
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/lib/AST/Type.cpp
    M clang/lib/AST/TypePrinter.cpp
    M clang/lib/Basic/Targets/X86.h
    M clang/lib/CodeGen/CGCall.cpp
    M clang/lib/CodeGen/CGDebugInfo.cpp
    M clang/lib/Sema/SemaDeclAttr.cpp
    M clang/lib/Sema/SemaType.cpp
    M clang/test/CodeGen/debug-info-cc.c
    M clang/test/CodeGen/preserve-call-conv.c
    M clang/test/Misc/pragma-attribute-supported-attributes-list.test
    M clang/test/Sema/no_callconv.cpp
    A clang/test/Sema/preserve-none-call-conv.c
    M clang/tools/libclang/CXType.cpp
    M llvm/docs/LangRef.rst
    M llvm/include/llvm/AsmParser/LLToken.h
    M llvm/include/llvm/BinaryFormat/Dwarf.def
    M llvm/include/llvm/IR/CallingConv.h
    M llvm/lib/AsmParser/LLLexer.cpp
    M llvm/lib/AsmParser/LLParser.cpp
    M llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp
    M llvm/lib/IR/AsmWriter.cpp
    M llvm/lib/Target/X86/X86CallingConv.td
    M llvm/lib/Target/X86/X86ISelLoweringCall.cpp
    M llvm/lib/Target/X86/X86RegisterInfo.cpp
    M llvm/test/Bitcode/compatibility.ll
    A llvm/test/CodeGen/X86/dynamic-regmask-preserve-none.ll
    M llvm/test/CodeGen/X86/ipra-reg-usage.ll
    M llvm/test/CodeGen/X86/ipra-transform.ll
    A llvm/test/CodeGen/X86/preserve_none_swift.ll
    A llvm/test/CodeGen/X86/preserve_nonecc64-ret-double.ll
    A llvm/test/CodeGen/X86/preserve_nonecc64.ll
    A llvm/test/CodeGen/X86/preserve_nonecc_call.ll
    A llvm/test/CodeGen/X86/preserve_nonecc_musttail.ll

  Log Message:
  -----------
  New calling convention preserve_none (#76868)

The new experimental calling convention preserve_none is the opposite
side of existing preserve_all. It tries to preserve as few general
registers as possible. So all general registers are caller saved
registers. It can also uses more general registers to pass arguments.
This attribute doesn't impact floating-point registers. Floating-point
registers still follow the c calling convention.

Currently preserve_none is supported on X86-64 only. It changes the c
calling convention in following fields:
  
* RSP and RBP are the only preserved general registers, all other
general registers are caller saved registers.
* We can use [RDI, RSI, RDX, RCX, R8, R9, R11, R12, R13, R14, R15, RAX]
to pass arguments.

It can improve the performance of hot tailcall chain, because many
callee saved registers' save/restore instructions can be removed if the
tail functions are using preserve_none. In my experiment in protocol
buffer, the parsing functions are improved by 3% to 10%.




More information about the All-commits mailing list