Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include "gc.h"
2
 
3
int
4
machcap(Node *n)
5
{
6
//	return 0;
7
 
8
	if(n == Z)
9
		return 1;	/* test */
10
 
11
	switch(n->op) {
12
	case OMUL:
13
	case OLMUL:
14
	case OASMUL:
15
	case OASLMUL:
16
		if(typechl[n->type->etype])
17
			return 1;
18
		if(typev[n->type->etype]) {
19
//		if(typev[n->type->etype] && n->right->op == OCONST) {
20
//			if(hi64v(n->right) == 0)
21
				return 1;
22
		}
23
		break;
24
 
25
	case OCOM:
26
	case ONEG:
27
	case OADD:
28
	case OAND:
29
	case OOR:
30
	case OSUB:
31
	case OXOR:
32
	case OASHL:
33
	case OLSHR:
34
	case OASHR:
35
		if(typechlv[n->left->type->etype])
36
			return 1;
37
		break;
38
 
39
	case OCAST:
40
		if(typev[n->type->etype]) {
41
			if(typechlp[n->left->type->etype])
42
				return 1;
43
		}
44
		else if(!typefd[n->type->etype]) {
45
			if(typev[n->left->type->etype])
46
				return 1;
47
		}
48
		break;
49
 
50
	case OCOND:
51
	case OCOMMA:
52
	case OLIST:
53
	case OANDAND:
54
	case OOROR:
55
	case ONOT:
56
	case ODOT:
57
		return 1;
58
 
59
	case OASADD:
60
	case OASSUB:
61
	case OASAND:
62
	case OASOR:
63
	case OASXOR:
64
		return 1;
65
 
66
	case OASASHL:
67
	case OASASHR:
68
	case OASLSHR:
69
		return 1;
70
 
71
	case OPOSTINC:
72
	case OPOSTDEC:
73
	case OPREINC:
74
	case OPREDEC:
75
		return 1;
76
 
77
	case OEQ:
78
	case ONE:
79
	case OLE:
80
	case OGT:
81
	case OLT:
82
	case OGE:
83
	case OHI:
84
	case OHS:
85
	case OLO:
86
	case OLS:
87
//print("%O\n", n->op);
88
		return 1;
89
	}
90
	return 0;
91
}