keriwarr / orangejoos

JOOS1W Compiler, written in Crystal
0 stars 1 forks source link

add SETcc instructions and fix if-stmt asm #75

Closed lgo closed 6 years ago

lgo commented 6 years ago

codegen: add general SETcc instruction SETcc instructions are used for fetching comparison results from the FLAGS register and putting them into general registers, i.e. converting a comparison result into a boolean value.

codegen: fix if-stmt asm Previously the CMP used the EAX register while boolean operations only set AL, using SETcc instructions. This meant that the upper 24-bits may hold garbage values and munge the CMP result.


this fixes some correctness issues with the if-stmt and future comparison operators, as the assembly was in general incorrect here.

lgo commented 6 years ago

ftr I removed the calling fix and moved it to another branch. this one now just contains the if-stmt fix and SETcc instruction bits (cause it's a little wonky).