[TableGen] Fix indentation. NFC
authorMichael Liao <michael.hliao@gmail.com>
Mon, 5 Jun 2023 16:19:58 +0000 (12:19 -0400)
committerMichael Liao <michael.hliao@gmail.com>
Mon, 5 Jun 2023 16:22:00 +0000 (12:22 -0400)
llvm/lib/TableGen/Record.cpp

index eb7a213..ac25de1 100644 (file)
@@ -1026,89 +1026,90 @@ Init *BinOpInit::getListConcat(TypedInit *LHS, Init *RHS) {
   assert(isa<ListRecTy>(LHS->getType()) && "First arg must be a list");
 
   // Shortcut for the common case of concatenating two lists.
-   if (const ListInit *LHSList = dyn_cast<ListInit>(LHS))
-     if (const ListInit *RHSList = dyn_cast<ListInit>(RHS))
-       return ConcatListInits(LHSList, RHSList);
-   return BinOpInit::get(BinOpInit::LISTCONCAT, LHS, RHS, LHS->getType());
-}
-
-std::optional<bool> BinOpInit::CompareInit(unsigned Opc, Init *LHS, Init *RHS) const {
-   // First see if we have two bit, bits, or int.
-   IntInit *LHSi = dyn_cast_or_null<IntInit>(
-       LHS->convertInitializerTo(IntRecTy::get(getRecordKeeper())));
-   IntInit *RHSi = dyn_cast_or_null<IntInit>(
-       RHS->convertInitializerTo(IntRecTy::get(getRecordKeeper())));
-
-   if (LHSi && RHSi) {
-     bool Result;
-     switch (Opc) {
-     case EQ:
-       Result = LHSi->getValue() == RHSi->getValue();
-       break;
-     case NE:
-       Result = LHSi->getValue() != RHSi->getValue();
-       break;
-     case LE:
-       Result = LHSi->getValue() <= RHSi->getValue();
-       break;
-     case LT:
-       Result = LHSi->getValue() < RHSi->getValue();
-       break;
-     case GE:
-       Result = LHSi->getValue() >= RHSi->getValue();
-       break;
-     case GT:
-       Result = LHSi->getValue() > RHSi->getValue();
-       break;
-     default:
-       llvm_unreachable("unhandled comparison");
-     }
-     return Result;
-   }
-
-   // Next try strings.
-   StringInit *LHSs = dyn_cast<StringInit>(LHS);
-   StringInit *RHSs = dyn_cast<StringInit>(RHS);
-
-   if (LHSs && RHSs) {
-     bool Result;
-     switch (Opc) {
-     case EQ:
-       Result = LHSs->getValue() == RHSs->getValue();
-       break;
-     case NE:
-       Result = LHSs->getValue() != RHSs->getValue();
-       break;
-     case LE:
-       Result = LHSs->getValue() <= RHSs->getValue();
-       break;
-     case LT:
-       Result = LHSs->getValue() < RHSs->getValue();
-       break;
-     case GE:
-       Result = LHSs->getValue() >= RHSs->getValue();
-       break;
-     case GT:
-       Result = LHSs->getValue() > RHSs->getValue();
-       break;
-     default:
-       llvm_unreachable("unhandled comparison");
-     }
-     return Result;
-   }
-
-   // Finally, !eq and !ne can be used with records.
-   if (Opc == EQ || Opc == NE) {
-     DefInit *LHSd = dyn_cast<DefInit>(LHS);
-     DefInit *RHSd = dyn_cast<DefInit>(RHS);
-     if (LHSd && RHSd)
-       return (Opc == EQ) ? LHSd == RHSd : LHSd != RHSd;
-   }
-
-   return std::nullopt;
-}
-
- Init *BinOpInit::Fold(Record *CurRec) const {
+  if (const ListInit *LHSList = dyn_cast<ListInit>(LHS))
+    if (const ListInit *RHSList = dyn_cast<ListInit>(RHS))
+      return ConcatListInits(LHSList, RHSList);
+  return BinOpInit::get(BinOpInit::LISTCONCAT, LHS, RHS, LHS->getType());
+}
+
+std::optional<bool> BinOpInit::CompareInit(unsigned Opc, Init *LHS,
+                                           Init *RHS) const {
+  // First see if we have two bit, bits, or int.
+  IntInit *LHSi = dyn_cast_or_null<IntInit>(
+      LHS->convertInitializerTo(IntRecTy::get(getRecordKeeper())));
+  IntInit *RHSi = dyn_cast_or_null<IntInit>(
+      RHS->convertInitializerTo(IntRecTy::get(getRecordKeeper())));
+
+  if (LHSi && RHSi) {
+    bool Result;
+    switch (Opc) {
+    case EQ:
+      Result = LHSi->getValue() == RHSi->getValue();
+      break;
+    case NE:
+      Result = LHSi->getValue() != RHSi->getValue();
+      break;
+    case LE:
+      Result = LHSi->getValue() <= RHSi->getValue();
+      break;
+    case LT:
+      Result = LHSi->getValue() < RHSi->getValue();
+      break;
+    case GE:
+      Result = LHSi->getValue() >= RHSi->getValue();
+      break;
+    case GT:
+      Result = LHSi->getValue() > RHSi->getValue();
+      break;
+    default:
+      llvm_unreachable("unhandled comparison");
+    }
+    return Result;
+  }
+
+  // Next try strings.
+  StringInit *LHSs = dyn_cast<StringInit>(LHS);
+  StringInit *RHSs = dyn_cast<StringInit>(RHS);
+
+  if (LHSs && RHSs) {
+    bool Result;
+    switch (Opc) {
+    case EQ:
+      Result = LHSs->getValue() == RHSs->getValue();
+      break;
+    case NE:
+      Result = LHSs->getValue() != RHSs->getValue();
+      break;
+    case LE:
+      Result = LHSs->getValue() <= RHSs->getValue();
+      break;
+    case LT:
+      Result = LHSs->getValue() < RHSs->getValue();
+      break;
+    case GE:
+      Result = LHSs->getValue() >= RHSs->getValue();
+      break;
+    case GT:
+      Result = LHSs->getValue() > RHSs->getValue();
+      break;
+    default:
+      llvm_unreachable("unhandled comparison");
+    }
+    return Result;
+  }
+
+  // Finally, !eq and !ne can be used with records.
+  if (Opc == EQ || Opc == NE) {
+    DefInit *LHSd = dyn_cast<DefInit>(LHS);
+    DefInit *RHSd = dyn_cast<DefInit>(RHS);
+    if (LHSd && RHSd)
+      return (Opc == EQ) ? LHSd == RHSd : LHSd != RHSd;
+  }
+
+  return std::nullopt;
+}
+
+Init *BinOpInit::Fold(Record *CurRec) const {
   switch (getOpcode()) {
   case CONCAT: {
     DagInit *LHSs = dyn_cast<DagInit>(LHS);