Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
S
swiftshader
  • Project
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Chen Yisong
  • swiftshader
  • Repository

Switch branch/tag
  • swiftshader
  • src
  • Reactor
  • LLVMAsm.hpp
Find file
BlameHistoryPermalink
  • Antonio Maiorano's avatar
    LLVM: add option to emit asm file to aid debugging · 6f6ca293
    Antonio Maiorano authored Nov 27, 2020
    Defining ENABLE_RR_EMIT_ASM_FILE will make it so that the LLVM backend
    outputs a unique asm file per routine that is generated. This file is
    further processed and updated so that each instruction is prefixed with
    the final resolved memory location.
    
    This is useful, for instance, when we get JIT callstacks and can't
    easily figure out which code it maps to. Furthermore, when this feature
    is coupled with ENABLE_RR_DEBUG_INFO, the emitted asm includes source
    location (file and line) information, making it easy to correlate the
    asm to the Reactor code.
    
    For example, running ReactorUnitTests.Sample with both
    ENABLE_RR_EMIT_ASM_FILE and ENABLE_RR_DEBUG_INFO enabled generates a
    file named swiftshader_jit_llvm_0000_ReactorUnitTests_Sample.asm, with
    partial output like so:
    
    ```
    	.file	2 "C:\\src\\SwiftShader2\\tests\\ReactorUnitTests\\ReactorUnitTests.cpp\\<unknown>"
    	.loc	2 53 0 prologue_end     # <unknown>:53:0
    [0x2B9D3358004] 	mov	qword ptr [rsp + 64], rcx # encoding: [0x48,0x89,0x4c,0x24,0x40]
    [0x2B9D3358009] 	mov	qword ptr [rsp + 72], rcx # encoding: [0x48,0x89,0x4c,0x24,0x48]
    	.loc	2 54 0                  # <unknown>:54:0
    [0x2B9D335800E] 	mov	eax, dword ptr [rcx - 4] # encoding: [0x8b,0x41,0xfc]
    [0x2B9D3358011] 	mov	dword ptr [rsp + 8], eax # encoding: [0x89,0x44,0x24,0x08]
    [0x2B9D3358015] 	mov	dword ptr [rsp + 16], eax # encoding: [0x89,0x44,0x24,0x10]
    	.loc	2 55 0                  # <unknown>:55:0
    [0x2B9D3358019] 	mov	dword ptr [rsp + 12], edx # encoding: [0x89,0x54,0x24,0x0c]
    [0x2B9D335801D] 	mov	dword ptr [rsp + 20], edx # encoding: [0x89,0x54,0x24,0x14]
    ```
    
    The "53", "54", and "55" are the line numbers of the respective Reactor
    code in ReactorUnitTests.cpp.
    
    CMake: enable REACTOR_EMIT_ASM_FILE to enable this feature.
    
    Bug: b/174358505
    Change-Id: I613a25fe0354a1343c49cb399875e82d5e806e29
    Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/50750
    Kokoro-Result: kokoro <noreply+kokoro@google.com>
    Tested-by: 's avatarAntonio Maiorano <amaiorano@google.com>
    Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
    6f6ca293
LLVMAsm.hpp 1.65 KB
EditWeb IDE
×

Replace LLVMAsm.hpp

Attach a file by drag & drop or click to upload


Cancel
A new branch will be created in your fork and a new merge request will be started.