[PATCH] D46365: AMDGPU: Separate R600 and GCN TableGen files

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 3 09:20:05 PDT 2018


tstellar added inline comments.


================
Comment at: lib/Target/AMDGPU/AMDGPUSubtarget.h:66
+  virtual bool isAmdHsaOS() const = 0;
+  virtual bool isAmdPalOS() const = 0;
+  virtual bool has16BitInsts() const = 0;
----------------
arsenm wrote:
> Is it possible to avoid making these virtual?
I will look through this again and see if I can eliminate some of these virtual functions, but to get rid of all of them we have a few options:

1. We could eliminate the AMDGPUCommonSubtarget super class and then in code shared between r600 and amdgcn (which is mostly IR passes and a few remaining classes like AMDGPUTargetLowering, AMDAsmPrinter, etc) do something like:


```
bool IsAmdHsaOs;
if (Triple.getArch() == Triple::amdgcn)
  IsAmdHsaOS = static_cast<SISubtarget>(Subtarget).isAmdHsaOS()
else
  IsAmdHsaOS = static_cast<R600Subtaget>(Subtarget).isAmdHsaOS();
```

2. Remove subtarget checks from shared classes by refactoring code into r600/gcn specific classes.


Repository:
  rL LLVM

https://reviews.llvm.org/D46365





More information about the llvm-commits mailing list