Adds support for xray on mips/mipsel/mips64/mips64el.
Patches for llvm and clang:
Differential D27699
[Compiler-rt][XRAY][MIPS] Support xray on mips/mipsel/mips64/mips64el slthakur on Dec 12 2016, 10:43 PM. Authored by
Details
Adds support for xray on mips/mipsel/mips64/mips64el. Patches for llvm and clang:
Diff Detail
Event TimelineComment Actions Removed patching of instruction "addiu t9, t9, 44" as it was unnecessary since it will always be there at the end of the sled when xray instrumentation is enabled. Comment Actions The sled has an issue in that it requires 64bit atomic operations to disable it. MIPS32 doesn't natively support such operations and MIPS64 would need alignment guarantees to perform a 64 bit write. Instead if we use a sled like this: addiu sp, sp, -8 ;create stack frame nop ;avoid the need for 64bit atomics. sw ra, 4(sp) ;save return address sw t9, 0(sp) ;save register t9 lui t9, <Upper half of address of TracingHook> ori t9, t9, <Lower half of address of TracingHook> jalr t9 ;call Tracing hook addiu t0 , zero, #<function ID> ;pass function id (delay slot) lw t9, 0(sp) ;restore register t9 lw ra, 4(sp) ;restore return address addiu sp, sp, 8 ;delete stack frame We can disable or re-enable the sled with a single 32 bit write by changing addiu sp, sp, -8 to b.
Comment Actions Addressed review comments
Comment Actions LGTM with nits addressed.
|
That comment should be "LUI T9, (<Address> >> 16) & 0xffff