[llvm] [TableGen] Use getSizeInBits (PR #75157)

Wang Pengcheng via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 02:03:16 PST 2023


https://github.com/wangpc-pp created https://github.com/llvm/llvm-project/pull/75157

We know the type is scalar type.


>From a930106b3dfc36361c607e3152e56f131d843fc5 Mon Sep 17 00:00:00 2001
From: wangpc <wangpengcheng.pp at bytedance.com>
Date: Tue, 12 Dec 2023 18:02:20 +0800
Subject: [PATCH] [TableGen] Use getSizeInBits

We know the type is scalar type.
---
 llvm/utils/TableGen/DAGISelMatcherEmitter.cpp | 38 +++++++++----------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
index 5f96f11279f24..94799267e8960 100644
--- a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
@@ -587,7 +587,7 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx,
     return CurrentIdx - StartIdx + 1;
   }
 
- case Matcher::CheckType:
+  case Matcher::CheckType:
     if (cast<CheckTypeMatcher>(N)->getResNo() == 0) {
       MVT::SimpleValueType VT = cast<CheckTypeMatcher>(N)->getType();
       switch (VT) {
@@ -600,24 +600,24 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx,
         return 2;
       }
     }
-    OS << "OPC_CheckTypeRes, " << cast<CheckTypeMatcher>(N)->getResNo()
-       << ", " << getEnumName(cast<CheckTypeMatcher>(N)->getType()) << ",\n";
+    OS << "OPC_CheckTypeRes, " << cast<CheckTypeMatcher>(N)->getResNo() << ", "
+       << getEnumName(cast<CheckTypeMatcher>(N)->getType()) << ",\n";
     return 3;
 
- case Matcher::CheckChildType: {
-   MVT::SimpleValueType VT = cast<CheckChildTypeMatcher>(N)->getType();
-   switch (VT) {
-   case MVT::i32:
-   case MVT::i64:
-     OS << "OPC_CheckChild" << cast<CheckChildTypeMatcher>(N)->getChildNo()
-        << "TypeI" << MVT(VT).getScalarSizeInBits() << ",\n";
-     return 1;
-   default:
-     OS << "OPC_CheckChild" << cast<CheckChildTypeMatcher>(N)->getChildNo()
-        << "Type, " << getEnumName(VT) << ",\n";
-     return 2;
-   }
- }
+  case Matcher::CheckChildType: {
+    MVT::SimpleValueType VT = cast<CheckChildTypeMatcher>(N)->getType();
+    switch (VT) {
+    case MVT::i32:
+    case MVT::i64:
+      OS << "OPC_CheckChild" << cast<CheckChildTypeMatcher>(N)->getChildNo()
+         << "TypeI" << MVT(VT).getSizeInBits() << ",\n";
+      return 1;
+    default:
+      OS << "OPC_CheckChild" << cast<CheckChildTypeMatcher>(N)->getChildNo()
+         << "Type, " << getEnumName(VT) << ",\n";
+      return 2;
+    }
+  }
 
   case Matcher::CheckInteger: {
     OS << "OPC_CheckInteger, ";
@@ -704,7 +704,7 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx,
     case MVT::i32:
     case MVT::i64:
       OpBytes = 1;
-      OS << "OPC_EmitInteger" << MVT(VT).getScalarSizeInBits() << ", ";
+      OS << "OPC_EmitInteger" << MVT(VT).getSizeInBits() << ", ";
       break;
     default:
       OpBytes = 2;
@@ -723,7 +723,7 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx,
     switch (VT) {
     case MVT::i32:
       OpBytes = 1;
-      OS << "OPC_EmitStringInteger" << MVT(VT).getScalarSizeInBits() << ", ";
+      OS << "OPC_EmitStringInteger" << MVT(VT).getSizeInBits() << ", ";
       break;
     default:
       OpBytes = 2;



More information about the llvm-commits mailing list