Patch: More data types

I've patched valuetypes.td/h to add data types that my backend needs to
support. There seems to be a lot of assumptions made in other spots of
the code that limit the number of data types to 32. I need to add a few
more types, but once I go over this limit llvm starts acting wonky. I
found all the items that are hard coded to 32 and a section that isn't,
but I cannot figure out how to expand it so that there can be up to 64
data types.

The section in question is TargetLowering.h and seems to be these two
functions.

LegalizeAction getTypeAction(MVT VT) const {

      if (VT.isExtended()) {

        if (VT.isVector()) return Expand;

        if (VT.isInteger())

          // First promote to a power-of-two size, then expand if
necessary.

          return VT == VT.getRoundIntegerType() ? Expand : Promote;

        assert(0 && "Unsupported extended type!");

        return Legal;

      }

      unsigned I = VT.getSimpleVT();

assert(I<4*array_lengthof(ValueTypeActions)*sizeof(ValueTypeActions[0]))
;

      return (LegalizeAction)((ValueTypeActions[I>>4] >> ((2*I) & 31)) &
3);

    }

void setTypeAction(MVT VT, LegalizeAction Action) {

      unsigned I = VT.getSimpleVT();

assert(I<4*array_lengthof(ValueTypeActions)*sizeof(ValueTypeActions[0]))
;

      ValueTypeActions[I>>4] |= Action << ((I*2) & 31);

    }

I am not really sure what is going on here, but would be happy if
someone could get it to expand to allow 64 datatypes.

Thanks,

Micah Villmow

Systems Engineer

Advanced Technology & Performance

Advanced Micro Devices Inc.

S1-609 One AMD Place

Sunnyvale, CA. 94085

P: 408-749-3966

datatypes.diff (9.92 KB)

Forgot to add the patch required tablegen to work correctly.

datatypes.diff (12.8 KB)