[PATCH] D109652: [PowerPC] Restrict various P10 options to P10 only.

Lei Huang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 20 11:27:38 PDT 2021


lei added inline comments.


================
Comment at: clang/lib/Basic/Targets/PPC.cpp:566-569
+      if (llvm::find(FeaturesVec, "+pcrel") != FeaturesVec.end()) {
+        Diags.Report(diag::err_opt_not_valid_without_opt) << "-mpcrel"
+                                                          << "-mprefixed";
+      }
----------------
I think this need more thought:
```
$ clang -mcpu=pwr9 -mprefixed -mpcrel test.c -o test
error: option '-mpcrel' cannot be specified without '-mprefixed'
error: option '-mprefixed' cannot be specified without '-mcpu=pwr10'

$ clang -mcpu=pwr9 -mpcrel test.c -o test
error: option '-mpcrel' cannot be specified without '-mprefixed'
```

For this, the first err makes not sense since both `-mprefixed` and `-mpcrel` is specified:
```
$ clang -mcpu=pwr9 -mprefixed -mpcrel test.c -o test
error: option '-mpcrel' cannot be specified without '-mprefixed'
error: option '-mprefixed' cannot be specified without '-mcpu=pwr10'
```
Shouldn't it just give:
```
$ clang -mcpu=pwr9 -mprefixed -mpcrel test.c -o test
error: option '-mpcrel' cannot be specified without '-mcpu=pwr10 -mprefixed'
```


For this:
```
$ clang -mcpu=pwr9 -mpcrel test.c -o test
error: option '-mpcrel' cannot be specified without '-mprefixed'
```
I think it's better if it says:
```
$ clang -mcpu=pwr9 -mpcrel test.c -o test
error: option '-mpcrel' cannot be specified without '-mcpu=pwr10 -mprefixed'
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109652



More information about the cfe-commits mailing list