[llvm-commits] [PATCH] Change SMRange to be half-open (exclusive end)

Chris Lattner clattner at apple.com
Tue Dec 18 11:06:39 PST 2012


On Dec 17, 2012, at 5:10 PM, Jordan Rose <jordan_rose at apple.com> wrote:

> Hi, all. When Chris first put in SMRange, he made it a closed range, meaning that [X, X] was a range that includes X rather than an empty range. I'd like to change this to a half-open range for a couple of reasons:
> 
> - More consistent with C++ (begin() and end()).
> - Empty ranges are useful to represent insertions (for my upcoming revised fixit patch)
> - It is unclear what it means if the last character of a range is a multibyte character -- does the pointer refer to the start of the character, or the last byte in the character?
> - It looks like some of the AsmParser uses of SMRange were already assuming this.

Thanks for working on this, it's definitely the right design direction.

> This patch should handle all of this, but I'm seeing a failure in the X86 disassembly tests. This confuses me because I didn't think the disassembler used SMRange.
> 
>> /Volumes/Lore/llvm-public/llvm/test/MC/Disassembler/X86/enhanced.txt:5:10: error: expected string not found in input
>> # CHECK: [o:movq][w: ][1-r:%gs=r{{[0-9]+}}][1-p::][1-l:8=8][p:,][w: ][0-r:%rcx=r{{[0-9]+}}] <mov> 0:[RCX/{{[0-9]+}}]=0 1:[GS/{{[0-9]+}}]=8
>>          ^
>> <stdin>:2:1: note: scanning from here
>> [o:movq][w: ][1-r:%gs=r64][1-p::][1-l:8=8][1-p:,][w: ][0-r:%rcx=r109] <mov> 0:[RCX/109]=0 1:[GS/64]=8 
>> ^
> 
> I'm usually up on the Clang side (all of this is trying to get a new warning into Clang TableGen, with a fixit), so I'm not sure how to debug this one. Does anyone have any ideas why this test would start failing?

This is exercising the "edis" disassembler functionality, which annotates the disassembly with range information about operands, to allow UI tools to put annotations on the disassembled text.  This was originally implemented for LLDB, but as it turns out, LLDB just removed their last use of EDIS (afaik), so all the edis code in llvm is dead and should now be removed.

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121218/69ddb854/attachment.html>


More information about the llvm-commits mailing list