[PATCH] D91272: [AIX] Support init priority

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 07:54:38 PST 2020


sfertile added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:2003
+  //
+  // The conversion strategies are: For [0-100] reserved and [101-65535]
+  // non-reserved Clang/GNU values, we use linear interpolation to map Clang to
----------------
The comment and table do a good job explains the mapping you want to do, but could we condense it without loosing too much if we reworded it? Something along the lines of:

```
We map the reserved clang/gnu priority range [0-100] into the sterm/sinit reserved priority range [0,1023] by 
- directly mapping the first 20 elements of the ranges
- directly mapping the last 20 elements of the ranges
- linear interpolating the intermediate values with a step size of 16.

We map the non reserved clang/gnu priority range of [101, 65535] into the sterm/sinit priority range [1024,2147483648] by:
- directly mapping the first 1023 elements of the ranges
- directly mapping the last 1023 elements of the ranges.
- linear interpolating the intermediate values with a step size of 33878.
```


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:2037
+  unsigned int P = Priority;
+  if (P > 20 && P < 81) {
+    P = 20 + (P - 20) * 16;
----------------
Suggestion: Having the actual mapping done in a separate helper cleans up the initialization:

```
unsigned MapedPriority = mapPriorityToSinit(Priority);
```



================
Comment at: llvm/test/CodeGen/PowerPC/aix-static-init-non-default-priority.ll:1
-; RUN: not --crash llc -mtriple powerpc-ibm-aix-xcoff < %s 2>&1 | FileCheck %s
-; RUN: not --crash llc -mtriple powerpc64-ibm-aix-xcoff < %s 2>&1 | FileCheck %s
+; RUN: llc -mtriple powerpc-ibm-aix-xcoff < %s | FileCheck %s
+; RUN: llc -mtriple powerpc64-ibm-aix-xcoff < %s | FileCheck %s
----------------
missing `-verify-machineinstrs`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91272/new/

https://reviews.llvm.org/D91272



More information about the llvm-commits mailing list