[all-commits] [llvm/llvm-project] d2a35e: [AIX] Handling the label alignment of a global

Esme via All-commits all-commits at lists.llvm.org
Sun Jul 3 20:18:36 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d2a35e4d39fec0c328f9bb05ad3ea7134751a64e
      https://github.com/llvm/llvm-project/commit/d2a35e4d39fec0c328f9bb05ad3ea7134751a64e
  Author: esmeyi <esme.yi at ibm.com>
  Date:   2022-07-03 (Sun, 03 Jul 2022)

  Changed paths:
    M llvm/include/llvm/CodeGen/AsmPrinter.h
    M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    M llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
    A llvm/test/CodeGen/PowerPC/aix-alias-alignment-2.ll
    A llvm/test/CodeGen/PowerPC/aix-alias-alignment.ll
    M llvm/test/CodeGen/PowerPC/aix-alias.ll

  Log Message:
  -----------
  [AIX] Handling the label alignment of a global
variable with its multiple aliases.

This patch handles the case where a variable has
multiple aliases.
AIX's assembly directive .set is not usable for the
aliasing purpose, and using different labels allows
AIX to emulate symbol aliases. If a value is emitted
between any two labels, meaning they are not aligned,
XCOFF will automatically calculate the offset for them.

This patch implements:
1) Emits the label of the alias just before emitting
the value of the sub-element that the alias referred to.
2) A set of aliases that refers to the same offset
should be aligned.
3) We didn't emit aliasing labels for common and
zero-initialized local symbols in
PPCAIXAsmPrinter::emitGlobalVariableHelper, but
emitted linkage for them in
AsmPrinter::emitGlobalAlias, which caused a FAILURE.
This patch fixes the bug by blocking emitting linkage
for the alias without a label.

Reviewed By: shchenz

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




More information about the All-commits mailing list