================
@@ -969,10 +1004,25 @@ void CallConvLoweringPass::runOnOperation() {
   static constexpr unsigned numAvxLevels =
       static_cast<unsigned>(llvm::abi::X86AVXABILevel::Last) + 1;
   bool isX86 = target == cir::CallConvTarget::X86_64;
-  std::optional<mlir::abi::ABITypeMapper> x86TypeMapper;
+  bool isAMDGPU = target == cir::CallConvTarget::AMDGPU;
+  // The x86_64 and AMDGPU drivers classify with the LLVM ABI library and share
+  // the type mapper; the test and classification-attr drivers do neither.
+  bool useAbiClassifier = isX86 || isAMDGPU;
+  std::optional<mlir::abi::ABITypeMapper> abiTypeMapper;
   std::array<std::unique_ptr<llvm::abi::TargetInfo>, numAvxLevels> x86Targets;
-  if (isX86)
-    x86TypeMapper.emplace(dl);
+  std::unique_ptr<llvm::abi::TargetInfo> amdgpuTarget;
+  if (useAbiClassifier)
+    abiTypeMapper.emplace(dl);
+  if (isAMDGPU) {
----------------
skc7 wrote:

Done. `targetInfoFor` now switches on the target.

https://github.com/llvm/llvm-project/pull/220197
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to