xref: /illumos-gate/usr/src/tools/smatch/src/opcode.h (revision c85f09cc92abd00c84e58ec9f0f5d942906cb713)
1 #ifndef OPCODE_H
2 #define OPCODE_H
3 
4 #include "symbol.h"
5 
6 enum opcode {
7 #define OPCODE(OP,NG,SW,TF,N,FL)  OP_##OP,
8 #define OPCODE_RANGE(OP,S,E)	OP_##OP = OP_##S, OP_##OP##_END = OP_##E,
9 #include "opcode.def"
10 #undef  OPCODE
11 #undef  OPCODE_RANGE
12 	OP_LAST,			/* keep this one last! */
13 };
14 
15 extern const struct opcode_table {
16 	int	negate:8;
17 	int	swap:8;
18 	int	to_float:8;
19 	unsigned int arity:2;
20 	unsigned int flags:6;
21 #define			OPF_NONE	0
22 #define			OPF_TARGET	(1 << 0)
23 } opcode_table[];
24 
25 
opcode_float(int opcode,struct symbol * type)26 static inline int opcode_float(int opcode, struct symbol *type)
27 {
28 	if (!type || !is_float_type(type))
29 		return opcode;
30 	return opcode_table[opcode].to_float;
31 }
32 
33 #endif
34