view usr/src/tools/smatch/src/opcode.h @ 19241:79022555a4a9

11972 resync smatch Reviewed by: Robert Mustacchi <rm@fingolfin.org> Approved by: Dan McDonald <danmcd@joyent.com>
author John Levon <john.levon@joyent.com>
date Mon, 11 Nov 2019 16:23:50 +0000
parents
children
line wrap: on
line source

#ifndef OPCODE_H
#define OPCODE_H

#include "symbol.h"

enum opcode {
#define OPCODE(OP,NG,SW,TF,N,FL)  OP_##OP,
#define OPCODE_RANGE(OP,S,E)	OP_##OP = OP_##S, OP_##OP##_END = OP_##E,
#include "opcode.def"
#undef  OPCODE
#undef  OPCODE_RANGE
	OP_LAST,			/* keep this one last! */
};

extern const struct opcode_table {
	int	negate:8;
	int	swap:8;
	int	to_float:8;
	unsigned int arity:2;
	unsigned int flags:6;
#define			OPF_NONE	0
#define			OPF_TARGET	(1 << 0)
} opcode_table[];


static inline int opcode_float(int opcode, struct symbol *type)
{
	if (!type || !is_float_type(type))
		return opcode;
	return opcode_table[opcode].to_float;
}

#endif