Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 4 additions & 26 deletions crates/cli/src/emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,15 +587,10 @@ fn write_evm_ir_dump_contract(
if dump.kinds.contains(&DumpKind::EvmIr) {
writeln!(writer, "// === {name} (creation) ===")
.map_err(|e| gcx.sess.dcx.err(format!("failed to write to output: {e}")).emit())?;
write_highlighted(
writer,
format_deployment_evm_ir(
artifact.deployment_evm_ir.as_ref(),
artifact.runtime_evm_ir.as_ref(),
),
Syntax::Ir,
)
.map_err(|e| gcx.sess.dcx.err(format!("failed to write to output: {e}")).emit())?;
if let Some(deployment_evm_ir) = &artifact.deployment_evm_ir {
write_highlighted(writer, deployment_evm_ir.to_text().to_string(), Syntax::Ir)
.map_err(|e| gcx.sess.dcx.err(format!("failed to write to output: {e}")).emit())?;
}
}
if dump.kinds.contains(&DumpKind::EvmIrRuntime) {
writeln!(writer, "// === {name} (runtime) ===")
Expand Down Expand Up @@ -669,23 +664,6 @@ fn write_disassembly_dump_contract(
Ok(())
}

pub(crate) fn format_deployment_evm_ir(
deployment: Option<&ir::Module>,
runtime: Option<&ir::Module>,
) -> String {
use std::fmt::Write;

let mut output = String::new();
for (index, module) in deployment.into_iter().chain(runtime).enumerate() {
if index != 0 {
output.push('\n');
}
writeln!(output, "// === {} ===", module.name()).unwrap();
write!(output, "{}", module.to_text()).unwrap();
}
output
}

fn contract_hashes(gcx: Gcx<'_>, id: ContractId) -> Hashes {
let mut hashes = Hashes::default();
for function in gcx.interface_functions(id) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// === ROOT/tests/ui/codegen/lowering/constructor_internal_call.sol:ConstructorICall (creation) ===
// === ConstructorICall_deployment ===
@module ConstructorICall_deployment
bb0:
push 314
Expand Down Expand Up @@ -202,8 +201,7 @@ bb11:
codecopy
push 0
return

// === ConstructorICall_runtime ===
// === ROOT/tests/ui/codegen/lowering/constructor_internal_call.sol:ConstructorICall (runtime) ===
@module ConstructorICall_runtime
bb0:
callvalue
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/codegen/lowering/constructor_internal_call.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//@ revisions: mir evmir
//@[mir] compile-flags: -O none -Zdump=mir
//@[mir] filecheck: --check-prefix=MIR
//@[evmir] compile-flags: -Zdump=evm-ir --pretty-json
//@[evmir] compile-flags: -Zdump=evm-ir,evm-ir-runtime --pretty-json
//@[evmir] filecheck: --check-prefix=EVMIR

contract ConstructorICall {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// === ROOT/tests/ui/codegen/lowering/constructor_success_postlude.sol:ConstructorSuccessPostlude (creation) ===
// === ConstructorSuccessPostlude_deployment ===
@module ConstructorSuccessPostlude_deployment
bb0:
push 77
Expand Down Expand Up @@ -57,10 +56,3 @@ bb5 [cold]:
push 0
push 0
revert

// === ConstructorSuccessPostlude_runtime ===
@module ConstructorSuccessPostlude_runtime
bb0:
push 0
push 0
revert
45 changes: 0 additions & 45 deletions tests/ui/codegen/lowering/immutable_byte_patches.stdout
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// === ROOT/tests/ui/codegen/lowering/immutable_byte_patches.sol:ImmutableBytePatches (creation) ===
// === ImmutableBytePatches_deployment ===
@module ImmutableBytePatches_deployment
bb0:
push 174
Expand Down Expand Up @@ -85,47 +84,3 @@ bb6 [cold]:
push 0
push 0
revert

// === ImmutableBytePatches_runtime ===
@module ImmutableBytePatches_runtime
bb0:
callvalue
push bb3
jumpi
push 0
calldataload
push 224
shr
dup 1
push 0x57de26a4
sub
push bb3
jumpi
push_immutable 0, 1
push_immutable 2, 1
push 248
shl
push_immutable 1, 1
push 0
signextend
push 0
signextend
dup 3
push 128
mstore
swap 2
pop
dup 2
push 160
mstore
swap 1
pop
push 192
mstore
push 96
push 128
return
bb3 [cold]:
push 0
push 0
revert
2 changes: 1 addition & 1 deletion tests/ui/codegen/lowering/immutable_widths.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@compile-flags: -Zdump=evm-ir
//@compile-flags: -Zdump=evm-ir-runtime
//@filecheck:

type Tiny is uint16;
Expand Down
136 changes: 1 addition & 135 deletions tests/ui/codegen/lowering/immutable_widths.stdout
Original file line number Diff line number Diff line change
@@ -1,138 +1,4 @@
// === ROOT/tests/ui/codegen/lowering/immutable_widths.sol:ImmutableWidths (creation) ===
// === ImmutableWidths_deployment ===
@module ImmutableWidths_deployment
bb0:
push 377
codesize
sub
dup 1
push 377
push 416
codecopy
push 416
add
push 31
add
push 31
not
and
push 64
mstore
callvalue
push bb8
jumpi
push 416
dup 1
push 377
codesize
sub
add
push 192
dup 3
add
gt
push bb8
jumpi
dup 1
mload
push 8
shr
push bb8
jumpi
push 32
dup 2
add
mload
dup 1
push 1
signextend
sub
push bb8
jumpi
push 64
dup 2
add
mload
push 24
shl
push bb8
jumpi
push 96
dup 2
add
mload
push 160
shr
push bb8
jumpi
push 160
add
mload
push 16
shr
push bb8
jumpi
push 192
push 416
dup 2
mcopy
push 189
dup 1
push 188
push 0
codecopy
push 192
mload
push 20
mstore8
push 224
mload
push 22
mstore
push 256
mload
push 55
mstore
push 288
mload
push 96
shl
push 88
mload
push 0
not
push 160
shr
and
or
push 88
mstore
push 320
mload
push 109
mstore
push 352
mload
push 240
shl
push 142
mload
push 0
not
push 16
shr
and
or
push 142
mstore
push 0
return
bb8 [cold]:
push 0
push 0
revert

// === ImmutableWidths_runtime ===
// === ROOT/tests/ui/codegen/lowering/immutable_widths.sol:ImmutableWidths (runtime) ===
@module ImmutableWidths_runtime
bb0:
callvalue
Expand Down
Loading
Loading