[PATCH] D71144: Not emit correct Assembly for Global Function pointer initiated with function.

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 15:53:33 PST 2019


hubert.reinterpretcast added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1761
+const MCExpr *PPCAIXAsmPrinter::lowerConstant(const Constant *CV) {
+  if (const GlobalObject *GO = dyn_cast<GlobalObject>(CV)) {
+    if (isa<Function>(GO)) {
----------------
Shouldn't this just be:
```
if (const Function *F = dyn_cast<Function>(CV)) {
```
?


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1778
+  }
+  return AsmPrinter::lowerConstant(CV);
+}
----------------
I suggest to name the direct base class:
```
  return PPCAsmPrinter ::lowerConstant(CV);
```



================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1779
+  return AsmPrinter::lowerConstant(CV);
+}
 void PPCAIXAsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
----------------
Empty line between function bodies please.


================
Comment at: llvm/test/CodeGen/PowerPC/aix-xcoff-FuntionDS.ll:1
+; RUN: llc -mtriple powerpc-ibm-aix-xcoff < %s | FileCheck %s
+
----------------
Xiangling_L wrote:
> To generate assembly from IR, please add `-verify-machineinstrs` and cpu level `-mcpu=pwr7`.
Why `pwr7`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71144





More information about the llvm-commits mailing list