[all-commits] [llvm/llvm-project] 6f9cb9: [RISCV][GISEL] Legalize G_VAARG through expansion....

Michael Maitland via All-commits all-commits at lists.llvm.org
Fri Dec 8 10:24:42 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6f9cb9a75ce20db2ee85cd22ddadc3bed2c450c0
      https://github.com/llvm/llvm-project/commit/6f9cb9a75ce20db2ee85cd22ddadc3bed2c450c0
  Author: Michael Maitland <michaeltmaitland at gmail.com>
  Date:   2023-12-08 (Fri, 08 Dec 2023)

  Changed paths:
    M llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h
    M llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
    M llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
    A llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-vaarg-rv32.mir
    A llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-vaarg-rv64.mir

  Log Message:
  -----------
  [RISCV][GISEL] Legalize G_VAARG through expansion. (#73065)

G_VAARG can be expanded similiar to SelectionDAG::expandVAArg through
LegalizerHelper::lower. This patch implements the lowering through this
style of expansion.

The expansion gets the head of the va_list by loading the pointer to
va_list. Then, the head of the list is adjusted depending on argument
alignment information. This gives a pointer to the element to be read
out of the va_list. Next, the head of the va_list is bumped to the next
element in the list. The new head of the list is stored back to the
original pointer to the head of the va_list so that subsequent G_VAARG
instructions get the next element in the list. Lastly, the element is
loaded from the alignment adjusted pointer constructed earlier.

This change is stacked on #73062.




More information about the All-commits mailing list