[all-commits] [llvm/llvm-project] c2d44b: [X86] Lower calls with clang.arc.attachedcall bundle

Florian Hahn via All-commits all-commits at lists.llvm.org
Fri May 21 08:34:32 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c2d44bd2309c1e232d900fd6979aba320c913357
      https://github.com/llvm/llvm-project/commit/c2d44bd2309c1e232d900fd6979aba320c913357
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2021-05-21 (Fri, 21 May 2021)

  Changed paths:
    M llvm/lib/Target/X86/X86ExpandPseudo.cpp
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/lib/Target/X86/X86ISelLowering.h
    M llvm/lib/Target/X86/X86InstrCompiler.td
    M llvm/lib/Target/X86/X86InstrControl.td
    M llvm/lib/Target/X86/X86InstrInfo.td
    M llvm/test/CodeGen/X86/call-rv-marker.ll
    A llvm/test/CodeGen/X86/expand-call-rvmarker.mir

  Log Message:
  -----------
  [X86] Lower calls with clang.arc.attachedcall bundle

This patch adds support for lowering function calls with the
`clang.arc.attachedcall` bundle. The goal is to expand such calls to the
following sequence of instructions:

    callq   @fn
    movq  %rax, %rdi
    callq   _objc_retainAutoreleasedReturnValue / _objc_unsafeClaimAutoreleasedReturnValue

This sequence of instructions triggers Objective-C runtime optimizations,
hence we want to ensure no instructions get moved in between them.
This patch achieves that by adding a new CALL_RVMARKER ISD node,
which gets turned into the CALL64_RVMARKER pseudo, which eventually gets
expanded into the sequence mentioned above.

The ObjC runtime function to call is determined by the
argument in the bundle, which is passed through as a
target constant to the pseudo.

@ahatanak is working on using this attribute in the front- & middle-end.

Together with the front- & middle-end changes, this should address
PR31925 for X86.

This is the X86 version of 46bc40e50246c1902a1ca7916c8286cb837643ee,
which added similar support for AArch64.

Reviewed By: ab

Differential Revision: https://reviews.llvm.org/D94597




More information about the All-commits mailing list