mirror of
https://github.com/golang/go.git
synced 2024-09-29 14:26:50 +00:00
gc: change "can we const evaluate this" from blacklist to whitelist
R=ken2 https://golang.org/cl/155074
This commit is contained in:
parent
44e51fad28
commit
1ee83f851d
@ -329,14 +329,38 @@ evconst(Node *n)
|
||||
Val v;
|
||||
Mpint b;
|
||||
|
||||
// pick off just the opcodes that can be
|
||||
// constant evaluated.
|
||||
switch(n->op) {
|
||||
case OMAKE:
|
||||
case OMAKEMAP:
|
||||
case OMAKESLICE:
|
||||
case OMAKECHAN:
|
||||
case ODCLCONST:
|
||||
case OCONVIFACE:
|
||||
default:
|
||||
return;
|
||||
case OADD:
|
||||
case OADDSTR:
|
||||
case OAND:
|
||||
case OANDAND:
|
||||
case OANDNOT:
|
||||
case OARRAYBYTESTR:
|
||||
case OCOM:
|
||||
case OCONV:
|
||||
case ODIV:
|
||||
case OEQ:
|
||||
case OGE:
|
||||
case OGT:
|
||||
case OLE:
|
||||
case OLSH:
|
||||
case OLT:
|
||||
case OMINUS:
|
||||
case OMOD:
|
||||
case OMUL:
|
||||
case ONE:
|
||||
case ONOT:
|
||||
case OOR:
|
||||
case OOROR:
|
||||
case OPLUS:
|
||||
case ORSH:
|
||||
case OSUB:
|
||||
case OXOR:
|
||||
break;
|
||||
}
|
||||
|
||||
nl = n->left;
|
||||
|
Loading…
Reference in New Issue
Block a user