EVMC
instructions.h
Go to the documentation of this file.
1 /* EVMC: Ethereum Client-VM Connector API.
2  * Copyright 2018-2019 The EVMC Authors.
3  * Licensed under the Apache License, Version 2.0.
4  */
5 
14 #pragma once
15 
16 #include <evmc/evmc.h>
17 #include <evmc/utils.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
27 {
28  OP_STOP = 0x00,
29  OP_ADD = 0x01,
30  OP_MUL = 0x02,
31  OP_SUB = 0x03,
32  OP_DIV = 0x04,
33  OP_SDIV = 0x05,
34  OP_MOD = 0x06,
35  OP_SMOD = 0x07,
36  OP_ADDMOD = 0x08,
37  OP_MULMOD = 0x09,
38  OP_EXP = 0x0a,
39  OP_SIGNEXTEND = 0x0b,
40 
41  OP_LT = 0x10,
42  OP_GT = 0x11,
43  OP_SLT = 0x12,
44  OP_SGT = 0x13,
45  OP_EQ = 0x14,
46  OP_ISZERO = 0x15,
47  OP_AND = 0x16,
48  OP_OR = 0x17,
49  OP_XOR = 0x18,
50  OP_NOT = 0x19,
51  OP_BYTE = 0x1a,
52  OP_SHL = 0x1b,
53  OP_SHR = 0x1c,
54  OP_SAR = 0x1d,
55 
56  OP_KECCAK256 = 0x20,
57 
58  OP_ADDRESS = 0x30,
59  OP_BALANCE = 0x31,
60  OP_ORIGIN = 0x32,
61  OP_CALLER = 0x33,
62  OP_CALLVALUE = 0x34,
63  OP_CALLDATALOAD = 0x35,
64  OP_CALLDATASIZE = 0x36,
65  OP_CALLDATACOPY = 0x37,
66  OP_CODESIZE = 0x38,
67  OP_CODECOPY = 0x39,
68  OP_GASPRICE = 0x3a,
69  OP_EXTCODESIZE = 0x3b,
70  OP_EXTCODECOPY = 0x3c,
71  OP_RETURNDATASIZE = 0x3d,
72  OP_RETURNDATACOPY = 0x3e,
73  OP_EXTCODEHASH = 0x3f,
74 
75  OP_BLOCKHASH = 0x40,
76  OP_COINBASE = 0x41,
77  OP_TIMESTAMP = 0x42,
78  OP_NUMBER = 0x43,
79  OP_DIFFICULTY = 0x44,
80  OP_GASLIMIT = 0x45,
81  OP_CHAINID = 0x46,
82  OP_SELFBALANCE = 0x47,
83  OP_BASEFEE = 0x48,
84 
85  OP_POP = 0x50,
86  OP_MLOAD = 0x51,
87  OP_MSTORE = 0x52,
88  OP_MSTORE8 = 0x53,
89  OP_SLOAD = 0x54,
90  OP_SSTORE = 0x55,
91  OP_JUMP = 0x56,
92  OP_JUMPI = 0x57,
93  OP_PC = 0x58,
94  OP_MSIZE = 0x59,
95  OP_GAS = 0x5a,
96  OP_JUMPDEST = 0x5b,
97 
98  OP_PUSH1 = 0x60,
99  OP_PUSH2 = 0x61,
100  OP_PUSH3 = 0x62,
101  OP_PUSH4 = 0x63,
102  OP_PUSH5 = 0x64,
103  OP_PUSH6 = 0x65,
104  OP_PUSH7 = 0x66,
105  OP_PUSH8 = 0x67,
106  OP_PUSH9 = 0x68,
107  OP_PUSH10 = 0x69,
108  OP_PUSH11 = 0x6a,
109  OP_PUSH12 = 0x6b,
110  OP_PUSH13 = 0x6c,
111  OP_PUSH14 = 0x6d,
112  OP_PUSH15 = 0x6e,
113  OP_PUSH16 = 0x6f,
114  OP_PUSH17 = 0x70,
115  OP_PUSH18 = 0x71,
116  OP_PUSH19 = 0x72,
117  OP_PUSH20 = 0x73,
118  OP_PUSH21 = 0x74,
119  OP_PUSH22 = 0x75,
120  OP_PUSH23 = 0x76,
121  OP_PUSH24 = 0x77,
122  OP_PUSH25 = 0x78,
123  OP_PUSH26 = 0x79,
124  OP_PUSH27 = 0x7a,
125  OP_PUSH28 = 0x7b,
126  OP_PUSH29 = 0x7c,
127  OP_PUSH30 = 0x7d,
128  OP_PUSH31 = 0x7e,
129  OP_PUSH32 = 0x7f,
130  OP_DUP1 = 0x80,
131  OP_DUP2 = 0x81,
132  OP_DUP3 = 0x82,
133  OP_DUP4 = 0x83,
134  OP_DUP5 = 0x84,
135  OP_DUP6 = 0x85,
136  OP_DUP7 = 0x86,
137  OP_DUP8 = 0x87,
138  OP_DUP9 = 0x88,
139  OP_DUP10 = 0x89,
140  OP_DUP11 = 0x8a,
141  OP_DUP12 = 0x8b,
142  OP_DUP13 = 0x8c,
143  OP_DUP14 = 0x8d,
144  OP_DUP15 = 0x8e,
145  OP_DUP16 = 0x8f,
146  OP_SWAP1 = 0x90,
147  OP_SWAP2 = 0x91,
148  OP_SWAP3 = 0x92,
149  OP_SWAP4 = 0x93,
150  OP_SWAP5 = 0x94,
151  OP_SWAP6 = 0x95,
152  OP_SWAP7 = 0x96,
153  OP_SWAP8 = 0x97,
154  OP_SWAP9 = 0x98,
155  OP_SWAP10 = 0x99,
156  OP_SWAP11 = 0x9a,
157  OP_SWAP12 = 0x9b,
158  OP_SWAP13 = 0x9c,
159  OP_SWAP14 = 0x9d,
160  OP_SWAP15 = 0x9e,
161  OP_SWAP16 = 0x9f,
162  OP_LOG0 = 0xa0,
163  OP_LOG1 = 0xa1,
164  OP_LOG2 = 0xa2,
165  OP_LOG3 = 0xa3,
166  OP_LOG4 = 0xa4,
167 
168  OP_CREATE = 0xf0,
169  OP_CALL = 0xf1,
170  OP_CALLCODE = 0xf2,
171  OP_RETURN = 0xf3,
172  OP_DELEGATECALL = 0xf4,
173  OP_CREATE2 = 0xf5,
174 
175  OP_STATICCALL = 0xfa,
176 
177  OP_REVERT = 0xfd,
178  OP_INVALID = 0xfe,
179  OP_SELFDESTRUCT = 0xff
180 };
181 
188 {
190  int16_t gas_cost;
191 
194 
200 };
201 
210  enum evmc_revision revision);
211 
222 
223 #ifdef __cplusplus
224 }
225 #endif
226 
EVMC: Ethereum Client-VM Connector API.
evmc_revision
EVM revision.
Definition: evmc.h:809
#define EVMC_EXPORT
Marks a function to be exported from a shared library.
Definition: utils.h:23
EVMC_EXPORT const struct evmc_instruction_metrics * evmc_get_instruction_metrics_table(enum evmc_revision revision)
Get the table of the EVM 1 instructions metrics.
EVMC_EXPORT const char *const * evmc_get_instruction_names_table(enum evmc_revision revision)
Get the table of the EVM 1 instruction names.
evmc_opcode
The list of EVM 1 opcodes from every EVM revision.
Definition: instructions.h:27
Metrics for an EVM 1 instruction.
Definition: instructions.h:188
int16_t gas_cost
The instruction gas cost.
Definition: instructions.h:190
int8_t stack_height_required
The minimum number of the EVM stack items required for the instruction.
Definition: instructions.h:193
int8_t stack_height_change
The EVM stack height change caused by the instruction execution, i.e.
Definition: instructions.h:199
A collection of helper macros to handle some non-portable features of C/C++ compilers.