fragment cdecl::return := λ: DontChain(: l Nil). (: ( (.program( (.program l) (.del l) )) (.frame( (.frame l) )) ) Nil); fragment cdecl::return := λ: DontChain(: l Reg8). (: ( (.program( (.program l) \t 'mov \t '% (.expression l) , '%AL \n \t 'push \s '%RAX \n (.del l) \t 'pop \s '%RAX \n )) (.frame (.frame l)) (.expression 'AL) ) Nil); fragment cdecl::return := λ: DontChain(: l Reg16). (: ( (.program( (.program l) \t 'mov \t '% (.expression l) , '%AX \n \t 'push \s '%RAX \n (.del l) \t 'pop \s '%RAX \n )) (.frame (.frame l)) (.expression 'AX) ) Nil); fragment cdecl::return := λ: DontChain(: l Reg32). (: ( (.program( (.program l) \t 'mov \t '% (.expression l) , '%EAX \n \t 'push \s '%RAX \n (.del l) \t 'pop \s '%RAX \n )) (.frame (.frame l)) (.expression 'EAX) ) Nil); fragment cdecl::return := λ: DontChain(: l Reg64). (: ( (.program( (.program l) \t 'mov \t '% (.expression l) , '%RAX \n \t 'push \s '%RAX \n (.del l) \t 'pop \s '%RAX \n )) (.frame (.frame l)) (.expression 'RAX) ) Nil); fragment cdecl::return := λ: DontChain(: l Constant+Literal+Sized<1>). (: ( (.program( (.program l) (.del l) \t 'mov \t '$ (.expression l) , '%AL \n )) (.frame (.frame l)) (.expression 'AL) ) Nil); fragment cdecl::return := λ: DontChain(: l Constant+Literal+Sized<2>). (: ( (.program( (.program l) (.del l) \t 'mov \t '$ (.expression l) , '%AX \n )) (.frame (.frame l)) (.expression 'AX) ) Nil); fragment cdecl::return := λ: DontChain(: l Constant+Literal+Sized<4>). (: ( (.program( (.program l) (.del l) \t 'mov \t '$ (.expression l) , '%EAX \n )) (.frame (.frame l)) (.expression 'EAX) ) Nil); fragment cdecl::return := λ: DontChain(: l Constant+Literal+Sized<8>). (: ( (.program( (.program l) (.del l) \t 'mov \t '$ (.expression l) , '%RAX \n )) (.frame (.frame l)) (.expression 'RAX) ) Nil); fragment cdecl::return := λ: DontChain(: src LocalVariable+Sized). (: ( (.program( (.program src) (.del src) (if-eq (.expression size) 1 (\t 'mov \t (.expression src) \[ '%rbp \] , \s '%AL \n)) (if-eq (.expression size) 2 (\t 'mov \t (.expression src) \[ '%rbp \] , \s '%AX \n)) (if-eq (.expression size) 4 (\t 'mov \t (.expression src) \[ '%rbp \] , \s '%EAX \n)) (if-eq (.expression size) 8 (\t 'mov \t (.expression src) \[ '%rbp \] , \s '%RAX \n)) (if-eq 1 (>( (.expression size) 8 )) ( \t 'subq \s '$ (.expression size) , \s '%rsp \n (for word-offset in (range( 0 (/( (.expression size) 8 )) )) ( \t 'pushq \s (+( (.expression src) (*( (.expression word-offset) 8 )) )) \[ '%rbp \] \n )) (for word-offset in (range( 0 (/( (.expression size) 8 )) )) ( \t 'popq \s (-( (-( '-16 (*( (.expression word-offset) 8 )) )) (.expression cdecl::args-size) )) \[ '%rbp \] \n )) \t 'addq \s '$ (.expression size) , \s '%rsp \n )) )) (.frame (.frame src)) (.expression( (if-eq (.expression size) 1 'AL) (if-eq (.expression size) 2 'AX) (if-eq (.expression size) 4 'EAX) (if-eq (.expression size) 8 'RAX) )) ) Nil); fragment cdecl::return := λ: DontChain(: src GlobalVariable+Sized). (: ( (.program( (.program src) (.del src) (\t 'mov \t '$ (.expression src) \s , \s '%r15 \n) (if-eq (.expression size) 1 (\t 'mov \t '0 \[ '%r15 \] , \s '%AL \n)) (if-eq (.expression size) 2 (\t 'mov \t '0 \[ '%r15 \] , \s '%AX \n)) (if-eq (.expression size) 4 (\t 'mov \t '0 \[ '%r15 \] , \s '%EAX \n)) (if-eq (.expression size) 8 (\t 'mov \t '0 \[ '%r15 \] , \s '%RAX \n)) (if-eq 1 (>( (.expression size) 8 )) ( \t 'subq \s '$ (.expression size) , \s '%rsp \n (for word-offset in (range( 0 (/( (.expression size) 8 )) )) ( \t 'pushq \s (*( (.expression word-offset) 8 )) \[ '%r15 \] \n )) (for word-offset in (range( 0 (/( (.expression size) 8 )) )) ( \t 'popq \s (-( (-( '-16 (*( (.expression word-offset) 8 )) )) (.expression cdecl::args-size) )) \[ '%rbp \] \n )) \t 'addq \s '$ (.expression size) , \s '%rsp \n )) )) (.expression( (if-eq (.expression size) 1 'AL) (if-eq (.expression size) 2 'AX) (if-eq (.expression size) 4 'EAX) (if-eq (.expression size) 8 'RAX) )) ) Nil); fragment cdecl::return := λ: DontChain(: src StackVariable+Sized). (: ( (.program( (.program src) (.del src) (if-eq (.expression size) 1 (\t 'mov \t (.expression src) \[ '%rbp \] , \s '%AL \n)) (if-eq (.expression size) 2 (\t 'mov \t (.expression src) \[ '%rbp \] , \s '%AX \n)) (if-eq (.expression size) 4 (\t 'mov \t (.expression src) \[ '%rbp \] , \s '%EAX \n)) (if-eq (.expression size) 8 (\t 'mov \t (.expression src) \[ '%rbp \] , \s '%RAX \n)) (if-eq 1 (>( (.expression size) 8 )) ( \t 'subq \s '$ (.expression size) , \s '%rsp \n (for word-offset in (range( 0 (/( (.expression size) 8 )) )) ( \t 'pushq \s (+( (.expression size) (*( (.expression word-offset) 16 )) )) \[ '%rsp \] \n )) (for word-offset in (range( 0 (/( (.expression size) 8 )) )) ( \t 'popq \s (-( (-( '-16 (*( (.expression word-offset) 8 )) )) (.expression cdecl::args-size) )) \[ '%rbp \] \n )) \t 'addq \s '$ (.expression size) , \s '%rsp \n )) )) (.expression( (if-eq (.expression size) 1 'AL) (if-eq (.expression size) 2 'AX) (if-eq (.expression size) 4 'EAX) (if-eq (.expression size) 8 'RAX) )) ) Nil);