Change TargetLowering::getTypeForExtArgOrReturn to take and return
authorPatrik Hagglund <patrik.h.hagglund@ericsson.com>
Tue, 11 Dec 2012 10:20:51 +0000 (10:20 +0000)
committerPatrik Hagglund <patrik.h.hagglund@ericsson.com>
Tue, 11 Dec 2012 10:20:51 +0000 (10:20 +0000)
MVTs, instead of EVTs.

Accordingly, add bitsLT (and similar) to MVT.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169850 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/ValueTypes.h
include/llvm/Target/TargetLowering.h
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86ISelLowering.h

index 240199291ae9dc55bd083309311413492d072933..b9f429537ca70d3d62a75a688aa9f3c44612a1a5 100644 (file)
@@ -389,6 +389,27 @@ namespace llvm {
       return getStoreSize() * 8;
     }
 
+    /// Return true if this has more bits than VT.
+    bool bitsGT(MVT VT) const {
+      return getSizeInBits() > VT.getSizeInBits();
+    }
+
+    /// Return true if this has no less bits than VT.
+    bool bitsGE(MVT VT) const {
+      return getSizeInBits() >= VT.getSizeInBits();
+    }
+
+    /// Return true if this has less bits than VT.
+    bool bitsLT(MVT VT) const {
+      return getSizeInBits() < VT.getSizeInBits();
+    }
+
+    /// Return true if this has no more bits than VT.
+    bool bitsLE(MVT VT) const {
+      return getSizeInBits() <= VT.getSizeInBits();
+    }
+
+
     static MVT getFloatingPointVT(unsigned BitWidth) {
       switch (BitWidth) {
       default:
index f48cae2a68d72d1632c126c38df7fae22b42df8f..6348f25434968b2b8022aab198934a4fd5c46637 100644 (file)
@@ -1446,9 +1446,9 @@ public:
   /// but this is not true all the time, e.g. i1 on x86-64. It is also not
   /// necessary for non-C calling conventions. The frontend should handle this
   /// and include all of the necessary information.
-  virtual EVT getTypeForExtArgOrReturn(LLVMContext &Context, EVT VT,
+  virtual MVT getTypeForExtArgOrReturn(LLVMContext &Context, MVT VT,
                                        ISD::NodeType /*ExtendKind*/) const {
-    EVT MinVT = getRegisterType(Context, MVT::i32);
+    MVT MinVT = getRegisterType(Context, MVT::i32);
     return VT.bitsLT(MinVT) ? MinVT : VT;
   }
 
index 37e69f8a18b7c938f5945ab699e093173fe1fa86..f492cf45903192705c68f0a28b3d59ed0ca68c9b 100644 (file)
@@ -1239,7 +1239,8 @@ void SelectionDAGBuilder::visitRet(const ReturnInst &I) {
           ExtendKind = ISD::ZERO_EXTEND;
 
         if (ExtendKind != ISD::ANY_EXTEND && VT.isInteger())
-          VT = TLI.getTypeForExtArgOrReturn(*DAG.getContext(), VT, ExtendKind);
+          VT = TLI.getTypeForExtArgOrReturn(*DAG.getContext(),
+                                            VT.getSimpleVT(), ExtendKind);
 
         unsigned NumParts = TLI.getNumRegisters(*DAG.getContext(), VT);
         MVT PartVT = TLI.getRegisterType(*DAG.getContext(), VT);
index 8b0bf34c1acbbbc9980e094dd3ad96f3c41d082b..a44879e371f3cd5be43c38a098c2acfdc76285da 100644 (file)
@@ -1689,8 +1689,8 @@ bool X86TargetLowering::isUsedByReturnOnly(SDNode *N, SDValue &Chain) const {
   return true;
 }
 
-EVT
-X86TargetLowering::getTypeForExtArgOrReturn(LLVMContext &Context, EVT VT,
+MVT
+X86TargetLowering::getTypeForExtArgOrReturn(LLVMContext &Context, MVT VT,
                                             ISD::NodeType ExtendKind) const {
   MVT ReturnMVT;
   // TODO: Is this also valid on 32-bit?
@@ -1699,7 +1699,7 @@ X86TargetLowering::getTypeForExtArgOrReturn(LLVMContext &Context, EVT VT,
   else
     ReturnMVT = MVT::i32;
 
-  EVT MinVT = getRegisterType(Context, ReturnMVT);
+  MVT MinVT = getRegisterType(Context, ReturnMVT);
   return VT.bitsLT(MinVT) ? MinVT : VT;
 }
 
index 15a43db5100343bbe1011050991cb0d9c11e2198..e3826be690367ee130e142eb82cbab50d96a1148 100644 (file)
@@ -859,8 +859,8 @@ namespace llvm {
 
     virtual bool mayBeEmittedAsTailCall(CallInst *CI) const;
 
-    virtual EVT
-    getTypeForExtArgOrReturn(LLVMContext &Context, EVT VT,
+    virtual MVT
+    getTypeForExtArgOrReturn(LLVMContext &Context, MVT VT,
                              ISD::NodeType ExtendKind) const;
 
     virtual bool