diff options
| author | Roland Paterson-Jones <[email protected]> | 2024-05-23 20:21:56 +0200 |
|---|---|---|
| committer | Quentin Carbonneaux <[email protected]> | 2024-06-09 22:33:38 +0200 |
| commit | cf9f95f5212db901bdf09e95dae4647f17bfb1e5 (patch) | |
| tree | c464064b84ee8742499e4eef084b29a5c621a293 /copy.c | |
| parent | 2c2051542b7671fd060560edf09516ecf56bf6fa (diff) | |
Optab-driven copy detection
Diffstat (limited to 'copy.c')
| -rw-r--r-- | copy.c | 22 |
1 files changed, 5 insertions, 17 deletions
@@ -20,27 +20,15 @@ iscopy(Ins *i, Ref r, Fn *fn) [Wsw] = BIT(Wsw), [Wuw] = BIT(Wuw), }; + Op *op; bits b; Tmp *t; - switch (i->op) { - case Ocopy: + if (i->op == Ocopy) return 1; - case Omul: - case Odiv: - case Oudiv: - return iscon(i->arg[1], 1, fn); - case Oadd: - case Osub: - case Oor: - case Oxor: - case Osar: - case Oshl: - case Oshr: - return iscon(i->arg[1], 0, fn); - default: - break; - } + op = &optab[i->op]; + if (op->hasid && KBASE(i->cls) == 0) + return iscon(i->arg[1], op->idval, fn); if (!isext(i->op) || rtype(r) != RTmp) return 0; if (i->op == Oextsw || i->op == Oextuw) |
