This is an archive of the discontinued LLVM Phabricator instance.

[AIX] Add a TargetLoweringObjectFile for XCOFF and add support for common variables.
ClosedPublic

Authored by sfertile on Jul 12 2019, 11:22 AM.

Details

Summary

Stubs out a TargetLoweringObjectFileXCOFF class, implementing only SelectSectionForGlobal for common symbols. Also adds an override of EmitGlobalVariable in PPCAIXAsmPrinter which adds a number of defensive errors and adds support for emitting common globals.

Diff Detail

Event Timeline

sfertile created this revision.Jul 12 2019, 11:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2019, 11:22 AM
This revision is now accepted and ready to land.Jul 15 2019, 10:12 AM
llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
223

Please place these in order:
Initialize
shouldPutJumpTableInFunctionSection
getExplicitSectionGlobal
getStaticCtorSection
getStaticDtorSection
lowerRelativeReference
SelectSectionForGlobal

llvm/include/llvm/MC/MCSectionXCOFF.h
26

The common should indicate its scope as applying only to the current state of the implementation in LLVM (and not as a general statement on XCOFF).

43

Suggestion: Invalid or unhandled type for csect.

llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
1819

report_fatal_error.

1841

report_fatal_error.

1854

report_fatal_error.

1859

report_fatal_error.

1865

report_fatal_error.

llvm/lib/MC/MCSectionXCOFF.cpp
23

Is the ".text" here meant to be the XCOFF section name? If so, then the comment on line 33 could say ".bss" instead of "common" to be consistent.

llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
1659

This is true for the OS and not just LLVM: s/on/by/.

1663

Add "for now".

1666

Use cast unless if we are expecting the cast to possibly fail and passing NULL to SwitchSection is okay.

1671

See comment above.

1672

llvm::DataLayout has a non-trivial destructor. I advise against copying.

llvm/test/CodeGen/PowerPC/aix-xcoff-common.ll
9

What is the intended difference between "d" and "comm"?

@hubert.reinterpretcast I've committed a patch that addresses your comments: https://reviews.llvm.org/rL367324.