diff options
| author | forsyth <forsyth@vitanuova.com> | 2010-04-27 13:16:18 +0100 |
|---|---|---|
| committer | forsyth <forsyth@vitanuova.com> | 2010-04-27 13:16:18 +0100 |
| commit | 983e672a40437a3c5dac0c6c4b929eef57e5f017 (patch) | |
| tree | 35af731941c70ba169ae2be42126eb46eda22101 /utils/qc/machcap.c | |
| parent | ebd861fe7c7767f146017b35ca30bae1d39a0b26 (diff) | |
20100427-1316
Diffstat (limited to 'utils/qc/machcap.c')
| -rw-r--r-- | utils/qc/machcap.c | 86 |
1 files changed, 84 insertions, 2 deletions
diff --git a/utils/qc/machcap.c b/utils/qc/machcap.c index 5fae5731..e9f9a988 100644 --- a/utils/qc/machcap.c +++ b/utils/qc/machcap.c @@ -1,16 +1,98 @@ #include "gc.h" -/* default, like old cc */ int machcap(Node *n) { if(n == Z) - return 0; /* test */ + return 1; /* test */ switch(n->op){ + + case OADD: + case OAND: + case OOR: + case OSUB: + case OXOR: + if(typev[n->left->type->etype]) + return 1; + break; + + case OMUL: + case OLMUL: + case OASMUL: + case OASLMUL: + return 1; + + case OLSHR: + case OASHR: + case OASHL: + case OASASHL: + case OASASHR: + case OASLSHR: + return 1; + + case OCAST: + if(typev[n->type->etype]) { + if(!typefd[n->left->type->etype]) + return 1; + } else if(!typefd[n->type->etype]) { + if(typev[n->left->type->etype]) + return 1; + } + break; + case OCOMMA: case OCOND: case OLIST: + case OANDAND: + case OOROR: + case ONOT: return 1; + + case OCOM: + case ONEG: + if(typechl[n->left->type->etype]) + return 1; + if(typev[n->left->type->etype]) + return 1; + return 0; + + case OASADD: + case OASSUB: + case OASAND: + case OASOR: + case OASXOR: + return 1; + + case OPOSTINC: + case OPOSTDEC: + case OPREINC: + case OPREDEC: + return 1; + + case OEQ: + case ONE: + case OLE: + case OGT: + case OLT: + case OGE: + case OHI: + case OHS: + case OLO: + case OLS: + return 1; + + case ODIV: + case OLDIV: + case OLMOD: + case OMOD: + return 0; + + case OASDIV: + case OASLDIV: + case OASLMOD: + case OASMOD: + return 0; + } return 0; } |
