Index: llvm/include/llvm/CodeGen/GlobalISel/Utils.h =================================================================== --- llvm/include/llvm/CodeGen/GlobalISel/Utils.h +++ llvm/include/llvm/CodeGen/GlobalISel/Utils.h @@ -168,10 +168,5 @@ return isKnownNeverNaN(Val, MRI, true); } -/// Get a rough equivalent of an MVT for a given LLT. -MVT getMVTForLLT(LLT Ty); -/// Get a rough equivalent of an LLT for a given MVT. -LLT getLLTForMVT(MVT Ty); - } // End namespace llvm. #endif Index: llvm/include/llvm/CodeGen/LowLevelType.h =================================================================== --- llvm/include/llvm/CodeGen/LowLevelType.h +++ llvm/include/llvm/CodeGen/LowLevelType.h @@ -17,6 +17,7 @@ #define LLVM_CODEGEN_LOWLEVELTYPE_H #include "llvm/Support/LowLevelTypeImpl.h" +#include "llvm/Support/MachineValueType.h" namespace llvm { @@ -26,6 +27,12 @@ /// Construct a low-level type based on an LLVM type. LLT getLLTForType(Type &Ty, const DataLayout &DL); +/// Get a rough equivalent of an MVT for a given LLT. +MVT getMVTForLLT(LLT Ty); + +/// Get a rough equivalent of an LLT for a given MVT. +LLT getLLTForMVT(MVT Ty); + } #endif // LLVM_CODEGEN_LOWLEVELTYPE_H Index: llvm/lib/CodeGen/GlobalISel/Utils.cpp =================================================================== --- llvm/lib/CodeGen/GlobalISel/Utils.cpp +++ llvm/lib/CodeGen/GlobalISel/Utils.cpp @@ -431,20 +431,3 @@ void llvm::getSelectionDAGFallbackAnalysisUsage(AnalysisUsage &AU) { AU.addPreserved(); } - -MVT llvm::getMVTForLLT(LLT Ty) { - if (!Ty.isVector()) - return MVT::getIntegerVT(Ty.getSizeInBits()); - - return MVT::getVectorVT( - MVT::getIntegerVT(Ty.getElementType().getSizeInBits()), - Ty.getNumElements()); -} - -LLT llvm::getLLTForMVT(MVT Ty) { - if (!Ty.isVector()) - return LLT::scalar(Ty.getSizeInBits()); - - return LLT::vector(Ty.getVectorNumElements(), - Ty.getVectorElementType().getSizeInBits()); -} Index: llvm/lib/CodeGen/LowLevelType.cpp =================================================================== --- llvm/lib/CodeGen/LowLevelType.cpp +++ llvm/lib/CodeGen/LowLevelType.cpp @@ -35,3 +35,20 @@ } return LLT(); } + +MVT llvm::getMVTForLLT(LLT Ty) { + if (!Ty.isVector()) + return MVT::getIntegerVT(Ty.getSizeInBits()); + + return MVT::getVectorVT( + MVT::getIntegerVT(Ty.getElementType().getSizeInBits()), + Ty.getNumElements()); +} + +LLT llvm::getLLTForMVT(MVT Ty) { + if (!Ty.isVector()) + return LLT::scalar(Ty.getSizeInBits()); + + return LLT::vector(Ty.getVectorNumElements(), + Ty.getVectorElementType().getSizeInBits()); +}