Skip to content

[JIT] Added BEGIN and END anchors for disasm output - #88782

Merged
TIHan merged 3 commits into
dotnet:mainfrom
TIHan:explicit-disasm-anchors
Jul 13, 2023
Merged

[JIT] Added BEGIN and END anchors for disasm output#88782
TIHan merged 3 commits into
dotnet:mainfrom
TIHan:explicit-disasm-anchors

Conversation

@TIHan

@TIHanTIHan commented Jul 12, 2023

Copy link
Copy Markdown
Contributor

This adds explicit BEGIN and END anchors so that FileCheck will only check the assembly body of the disasm output. Before, the anchors were ambiguous, so now it is explicit.

Example:

; Assembly listing for method BasicBenchmark.Program+BasicBenchmark:Virtual():this (FullOpts)
; Emitting BLENDED_CODE for X64 with AVX512 - Windows
; FullOpts code
; optimized code
; rsp based frame
; partially interruptible
; No PGO data
; Final local variable assignments
;
;* V00 this [V00 ] ( 0, 0 ) ref -> zero-ref this class-hnd single-def <BasicBenchmark.Program+BasicBenchmark>
; V01 loc0 [V01,T01] ( 2, 5 ) ref -> rbx class-hnd single-def <System.IDisposable>
; V02 loc1 [V02,T00] ( 4, 13 ) int -> rsi ; V03 OutArgs [V03 ] ( 1, 1 ) struct (32) [rsp+00H] do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
;
; Lcl frame size = 40
; BEGIN METHOD BasicBenchmark.Program+BasicBenchmark:Virtual():this
G_M37645_IG01: ;; offset=0000H
push rsi
push rbx
sub rsp, 40
;; size=6 bbWeight=1 PerfScore 2.25
G_M37645_IG02: ;; offset=0006H
test byte ptr [(reloc 0x7fff5936ec45)], 1 ; global ptr
je SHORT G_M37645_IG06
;; size=9 bbWeight=1 PerfScore 4.00
G_M37645_IG03: ;; offset=000FH
mov rcx, 0x1CF26001DC0 ; data for BasicBenchmark.Program:X
mov rbx, gword ptr [rcx]
xor esi, esi
;; size=15 bbWeight=1 PerfScore 2.50
G_M37645_IG04: ;; offset=001EH
mov rcx, rbx
mov r11, 0x7FFF58990090 ; code for System.IDisposable:Dispose():this
call [r11]System.IDisposable:Dispose():this
inc esi
cmp esi, 0x5F5E100
jl SHORT G_M37645_IG04
;; size=26 bbWeight=4 PerfScore 20.00
G_M37645_IG05: ;; offset=0038H
add rsp, 40
pop rbx
pop rsi
ret ;; size=7 bbWeight=1 PerfScore 2.25
G_M37645_IG06: ;; offset=003FH
mov rcx, 0x7FFF5936EC10
mov edx, 5
call CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE
jmp SHORT G_M37645_IG03
;; size=22 bbWeight=0 PerfScore 0.00
; END METHOD BasicBenchmark.Program+BasicBenchmark:Virtual():this
; Total bytes of code 85, prolog size 6, PerfScore 39.50, instruction count 22, allocated bytes for code 85 (MethodHash=a3536cf2) for method BasicBenchmark.Program+BasicBenchmark:Virtual():this (FullOpts)
; ============================================================

@ghostghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 12, 2023
@ghostghost assigned TIHanJul 12, 2023
@ghost

Copy link
Copy Markdown

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details

This adds explicit BEGIN and END anchors so that FileCheck will only check the assembly body of the disasm output.

Example:

; Assembly listing for method BasicBenchmark.Program+BasicBenchmark:Virtual():this (FullOpts)
; Emitting BLENDED_CODE for X64 with AVX512 - Windows
; FullOpts code
; optimized code
; rsp based frame
; partially interruptible
; No PGO data
; Final local variable assignments
;
;* V00 this [V00 ] ( 0, 0 ) ref -> zero-ref this class-hnd single-def <BasicBenchmark.Program+BasicBenchmark>
; V01 loc0 [V01,T01] ( 2, 5 ) ref -> rbx class-hnd single-def <System.IDisposable>
; V02 loc1 [V02,T00] ( 4, 13 ) int -> rsi ; V03 OutArgs [V03 ] ( 1, 1 ) struct (32) [rsp+00H] do-not-enreg[XS] addr-exposed "OutgoingArgSpace"
;
; Lcl frame size = 40
; BEGIN METHOD ANCHOR BasicBenchmark.Program+BasicBenchmark:Virtual():this
G_M37645_IG01: ;; offset=0000H
push rsi
push rbx
sub rsp, 40
;; size=6 bbWeight=1 PerfScore 2.25
G_M37645_IG02: ;; offset=0006H
test byte ptr [(reloc 0x7fff5936ec45)], 1 ; global ptr
je SHORT G_M37645_IG06
;; size=9 bbWeight=1 PerfScore 4.00
G_M37645_IG03: ;; offset=000FH
mov rcx, 0x1CF26001DC0 ; data for BasicBenchmark.Program:X
mov rbx, gword ptr [rcx]
xor esi, esi
;; size=15 bbWeight=1 PerfScore 2.50
G_M37645_IG04: ;; offset=001EH
mov rcx, rbx
mov r11, 0x7FFF58990090 ; code for System.IDisposable:Dispose():this
call [r11]System.IDisposable:Dispose():this
inc esi
cmp esi, 0x5F5E100
jl SHORT G_M37645_IG04
;; size=26 bbWeight=4 PerfScore 20.00
G_M37645_IG05: ;; offset=0038H
add rsp, 40
pop rbx
pop rsi
ret ;; size=7 bbWeight=1 PerfScore 2.25
G_M37645_IG06: ;; offset=003FH
mov rcx, 0x7FFF5936EC10
mov edx, 5
call CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE
jmp SHORT G_M37645_IG03
;; size=22 bbWeight=0 PerfScore 0.00
; END METHOD ANCHOR BasicBenchmark.Program+BasicBenchmark:Virtual():this
; Total bytes of code 85, prolog size 6, PerfScore 39.50, instruction count 22, allocated bytes for code 85 (MethodHash=a3536cf2) for method BasicBenchmark.Program+BasicBenchmark:Virtual():this (FullOpts)
; ============================================================
Author:TIHan
Assignees:TIHan
Labels:

area-CodeGen-coreclr

Milestone:-

@TIHan

Copy link
Copy Markdown
ContributorAuthor

@jit-contrib this is ready, pending CI.

Comment threadsrc/coreclr/jit/codegencommon.cpp Outdated
@TIHan
TIHan merged commit 36e32f8 into dotnet:mainJul 13, 2023
@TIHan
TIHan deleted the explicit-disasm-anchors branch July 13, 2023 19:08
@ghostghost locked as resolved and limited conversation to collaborators Aug 13, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@TIHan@AndyAyersMS