Jlm
StdLibIntrinsicOperations.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 
68 
69 bool
70 MemSetNonVolatileOperation::operator==(const Operation & other) const noexcept
71 {
72  const auto operation = dynamic_cast<const MemSetNonVolatileOperation *>(&other);
73  return operation && operation->lengthType() == lengthType()
74  && operation->numMemoryStates() == numMemoryStates();
75 }
76 
77 std::string
79 {
80  return "MemSet";
81 }
82 
83 std::unique_ptr<rvsdg::Operation>
85 {
86  return std::make_unique<MemSetNonVolatileOperation>(*this);
87 }
88 
89 size_t
91 {
92  return nresults();
93 }
94 
95 }
std::unique_ptr< Operation > copy() const override
size_t NumMemoryStates() const noexcept override
bool operator==(const Operation &other) const noexcept override
const rvsdg::BitType & LengthType() const noexcept
std::unique_ptr< Operation > copy() const override
~MemCpyVolatileOperation() noexcept override
size_t NumMemoryStates() const noexcept override
size_t numMemoryStates() const noexcept override
~MemSetNonVolatileOperation() noexcept override
std::unique_ptr< Operation > copy() const override
const rvsdg::BitType & lengthType() const noexcept
size_t nresults() const noexcept
Definition: operation.cpp:30
Global memory state passed between functions.