[llvm] [PowerPC][AIX] Emit PowerPC version for XCOFF (PR #95510)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 25 23:16:32 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();
----------------
EsmeYi wrote:
> Yeah, "target-cpu" is something we ideally should be handling here, but I think there are some he tricky parts to this. "target-cpu" is a function level attribute and we are emitting a module level attribute. To do this right, we'd need to know the newest level we saw in the whole module (there definitely could be a mix, for example if we got LTO involved).
Thanks, currently I walk through the "target-cpu" attribute in all functions, map these values to `CFileCpuId` enum defined in header and set the newest level as the final target CPU level.
> Then it's also possible that we have no "target-cpu" attr (since I don't believe frontends are required to emit it) and and TM.getTargetCPU().empty().
For this case, I use `any` as default value, which is for consistency with system `as` on AIX.
https://github.com/llvm/llvm-project/pull/95510
More information about the llvm-commits
mailing list