[llvm] [AIX] Support per global code model. (PR #79202)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 24 09:58:15 PST 2024
================
@@ -466,6 +466,63 @@ static void collectTOCStats(PPCAsmPrinter::TOCEntryType Type) {
}
}
+static CodeModel::Model getCodeModel(const PPCSubtarget &S,
+ const TargetMachine &TM,
+ const MachineOperand &MO) {
+ assert(S.isAIXABI() && "ELF per global code model not supported yet");
+
+ CodeModel::Model ModuleModel = TM.getCodeModel();
+
----------------
diggerlin wrote:
since the function are mostly used as
```
const CodeModel::Model CM =
IsAIX ? getCodeModel(*Subtarget, TM, MO) : TM.getCodeModel();
```
or
```
if (IsAIX) {
assert(
getCodeModel(*Subtarget, TM, MO) == CodeModel::Small &&
"This pseudo should only be selected for 32-bit small code model.");
```
I would change code to
```
assert(S.isAIXABI() && "ELF per global code model not supported yet");
CodeModel::Model ModuleModel = TM.getCodeModel();
```
to
```
CodeModel::Model ModuleModel = TM.getCodeModel();
if(!S.isAIXABI())
return ModuleModel;
```
https://github.com/llvm/llvm-project/pull/79202
More information about the llvm-commits
mailing list