From 7b5987d56e194cea0364433a838abc2d6844e047 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 7 Apr 2005 19:41:18 +0000 Subject: [PATCH] Allow targets which produce setcc results in non-MVT::i1 registers to describe 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 | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index 15a5cb9ad57..347fe748392 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -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];