[llvm] [AIX] Support per global code model. (PR #79202)

zhijian lin via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 17:14:29 PST 2024


================
@@ -702,8 +760,12 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
 static MCSymbol *getMCSymbolForTOCPseudoMO(const MachineOperand &MO,
                                            AsmPrinter &AP) {
   switch (MO.getType()) {
-  case MachineOperand::MO_GlobalAddress:
-    return AP.getSymbol(MO.getGlobal());
+  case MachineOperand::MO_GlobalAddress: {
+    const GlobalValue *GV = MO.getGlobal();
+    MCSymbol *Sym = AP.getSymbol(GV);
+    checkPerGlobalCodeModel(GV, Sym);
----------------
diggerlin wrote:

I am not sure whether it is a good place to checkPerGlobalCodeModel in the getMCSymbolForTOCPseudoMO , This means that an MCSymbolXCOFF may end up setting PerSymbolCodeModel several times, depending on how many times the GV is used as an operand 

how about to do it in
```
 bool PPCAIXAsmPrinter::doInitiation() {
 .....
  for (const auto &G : M.globals())
      MCSymbol *Sym = AP.getSymbol(G);
      checkPerGlobalCodeModel(GV, Sm)
    }
```
    
    ?

https://github.com/llvm/llvm-project/pull/79202


More information about the llvm-commits mailing list