This adds a few more regexp patterns for llvm-mode-syntax-table. The primitive
type regexp was split out so it could be reused when handling vectors. Also
worth noting is that the vector regexp needs to come before the primitive
types, otherwise they will match first.
Details
- Reviewers
goldstein.w.n
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Example of some syntax this is suppose to help?
I tried on:
define <2 x i1> @foo.v2i1(<2 x i1> %v) { ret <2 x i1> %v } define i64 @promote_vscale_i32_to_i64() { ; CHECK-LABEL: @promote_vscale_i32_to_i64( ; CHECK-NEXT: [[VSCALE:%.*]] = call i64 @llvm.vscale.i64() ; CHECK-NEXT: [[EXT:%.*]] = and i64 [[VSCALE]], 4294967295 ; CHECK-NEXT: ret i64 [[EXT]] ; %vscale = call i32 @llvm.vscale.i32() %ext = zext i32 %vscale to i64 ret i64 %ext } declare i32 @llvm.vscale.i32() attributes #0 = { vscale_range(1, 16) }
And no change.
My bad, I did some last minute refactoring and didn't realise that the script didn't actually evaluate successfully. Fixed now.
New bits of syntax that should be highlighted:
<vscale x 4 x i32> <2 x float> i25 @my_function
Also by dropping the symbols arg to regexp-opt, we now properly highlight types that appear inside a vector constant, e.g. previously the first i32 wasn't highlighted in <i32 0, i32 1, i32 2, i32 3>
Okay a few notes.
Object first: This fails for something like: < 2x i64>.
Subjective:
Personally not a fan of some of the new highlighting.
- Personal preference would be in something like <vscale x 2 x i64> each of the component (</>, x, vscale, 2, and i64) would have seperate font-locks.
I'm not sure this is actually doable though. Can you set font for a portion of a regex match?
llvm/utils/emacs/llvm-mode.el | ||
---|---|---|
46 | This should be a seperate patch. | |
46 | Actually scratch this comment. Fine to keep here. |
This should be a seperate patch.