[all-commits] [llvm/llvm-project] 9eac81: [X86] Fix variadic argument handling for x32

Harald van Dijk via All-commits all-commits at lists.llvm.org
Mon Dec 14 15:47:55 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9eac818370fe4b50a167627593bfe53e61c216bc
      https://github.com/llvm/llvm-project/commit/9eac818370fe4b50a167627593bfe53e61c216bc
  Author: Harald van Dijk <harald at gigawatt.nl>
  Date:   2020-12-14 (Mon, 14 Dec 2020)

  Changed paths:
    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/X86InstrInfo.td
    M llvm/test/CodeGen/X86/x86-64-varargs.ll

  Log Message:
  -----------
  [X86] Fix variadic argument handling for x32

The X86-64 ABI defines va_list as

  typedef struct {
    unsigned int gp_offset;
    unsigned int fp_offset;
    void *overflow_arg_area;
    void *reg_save_area;
  } va_list[1];

This means the size, alignment, and reg_save_area offset will depend on
whether we are in LP64 or in ILP32 mode, so this commit adds the checks.
Additionally, the VAARG_64 pseudo-instruction assumed 64-bit pointers, so
this commit adds a VAARG_X32 pseudo-instruction that behaves just like
VAARG_64, except for assuming 32-bit pointers.

Some of these changes were originally done by
Michael Liao <michael.hliao at gmail.com>.

Fixes https://bugs.llvm.org/show_bug.cgi?id=48428.

Reviewed By: RKSimon

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




More information about the All-commits mailing list