Allow targets which produce setcc results in non-MVT::i1 registers to describe
authorChris Lattner <sabre@nondot.org>
Thu, 7 Apr 2005 19:41:18 +0000 (19:41 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 7 Apr 2005 19:41:18 +0000 (19:41 +0000)
what the contents of the top bits of these registers are, in the common cases
of targets that sign and zero extend the results.

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

include/llvm/Target/TargetLowering.h

index 15a5cb9ad57cdb4200e019a40ad254481690fba4..347fe748392ea4f4adbdf461e959444b4493dc37 100644 (file)
@@ -59,6 +59,12 @@ public:
     Extend,     // Oversized shift pulls in zeros or sign bits.
   };
 
+  enum SetCCResultValue {
+    UndefinedSetCCResult,          // SetCC returns a garbage/unknown extend.
+    ZeroOrOneSetCCResult,          // SetCC returns a zero extended result.
+    ZeroOrNegativeOneSetCCResult,  // SetCC returns a sign extended result.
+  };
+
   TargetLowering(TargetMachine &TM);
   virtual ~TargetLowering();
 
@@ -68,9 +74,17 @@ public:
   bool isLittleEndian() const { return IsLittleEndian; }
   MVT::ValueType getPointerTy() const { return PointerTy; }
   MVT::ValueType getShiftAmountTy() const { return ShiftAmountTy; }
-  MVT::ValueType getSetCCResultTy() const { return SetCCResultTy; }
   OutOfRangeShiftAmount getShiftAmountFlavor() const {return ShiftAmtHandling; }
 
+  /// getSetCCResultTy - Return the ValueType of the result of setcc operations.
+  ///
+  MVT::ValueType getSetCCResultTy() const { return SetCCResultTy; }
+
+  /// getSetCCResultContents - For targets without boolean registers, this flag
+  /// returns information about the contents of the high-bits in the setcc
+  /// result register.
+  SetCCResultValue getSetCCResultContents() const { return SetCCResultContents;}
+
   /// getRegClassFor - Return the register class that should be used for the
   /// specified value type.  This may only be called on legal types.
   TargetRegisterClass *getRegClassFor(MVT::ValueType VT) const {
@@ -183,6 +197,10 @@ protected:
   /// of a setcc operation.  This defaults to the pointer type.
   void setSetCCResultType(MVT::ValueType VT) { SetCCResultTy = VT; }
 
+  /// setSetCCResultContents - Specify how the target extends the result of a
+  /// setcc operation in a register.
+  void setSetCCResultContents(SetCCResultValue Ty) { SetCCResultContents = Ty; }
+
   /// setShiftAmountFlavor - Describe how the target handles out of range shift
   /// amounts.
   void setShiftAmountFlavor(OutOfRangeShiftAmount OORSA) {
@@ -296,6 +314,10 @@ private:
   /// PointerTy.
   MVT::ValueType SetCCResultTy;
 
+  /// SetCCResultContents - Information about the contents of the high-bits in
+  /// the result of a setcc comparison operation.
+  SetCCResultValue SetCCResultContents;
+
   /// RegClassForVT - This indicates the default register class to use for
   /// each ValueType the target supports natively.
   TargetRegisterClass *RegClassForVT[MVT::LAST_VALUETYPE];