Jlm
MemCpy.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2024 Nico Reißmann <nico.reissmann@gmail.com>
3  * See COPYING for terms of redistribution.
4  */
5 
7 
8 namespace jlm::llvm
9 {
10 
12 
13 bool
14 MemCpyNonVolatileOperation::operator==(const Operation & other) const noexcept
15 {
16  auto operation = dynamic_cast<const MemCpyNonVolatileOperation *>(&other);
17  return operation && operation->LengthType() == LengthType()
18  && operation->NumMemoryStates() == NumMemoryStates();
19 }
20 
21 std::string
23 {
24  return "MemCpy";
25 }
26 
27 std::unique_ptr<rvsdg::Operation>
29 {
30  return std::make_unique<MemCpyNonVolatileOperation>(*this);
31 }
32 
33 size_t
35 {
36  return nresults();
37 }
38 
40 
41 bool
42 MemCpyVolatileOperation::operator==(const Operation & other) const noexcept
43 {
44  // Avoid common node elimination for memcpy operator
45  return this == &other;
46 }
47 
48 std::string
50 {
51  return "MemCpyVolatile";
52 }
53 
54 std::unique_ptr<rvsdg::Operation>
56 {
57  return std::make_unique<MemCpyVolatileOperation>(*this);
58 }
59 
60 size_t
62 {
63  // Subtracting I/O state
64  return nresults() - 1;
65 }
66 
67 }
std::unique_ptr< Operation > copy() const override
Definition: MemCpy.cpp:28
std::string debug_string() const override
Definition: MemCpy.cpp:22
size_t NumMemoryStates() const noexcept override
Definition: MemCpy.cpp:34
bool operator==(const Operation &other) const noexcept override
Definition: MemCpy.cpp:14
const rvsdg::BitType & LengthType() const noexcept
Definition: MemCpy.hpp:54
std::string debug_string() const override
Definition: MemCpy.cpp:49
std::unique_ptr< Operation > copy() const override
Definition: MemCpy.cpp:55
~MemCpyVolatileOperation() noexcept override
size_t NumMemoryStates() const noexcept override
Definition: MemCpy.cpp:61
size_t nresults() const noexcept
Definition: operation.cpp:30
Global memory state passed between functions.