Skip to content
  • tibbe's avatar
    Make it possible to test the generated assembly · 5ec6ea3e
    tibbe authored and Simon Marlow's avatar Simon Marlow committed
    This test framework feature is inspired by a similar feature in LLVM.
    The programmer writes a bit of Cmm
    
        #include "Cmm.h"
    
        // Large memcpy's should lower to calls.
        callMemcpy
        {
          W_ dst, src;
          prim %memcpy(dst "ptr", src "ptr", 1024, 4) [];
        }
    
    and asserts what the generated assembly should look like, modulo
    register naming.
    
        callMemcpy:
        movq  ; Move arguments into place
        movq
        movl
        movl
        call memcpy
    
    Patch edited and updated by Simon Marlow, and I also added a test for
    unrolling memcpy and a simple constant-propagation test.
    5ec6ea3e