1 
2 #ifndef _ORC_OPCODE_H_
3 #define _ORC_OPCODE_H_
4 
5 #include <orc/orc.h>
6 #include <orc/orclimits.h>
7 
8 ORC_BEGIN_DECLS
9 
10 typedef struct _OrcOpcodeSet OrcOpcodeSet;
11 typedef struct _OrcStaticOpcode OrcStaticOpcode;
12 
13 
14 /**
15  * OrcOpcodeSet:
16  *
17  * The OrcOpcodeSet structure has no public members
18  */
19 struct _OrcOpcodeSet {
20   /*< private >*/
21   int opcode_major;
22   char prefix[8];
23 
24   int n_opcodes;
25   OrcStaticOpcode *opcodes;
26 };
27 
28 #define ORC_STATIC_OPCODE_ACCUMULATOR (1<<0)
29 #define ORC_STATIC_OPCODE_FLOAT_SRC (1<<1)
30 #define ORC_STATIC_OPCODE_FLOAT_DEST (1<<2)
31 #define ORC_STATIC_OPCODE_FLOAT (ORC_STATIC_OPCODE_FLOAT_SRC|ORC_STATIC_OPCODE_FLOAT_DEST)
32 #define ORC_STATIC_OPCODE_SCALAR (1<<3)
33 #define ORC_STATIC_OPCODE_LOAD (1<<4)
34 #define ORC_STATIC_OPCODE_STORE (1<<5)
35 #define ORC_STATIC_OPCODE_INVARIANT (1<<6)
36 #define ORC_STATIC_OPCODE_ITERATOR (1<<7)
37 #define ORC_STATIC_OPCODE_COPY (1<<8)
38 
39 
40 struct _OrcStaticOpcode {
41   char name[16];
42   unsigned int flags;
43   int dest_size[ORC_STATIC_OPCODE_N_DEST];
44   int src_size[ORC_STATIC_OPCODE_N_SRC];
45   OrcOpcodeEmulateNFunc emulateN;
46 };
47 
48 ORC_API OrcStaticOpcode * orc_opcode_find_by_name (const char *name);
49 
50 ORC_API void orc_opcode_init (void);
51 
52 ORC_API OrcOpcodeSet *orc_opcode_set_get (const char *name);
53 
54 ORC_API OrcOpcodeSet *orc_opcode_set_get_nth (int opcode_major);
55 
56 ORC_API int orc_opcode_set_find_by_name (OrcOpcodeSet *opcode_set, const char *name);
57 
58 ORC_API int orc_opcode_register_static (OrcStaticOpcode *sopcode, char *prefix);
59 
60 ORC_END_DECLS
61 
62 #endif
63 
64