In order to produce EVM-specific instructions, a set of intrinsics must be specified for the frontend to emit so that the EVM backend understands to generate the corresponding instruction. Many of these instructions, in Solidity, are represented by built-in functions. NOTE: The argument ordering in these intrinsics may not fully match the order on which they must be pushed onto the EVM stack. Someone should double check. TODO: Double-check argument and return types as well.
llvm.evm_builtin_sha3
data: u256be
: byte pointer to buffer to hashlen: u256be
: length of bufferhash: bytes32
: resulting hash0x20
llvm.evm_builtin_address
address: bytes20
: Currently executing account0x30
llvm.evm_builtin_balance
address: bytes20
: Account to check balance ofbalance: u256be
: Balance of given account0x31
llvm.evm_builtin_origin
address: bytes20
: Address of TX origin0x32
llvm.evm_builtin_caller
address: bytes20
: Address of caller0x33
llvm.evm_builtin_callvalue
value: u256be
: TX value sent0x34
llvm.evm_builtin_calldataload
offset: u256be
: Offset within call data buffer to loaddata: bytes32
: 32 bytes of calldata beginning at offset
0x35
llvm.evm_builtin_calldatasize
size: u256be
: Length of call data buffer0x36
llvm.evm_builtin_calldatacopy
dst: u256be
: Pointer to destination bufferoffset: u256be
: Offset within call data to copylen: u256be
: Number of bytes to copy beginning at offset
0x37
llvm.evm_builtin_codesize
size: u256be
: Size of code at currently executing account0x38
llvm.evm_builtin_codecopy
dst: u256be
: Pointer to destination bufferoffset: u256be
: Offset within code to copylen: u256be
: Number of bytes to copy beginning at offset
0x39
llvm.evm_builtin_gasprice
price: u256
: Cost of gas in current environment0x3a
llvm.evm_builtin_extcodesize
address: bytes20
: Address whose code size to check size: u256be
: Size of code at given account0x3b
llvm.evm_builtin_extcodecopy
address: bytes20
Address whose code to copydst: u256be
: Pointer to destination bufferoffset: u256be
: Offset within code to copylen: u256be
: Number of bytes to copy beginning at offset
0x3C
llvm.evm_builtin_returndatasize
size: u256be
: Size of return data buffer from last call0x3d
llvm.evm_builtin_returndatacopy
dst: u256be
: Pointer to destination bufferoffset: u256be
: Offset within return buffer to copylen: u256be
: Number of bytes to copy beginning at offset
0x3e
llvm.evm_builtin_blockhash
age: u256be
: The age of the block, between 0 and 256 blocks oldhash: bytes32
: The hash of the requested block0x40
llvm.evm_builtin_coinbase
beneficiary: bytes20
: Current mining beneficiary0x41
llvm.evm_builtin_timestamp
stamp: u256be
: Timestamp of last block0x42
llvm.evm_builtin_blocknumber
blknum: u256be
: Current block number0x43
llvm.evm_builtin_difficulty
difficulty: u256be
: Current block difficulty0x44
llvm.evm_builtin_gaslimit
limit: u256be
: Block gas limit //NOTE: check type again0x45
llvm.evm_builtin_sload
key: u256be
: Storage key to accessvalue: u256be
: Storage value at key0x54
llvm.evm_builtin_sstore
key: u256be
: Storage key to write value
value: u256be
: Value to write0x55
llvm.evm_builtin_msize
size: u256be
: Size of active memory in bytes0x59
llvm.evm_builtin_gas
gasleft: u256be
: Amount of gas left in current executionllvm.evm_builtin_log0
data: u256be
: Pointer to log data bufferlen: u256be
: Size of log data buffer in bytes0xa0
llvm.evm_builtin_log0
data: u256be
: Pointer to log data bufferlen: u256be
: Size of log data buffer in bytestopic1: u256be
: Log topic 10xa1
llvm.evm_builtin_log2
data: u256be
: Pointer to log data bufferlen: u256be
: Size of log data buffer in bytestopic1: u256be
: Log topic 1topic2: u256be
: Log topic 20xa2
llvm.evm_builtin_log3
data: u256be
: Pointer to log data bufferlen: u256be
: Size of log data buffer in bytestopic1: u256be
: Log topic 1topic2: u256be
: Log topic 2topic3: u256be
: Log topic 30xa3
llvm.evm_builtin_log4
data: u256be
: Pointer to log data bufferlen: u256be
: Size of log data buffer in bytestopic1: u256be
: Log topic 1topic2: u256be
: Log topic 2topic3: u256be
: Log topic 3topic4: u256be
: Log topic 40xa4
llvm.evm_builtin_create
value: u256be
: Value in wei sent to new contractcode: u256be
: Pointer to code buffer for new contractlen: u256be
: Code buffer lengthaddr: bytes20
: Address of newly created contract0xf0
llvm.evm_builtin_create2
value: u256be
: Value in wei sent to new contractcode: u256be
: Pointer to code buffer for new contractlen: u256be
: Code buffer lengthsalt: bytes32
: Salt for address creationaddr: bytes20
: Address of newly created contract0xf5
llvm.evm_builtin_call
gas: u256be
: Gas allowance for calladdress: bytes20
: Call destination addressvalue: u256be
: Wei value sent with callinput: u256be
: Input data pointerinputlen: u256be
: Input data buffer sizeoutput: u256be
: Output buffer pointeroutputlen: u256be
: Output data buffer sizereturn: u256be
: Exit code0xf1
llvm.evm_builtin_callcode
gas: u256be
: Gas allowance for calladdress: bytes20
: Address of code to usevalue: u256be
: Wei value sent with callinput: u256be
: Input data pointerinputlen: u256be
: Input data buffer sizeoutput: u256be
: Output buffer pointeroutputlen: u256be
: Output data buffer sizereturn: u256be
: Exit code0xf2
llvm.evm_builtin_calldelegate
gas: u256be
: Gas allowance for calladdress: bytes20
: Address of code to useinput: u256be
: Input data pointerinputlen: u256be
: Input data buffer sizeoutput: u256be
: Output buffer pointeroutputlen: u256be
: Output data buffer sizereturn: u256be
: Exit code0xf4
llvm.evm_builtin_staticcall
gas: u256be
: Gas allowance for calladdress: bytes20
: Call destination addressinput: u256be
: Input data pointerinputlen: u256be
: Input data buffer sizeoutput: u256be
: Output buffer pointeroutputlen: u256be
: Output data buffer size0xfa
llvm.evm_builtin_return
data: u256be
: Return data pointerlen: u256be
: Return buffer size0xf3
llvm.evm_builtin_revert
data: u256be
: Return data pointerlen: u256be
: Return buffer size0xfd
llvm.evm_builtin_selfdestruct
beneficiary: bytes20
: Address to send funds to0xff