Last active
October 23, 2022 10:57
-
-
Save pervognsen/05b6ba468c3e28e2b18e30eb873cbc7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// semantic analysis, called by parser | |
void do_mul(Value *dest, Value *src) { | |
promote_arith(dest, src); | |
if (isint(dest)) { | |
if (isconst2(dest, src)) { | |
dest->ival *= src->ival; | |
} else { | |
gen_mul(dest, src); | |
} | |
} else { | |
assert(isfloat(dest)); | |
if (isconst2(dest, src)) { | |
dest->fval *= src->fval; | |
} else { | |
gen_fmul(dest, src); | |
} | |
} | |
gen_kill(src); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment