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

Ahmed Bougacha ahmed.bougacha at gmail.com
Fri May 31 16:08:35 PDT 2013


OK so here's an update with a mandatory size:

- for synthesized tuples, the size is accumulated, and, if the
elements are contiguous, the offset is set to be that of the first
element.
- for .td indices that are used in a "sketchy" way (an index to
represent an element of a tuple, without a fixed offset), the offset
is kept at -1.
- the getter was split in two; the size getter returns:
  * the sum of the size of the parts when they are not contiguous
  * -1 when the index is used to access different kinds of registers

-- Ahmed Bougacha


On Fri, May 31, 2013 at 10:29 AM, Ahmed Bougacha
<ahmed.bougacha at gmail.com> wrote:
> 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
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: subreg-covered-range-3.svndiff
Type: application/octet-stream
Size: 11228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130531/afa93269/attachment.obj>


More information about the llvm-commits mailing list