[llvm] [PowerPC][AIX] Emit PowerPC version for XCOFF (PR #113214)
Amy Kwan via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 7 14:00:50 PST 2024
================
@@ -3046,6 +3047,30 @@ void PPCAIXAsmPrinter::emitEndOfAsmFile(Module &M) {
bool PPCAIXAsmPrinter::doInitialization(Module &M) {
const bool Result = PPCAsmPrinter::doInitialization(M);
+ // Emit the .machine directive on AIX.
+ const Triple &Target = TM.getTargetTriple();
+ XCOFF::CFileCpuId TargetCpuId = XCOFF::TCPU_INVALID;
+ // Walk through the "target-cpu" attribute of functions and use the newest
+ // level as the CPU of the module.
+ for (auto &F : M) {
+ XCOFF::CFileCpuId FunCpuId =
+ XCOFF::getCpuID(TM.getSubtargetImpl(F)->getCPU());
+ if (FunCpuId > TargetCpuId)
+ TargetCpuId = FunCpuId;
----------------
amy-kwan wrote:
@diggerlin Does https://github.com/llvm/llvm-project/pull/113214/files#diff-2e809a9d9830c21bfba3193739b08c17aad49154bc669f409c1c543837414dfb sufficiently address your comment?
https://github.com/llvm/llvm-project/pull/113214
More information about the llvm-commits
mailing list