[llvm] [PowerPC][AIX] Emit PowerPC version for XCOFF. (PR #95510)
David Tenty via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 14 09:13:04 PDT 2024
================
@@ -517,6 +517,11 @@ bool AsmPrinter::doInitialization(Module &M) {
// On AIX, emit bytes for llvm.commandline metadata after .file so that the
// C_INFO symbol is preserved if any csect is kept by the linker.
if (TM.getTargetTriple().isOSBinFormatXCOFF()) {
+ // Emit .machine directive on AIX.
+ StringRef TargetCPU =
+ TM.getTargetCPU().empty() ? "pwr7" : TM.getTargetCPU();
----------------
daltenty wrote:
I don't really like the hardcode of `pwr7` here, this is actually dependent on the AIX OS level, and is likely to change in the future. So it would be nice if we could determine this according to the triple's OS version fields (not sure if this belongs as a member function of the triple or elsewhere, open to opinions on that)
(We have some code in clang that also determines the default cpu for AIX, for which I'd like to do the same, so this logic doesn't have to be repeated across the codebase and various frontends)
https://github.com/llvm/llvm-project/pull/95510
More information about the llvm-commits
mailing list