An idea which I will probably implement in my editor:
Let's say you have
.data
v1 dq 0
v2 dq 0
v3 dd 0
;and more variables
;...
.code
p1 proc
;...
mov rax, v1
;...
p1 endp
p2 proc
;...
p2 endp
p3 proc
;...
lbl1:
;...
lbl2:
;...
lbl3:
;...
p3 endp
;...
After pressing some sort of magic button, the editor would insert lines as shown below:
.data
v1 dq 0
v2 dq 0
v3 dd 0
;and more variables
;...
counter_p1 dq 0
counter_p2 dq 0
counter_p3 dq 0
counter_v1 dq 0
counter_v2 dq 0
counter_v3 dq 0
;...
counter_p3_lbl1 dq 0
counter_p3_lbl2 dq 0
counter_p3_lbl3 dq 0
;...
.code
p1 proc
inc counter_p1
;...
mov rax, v1
inc counter_v1
;...
p1 endp
p2 proc
inc counter_p2
;...
p2 endp
p3 proc
inc counter_p3
;...
lbl1:
inc counter_p3_lbl1
;...
lbl2:
inc counter_p3_lbl2
;...
lbl3:
inc counter_p3_lbl3
;...
p3 endp
endProc proc
;write counter's data to file
endProc endp
Then you would know which variables and procedures are accessed the most and you could then replace those variables(and labels) with registers:
.data
;for example if v1 and v3 are the most accessed variables:
v1 equ R8
v2 dd 0
v3 equ R9d
;...