This testcase illustrates the spill code added by Dyninst as part of the MemGaze instrumentation.

MemGaze:
https://github.com/pnnl/memgaze

Original binary:
SpMM kernel with COO storage format for the Sparse Matrix
Source code - https://github.com/pnnl/HiParTI
Binary file location - build/benchmark/matrix/spmm_mat

Files included in this directory
spmm_mat                  - Copy of the original binary
spmm_mat-memgaze          - Instrumented binary using MemGaze instrumentor
obj_spmm                  - Object dump of original binary 
obj_spmm_mat_inst         - Object dump of instrumented binary 
run_dyninst_spill.sh      - Script to run MemGaze instrumentor (there's not much here - 
                                it is copying the files, and a single call to MemGaze instrementor)
spmm_mat-memgaze.binanlys - File with mapping information between original and instrmented binary
      Format : 
               first column - instrumented binary IP
               sixth column - original binary IP
             seventh column - function in original binary
spmm_mat-memgaze.binanlys.log - auxiliary file generated by MemGaze instrumentor
spmm_mat-memgaze.hpcstruct    - auxiliary file generated by MemGaze instrumentor

To identify spill code - if run with the included orginal binary:
1. Example of correct mapping
  a) Entry in spmm_mat-memgaze.binanlys
      0x1060ee 1 0x50 0x1 0 77a4 ptiOmpSparseMatrixMulMatrix_Reduce._omp_fn.2
  b) obj_spmm
      77a4: 4d 8b 6d 50           mov    0x50(%r13),%r13
  c) obj_spmm_mat_inst
      1060ee: f3 49 0f ae e5        ptwrite %r13
      1060f3: 4d 8b 6d 50           mov    0x50(%r13),%r13

2. Spill code - if run with the included orginal binary:
  a) Find the mapping for original-to-instrumented in spmm_mat-memgaze.binanlys for 7800, 780a
    Entry in spmm_mat-memgaze.binanlys
      0x10618a 2 0x0 0x4 0 7800 ptiOmpSparseMatrixMulMatrix_Reduce._omp_fn.2
      0x1061b7 2 0x0 0x1 0 780a ptiOmpSparseMatrixMulMatrix_Reduce._omp_fn.2
  b) obj_spmm
     77fd: 41 39 c9              cmp    %ecx,%r9d
     7800: f3 41 0f 10 04 ba     movss  (%r10,%rdi,4),%xmm0
     7806: f3 0f 59 c1           mulss  %xmm1,%xmm0
     780a: f3 0f 58 06           addss  (%rsi),%xmm0
  c) obj_spmm_mat_inst has the following code instead of "ptwrite"
    10618a: 48 8d 64 24 80        lea    -0x80(%rsp),%rsp   <--- Start of spill code
    10618f: 50                    push   %rax
    106190: 9f                    lahf
    106191: 0f 90 c0              seto   %al
    106194: 50                    push   %rax
    106195: f3 49 0f ae e2        ptwrite %r10              <--- Intended ptwrite
    10619a: f3 48 0f ae e7        ptwrite %rdi
    10619f: 58                    pop    %rax
    1061a0: 80 c0 7f              add    $0x7f,%al
    1061a3: 9e                    sahf
    1061a4: 58                    pop    %rax
    1061a5: 48 8d a4 24 80 00 00  lea    0x80(%rsp),%rsp
    1061ac: 00
    1061ad: f3 41 0f 10 04 ba     movss  (%r10,%rdi,4),%xmm0
    1061b3: f3 0f 59 c1           mulss  %xmm1,%xmm0
    1061b7: 48 8d 64 24 80        lea    -0x80(%rsp),%rsp     <--- Start of spill code
    1061bc: 50                    push   %rax
    1061bd: 9f                    lahf
    1061be: 0f 90 c0              seto   %al
    1061c1: 50                    push   %rax
    1061c2: f3 48 0f ae e6        ptwrite %rsi                <--- Intended ptwrite
    1061c7: 58                    pop    %rax
    1061c8: 80 c0 7f              add    $0x7f,%al
    1061cb: 9e                    sahf
    1061cc: 58                    pop    %rax
    1061cd: 48 8d a4 24 80 00 00  lea    0x80(%rsp),%rsp

3. To find spill code if a regenerated binary is used in for instrmentation
  a) Find ptiOmpSparseMatrixMulMatrix in object dump of instrumented binary 
  b) Search for "seto" within that section, 
  c) Notice that the IP of the "lea" instruction occuring before the "seto" is mentioned in spmm_mat-memgaze.binanlys for the mapping instead of the "ptwrite"
