swamp_code_gen/
block.rs

1/*
2 * Copyright (c) Peter Bjorklund. All rights reserved. https://github.com/swamp/swamp
3 * Licensed under the MIT License. See LICENSE in the project root for license information.
4 */
5use crate::code_bld::CodeBuilder;
6use source_map_node::Node;
7use swamp_vm_types::MemoryLocation;
8
9impl CodeBuilder<'_> {
10    pub fn emit_block_copy_with_size_from_location(
11        &mut self,
12        destination_location: &MemoryLocation,
13        source_location: &MemoryLocation,
14        node: &Node,
15        comment: &str,
16    ) {
17        let dest_pointer_location = self.emit_compute_effective_address_from_location_to_register(
18            destination_location,
19            node,
20            "flatten destination location for block copy",
21        );
22        let source_pointer_location = self
23            .emit_compute_effective_address_from_location_to_register(
24                source_location,
25                node,
26                "flatten source location for block copy",
27            );
28        self.builder.add_block_copy_with_immediate_size(
29            &dest_pointer_location,
30            &source_pointer_location,
31            source_location.ty.basic_type.total_size,
32            node,
33            comment,
34        );
35    }
36}