[PATCH] Add a way to define the bit range covered by a SubRegIndex.

Ahmed Bougacha ahmed.bougacha at gmail.com
Fri May 31 10:29:34 PDT 2013


Committed as r183020, thanks!

As for the size, I'm not confident in making it mandatory, as there
are cases where the indices are used to describe tuples (in the .td),
so I'd prefer giving no arguments over "-1"s. For now it's just X86
and ARM.
-- Ahmed Bougacha


On Thu, May 30, 2013 at 5:21 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
>
> On May 30, 2013, at 4:44 PM, Ahmed Bougacha <ahmed.bougacha at gmail.com> wrote:
>
>> On Thu, May 30, 2013 at 4:26 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
>>>
>>> On May 30, 2013, at 2:44 PM, Ahmed Bougacha <ahmed.bougacha at gmail.com> wrote:
>>>
>>>> On Tue, May 28, 2013 at 1:48 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
>>>>>
>>>>>> -class SubRegIndex<list<SubRegIndex> comps = []> {
>>>>>> +class SubRegIndex<list<SubRegIndex> comps = [], int offset = -1, int size = -1> {
>>>>>
>>>>>
>>>>> I think we should flip these arguments around to be (size, offset, comps). That is more convenient for most targets. You can also make the offset default = 0, that is usually the right thing.
>>>>>
>>>>> In a second patch, I think it would make sense to make the size argument mandatory.
>>>>
>>>> OK then - quick update on the patch - what about this: Instead of
>>>> having the comps list, let ComposedOf only be settable by
>>>> ComposedSubRegIndex, a subclass of SubRegIndex. That way, SubRegIndex
>>>> only has size/offset, whereas ComposedSubRegIndex only has the A and B
>>>> elements of comps. (By the way, this lets us do some cleanup in
>>>> TableGen).
>>>
>>> I’m OK with removing the ‘comps’ argument, but we should just use:
>>>
>>> def foo : SubRegIndex<32, 32> { let ComposedOf = [a,b]; }
>>
>> Well, the idea behind removing comps was that the subclass had two
>> (small) advantages:
>> - you don't have to specify the size/offset (as they can/should be
>> inferred from the pair)
>> - the fact that the list is a pair is enforced by the template
>> arguments instead of the TableGen code.
>
> Good points, let's do it your way.
>
> /jakob
>




More information about the llvm-commits mailing list