[llvm] 9f72e3f - [Lanai] Fix MC CodeGen layering, NFC

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 30 16:18:11 PDT 2023


Author: Reid Kleckner
Date: 2023-08-30T16:17:31-07:00
New Revision: 9f72e3f70fc30ecf9d53c54dcda6340d623c1937

URL: https://github.com/llvm/llvm-project/commit/9f72e3f70fc30ecf9d53c54dcda6340d623c1937
DIFF: https://github.com/llvm/llvm-project/commit/9f72e3f70fc30ecf9d53c54dcda6340d623c1937.diff

LOG: [Lanai] Fix MC CodeGen layering, NFC

See issue #64166 for more information about the layering issue.

Added: 
    

Modified: 
    llvm/lib/Target/Lanai/LanaiAluCode.h
    llvm/lib/Target/Lanai/LanaiISelDAGToDAG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Lanai/LanaiAluCode.h b/llvm/lib/Target/Lanai/LanaiAluCode.h
index 69be0554272319..0494dda459bd50 100644
--- a/llvm/lib/Target/Lanai/LanaiAluCode.h
+++ b/llvm/lib/Target/Lanai/LanaiAluCode.h
@@ -14,7 +14,6 @@
 #define LLVM_LIB_TARGET_LANAI_LANAIALUCODE_H
 
 #include "llvm/ADT/StringSwitch.h"
-#include "llvm/CodeGen/ISDOpcodes.h"
 #include "llvm/Support/ErrorHandling.h"
 
 namespace llvm {
@@ -114,33 +113,6 @@ inline static AluCode stringToLanaiAluCode(StringRef S) {
       .Case("sha", SRA)
       .Default(UNKNOWN);
 }
-
-inline static AluCode isdToLanaiAluCode(ISD::NodeType Node_type) {
-  switch (Node_type) {
-  case ISD::ADD:
-    return AluCode::ADD;
-  case ISD::ADDE:
-    return AluCode::ADDC;
-  case ISD::SUB:
-    return AluCode::SUB;
-  case ISD::SUBE:
-    return AluCode::SUBB;
-  case ISD::AND:
-    return AluCode::AND;
-  case ISD::OR:
-    return AluCode::OR;
-  case ISD::XOR:
-    return AluCode::XOR;
-  case ISD::SHL:
-    return AluCode::SHL;
-  case ISD::SRL:
-    return AluCode::SRL;
-  case ISD::SRA:
-    return AluCode::SRA;
-  default:
-    return AluCode::UNKNOWN;
-  }
-}
 } // namespace LPAC
 } // namespace llvm
 

diff  --git a/llvm/lib/Target/Lanai/LanaiISelDAGToDAG.cpp b/llvm/lib/Target/Lanai/LanaiISelDAGToDAG.cpp
index b1ecebe24b1807..e0d73587ec1bab 100644
--- a/llvm/lib/Target/Lanai/LanaiISelDAGToDAG.cpp
+++ b/llvm/lib/Target/Lanai/LanaiISelDAGToDAG.cpp
@@ -212,6 +212,37 @@ bool LanaiDAGToDAGISel::selectAddrSpls(SDValue Addr, SDValue &Base,
   return selectAddrRiSpls(Addr, Base, Offset, AluOp, /*RiMode=*/false);
 }
 
+namespace llvm {
+namespace LPAC {
+static AluCode isdToLanaiAluCode(ISD::NodeType Node_type) {
+  switch (Node_type) {
+  case ISD::ADD:
+    return AluCode::ADD;
+  case ISD::ADDE:
+    return AluCode::ADDC;
+  case ISD::SUB:
+    return AluCode::SUB;
+  case ISD::SUBE:
+    return AluCode::SUBB;
+  case ISD::AND:
+    return AluCode::AND;
+  case ISD::OR:
+    return AluCode::OR;
+  case ISD::XOR:
+    return AluCode::XOR;
+  case ISD::SHL:
+    return AluCode::SHL;
+  case ISD::SRL:
+    return AluCode::SRL;
+  case ISD::SRA:
+    return AluCode::SRA;
+  default:
+    return AluCode::UNKNOWN;
+  }
+}
+} // namespace LPAC
+} // namespace llvm
+
 bool LanaiDAGToDAGISel::selectAddrRr(SDValue Addr, SDValue &R1, SDValue &R2,
                                      SDValue &AluOp) {
   // if Address is FI, get the TargetFrameIndex.


        


More information about the llvm-commits mailing list