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

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu May 30 17:21:42 PDT 2013


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