[llvm-commits] [llvm] r127766 - in /llvm/trunk: docs/LangRef.html include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h test/CodeGen/X86/bool-zext

Cameron Zwarich zwarich at apple.com
Thu Mar 17 06:57:18 PDT 2011


On Mar 17, 2011, at 2:22 AM, Frits van Bommel wrote:

> On Wed, Mar 16, 2011 at 11:20 PM, Cameron Zwarich <zwarich at apple.com> wrote:
>> +  /// getTypeForExtendedInteger - Return the type that should be used to zero or
>> +  /// sign extend a zeroext/signext integer argument or return value.
>> +  /// FIXME: Most C calling convention requires the return type to be promoted,
>> +  /// 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 MVT
>> +  getTypeForExtendedInteger(EVT VT, ISD::NodeType ExtendKind) const {
>> +    return MVT::i32;
>> +  }
> 
> Can this only ever get called for integers with <= 32 bits?
> If so, it'd be nice to assert() that to make sure it doesn't ever try
> to e.g. "extend" an i64 to i32 in the future. If not, it should
> probably return VT if it's > 32 bits.

The only caller has some logic that should really be moved into this function:

        if (ExtendKind != ISD::ANY_EXTEND && VT.isInteger()) {
          MVT ReturnMVT = getTypeForExtendedInteger(VT, ExtendKind);
          EVT MinVT = TLI.getRegisterType(*DAG.getContext(), ReturnMVT);
          if (VT.bitsLT(MinVT))
            VT = MinVT;
        }

It gets called in the 64-bit case, but then gets ignored.

> P.S. In the future, please try to spell my name right (you misspelled
> it in the commit message for r127684).

Sorry about that. I will try to get it right in the future.

Cameron



More information about the llvm-commits mailing list