# Yul

***

These instructions do not have a direct representation in EVM or  Validium VM. Instead, they perform auxiliary operations required for generating the target bytecode.

### datasize <a href="#datasize" id="datasize"></a>

Original [Yul](https://docs.soliditylang.org/en/latest/yul.html#datasize-dataoffset-datacopy) auxiliary instruction.

Unlike on EVM, on  Validium VM target this instruction returns the size of the header part of the calldata sent to the [ContractDeployer](https://docs.zksync.io/zk-stack/components/compiler/specification/system-contracts#contract-deployer). For more information, see [CREATE](https://docs.zksync.io/zk-stack/components/compiler/specification/instructions/evm/create).

LLVM IR codegen references:

1. [zksolc compiler](https://github.com/matter-labs/era-compiler-solidity/blob/main/src/yul/parser/statement/expression/function_call/mod.rs#L928)
2. [Shared FE code](https://github.com/matter-labs/era-compiler-llvm-context/blob/main/src/zkevm/evm/create.rs#L149)

### dataoffset <a href="#dataoffset" id="dataoffset"></a>

Original [Yul](https://docs.soliditylang.org/en/latest/yul.html#datasize-dataoffset-datacopy) auxiliary instruction.

Unlike on EVM, on  Validium VM target this instruction has nothing to do with the offset. Instead, it returns the bytecode hash of the contract referenced by the Yul object identifier. Since our compiler translates instructions without analyzing the surrounding context, it is not possible to get the bytecode hash from anywhere else in [datacopy](https://docs.zksync.io/zk-stack/components/compiler/specification/instructions/yul#datacopy). For more information, see [CREATE](https://docs.zksync.io/zk-stack/components/compiler/specification/instructions/evm/create).

LLVM IR codegen references:

1. [zksolc compiler](https://github.com/matter-labs/era-compiler-solidity/blob/main/src/yul/parser/statement/expression/function_call/mod.rs#L918)
2. [Shared FE code](https://github.com/matter-labs/era-compiler-llvm-context/blob/main/src/zkevm/evm/create.rs#L97)

### datacopy <a href="#datacopy" id="datacopy"></a>

Original [Yul](https://docs.soliditylang.org/en/latest/yul.html#datasize-dataoffset-datacopy) auxiliary instruction.

Unlike on EVM, on  Validium VM target this instruction copies the bytecode hash passed as [dataoffset](https://docs.zksync.io/zk-stack/components/compiler/specification/instructions/yul#dataoffset) to the destination. For more information, see [CREATE](https://docs.zksync.io/zk-stack/components/compiler/specification/instructions/evm/create).

[The LLVM IR generator code](https://github.com/matter-labs/era-compiler-solidity/blob/main/src/yul/parser/statement/expression/function_call/mod.rs#L938).

### setimmutable <a href="#setimmutable" id="setimmutable"></a>

Original [Yul](https://docs.soliditylang.org/en/latest/yul.html#setimmutable-loadimmutable) auxiliary instruction.

Writes immutables to the auxiliary heap.

For more information, see the [Differences with Ethereum](https://docs.zksync.io/build/developer-reference/ethereum-differences/evm-instructions#setimmutable-loadimmutable).

LLVM IR codegen references:

1. [zksolc compiler](https://github.com/matter-labs/era-compiler-solidity/blob/main/src/yul/parser/statement/expression/function_call/mod.rs#L562)
2. [Shared FE code](https://github.com/matter-labs/era-compiler-llvm-context/blob/main/src/eravm/evm/immutable.rs#L79)

### loadimmutable <a href="#loadimmutable" id="loadimmutable"></a>

Original [Yul](https://docs.soliditylang.org/en/latest/yul.html#setimmutable-loadimmutable) auxiliary instruction.

Reads immutables from the [ImmutableSimulator](https://docs.zksync.io/zk-stack/components/compiler/specification/system-contracts#simulator-of-immutables).

For more information, see the [Differences with Ethereum](https://docs.zksync.io/build/developer-reference/ethereum-differences/evm-instructions#setimmutable-loadimmutable).

LLVM IR codegen references:

1. [zksolc compiler](https://github.com/matter-labs/era-compiler-solidity/blob/main/src/yul/parser/statement/expression/function_call/mod.rs#L540)
2. [Shared FE code](https://github.com/matter-labs/era-compiler-llvm-context/blob/main/src/eravm/evm/immutable.rs#L17)

### linkersymbol <a href="#linkersymbol" id="linkersymbol"></a>

Original [Yul](https://docs.soliditylang.org/en/latest/yul.html#linkersymbol) auxiliary instruction.

Returns the address of a deployable library. The address must be passed to `zksolc` with the `--libraries` option, otherwise a compile-time error will be produced.

There is a special `zksolc` execution mode that can be enabled with `--missing-libraries` flag. In this mode, the compiler will return the list of deployable libraries not provided with `--libraries`. This mode allows package managers like Hardhat to automatically deploy libraries.

For more information, see the [Differences with Ethereum](https://docs.zksync.io/build/developer-reference/ethereum-differences/libraries).

[The LLVM IR generator code](https://github.com/matter-labs/era-compiler-solidity/blob/main/src/yul/parser/statement/expression/function_call/mod.rs#L956).

### memoryguard <a href="#memoryguard" id="memoryguard"></a>

Original [Yul](https://docs.soliditylang.org/en/latest/yul.html#memoryguard) auxiliary instruction.

Is a Yul optimizer hint which is not used by our compiler. Instead, its only argument is simply unwrapped and returned.

[The LLVM IR generator code](https://github.com/matter-labs/era-compiler-solidity/blob/main/src/yul/parser/statement/expression/function_call/mod.rs#L968).

### [verbatim](https://docs.zksync.io/zk-stack/components/compiler/specification/instructions/yul#verbatim) <a href="#verbatim" id="verbatim"></a>

Original [Yul](https://docs.soliditylang.org/en/latest/yul.html#verbatim) auxiliary instruction.

Unlike on EVM, on  Validium VM target this instruction has nothing to do with inserting of EVM bytecode. Instead, it is used to implement [ZKsync VM Yul Extensions](https://docs.zksync.io/zk-stack/components/compiler/specification/instructions#yul-extensions) available in the system mode. In order to compile a Yul contract with extensions, both Yul and system mode must be enabled (`zksolc --yul --system-mode ...`).

[The LLVM IR generator code](https://github.com/matter-labs/era-compiler-solidity/blob/main/src/yul/parser/statement/expression/function_call/verbatim.rs).

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://validium.gitbook.io/docs/components/compiler/specification/instructions/yul.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
