[clang] [Clang][AArch64]Refactor typespec handling in SveEmitter.cpp (PR #117717)

Sander de Smalen via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 27 02:08:01 PST 2024


================
@@ -424,72 +432,87 @@ const std::array<SVEEmitter::ReinterpretTypeInfo, 12> SVEEmitter::Reinterprets =
 //===----------------------------------------------------------------------===//
 
 std::string SVEType::builtin_str() const {
-  std::string S;
-  if (isVoid())
-    return "v";
+  std::string OutStr;
 
   if (isScalarPredicate())
     return "b";
 
   if (isSvcount())
     return "Qa";
 
-  if (isVoidPointer())
-    S += "v";
-  else if (!isFloatingPoint())
-    switch (ElementBitwidth) {
-    case 1: S += "b"; break;
-    case 8: S += "c"; break;
-    case 16: S += "s"; break;
-    case 32: S += "i"; break;
-    case 64: S += "Wi"; break;
-    case 128: S += "LLLi"; break;
-    default: llvm_unreachable("Unhandled case!");
-    }
-  else if (isFloat())
+  if (isVoid()) {
----------------
sdesmalen-arm wrote:

Could you change this `if-else if-else if...else` into a switch statement, preferably without a `default` statement (so that it is clear what types the `else` case applies to, see my question below)

https://github.com/llvm/llvm-project/pull/117717


More information about the cfe-commits mailing list