Jlm
Loading...
Searching...
No Matches
arithmetic-impl.hpp
Go to the documentation of this file.
1/*
2 * Copyright 2024 Helge Bahmann <hcb@chaoticmind.net>
3 * See COPYING for terms of redistribution.
4 */
5
6#ifndef JLM_RVSDG_BITSTRING_ARITHMETIC_IMPL_HPP
7#define JLM_RVSDG_BITSTRING_ARITHMETIC_IMPL_HPP
8
11
12namespace jlm::rvsdg
13{
14
15template<typename reduction, const char * name>
18
19template<typename reduction, const char * name>
20bool
22{
23 auto op = dynamic_cast<const MakeBitUnaryOperation *>(&other);
24 return op && op->type() == type();
25}
26
27template<typename reduction, const char * name>
30{
31 return reduction{}(arg);
32}
33
34template<typename reduction, const char * name>
35std::string
37{
38 return jlm::util::strfmt(name, type().nbits());
39}
40
41template<typename reduction, const char * name>
42std::unique_ptr<Operation>
44{
45 return std::make_unique<MakeBitUnaryOperation>(*this);
46}
47
48template<typename reduction, const char * name>
49std::unique_ptr<BitUnaryOperation>
51{
52 return std::make_unique<MakeBitUnaryOperation>(nbits);
53}
54
55template<typename reduction, const char * name, enum BinaryOperation::flags opflags>
58
59template<typename reduction, const char * name, enum BinaryOperation::flags opflags>
60bool
62{
63 auto op = dynamic_cast<const MakeBitBinaryOperation *>(&other);
64 return op && op->type() == type();
65}
66
67template<typename reduction, const char * name, enum BinaryOperation::flags opflags>
75
76template<typename reduction, const char * name, enum BinaryOperation::flags opflags>
82
83template<typename reduction, const char * name, enum BinaryOperation::flags opflags>
84std::string
89
90template<typename reduction, const char * name, enum BinaryOperation::flags opflags>
91std::unique_ptr<Operation>
93{
94 return std::make_unique<MakeBitBinaryOperation>(*this);
95}
96
97template<typename reduction, const char * name, enum BinaryOperation::flags opflags>
98std::unique_ptr<BitBinaryOperation>
100{
101 return std::make_unique<MakeBitBinaryOperation>(nbits);
102}
103
104}
105
106#endif
const BitType & type() const noexcept
const BitType & type() const noexcept
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
bool operator==(const Operation &other) const noexcept override
~MakeBitBinaryOperation() noexcept override
BitValueRepresentation reduce_constants(const BitValueRepresentation &arg1, const BitValueRepresentation &arg2) const override
enum BinaryOperation::flags flags() const noexcept override
std::unique_ptr< BitBinaryOperation > create(size_t nbits) const override
~MakeBitUnaryOperation() noexcept override
BitValueRepresentation reduce_constant(const BitValueRepresentation &arg) const override
std::unique_ptr< BitUnaryOperation > create(size_t nbits) const override
bool operator==(const Operation &other) const noexcept override
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
NodeType * TryGetOwnerNode(const rvsdg::Input &input) noexcept
Checks if this is an input to a node of specified type.
Definition node.hpp:872
static std::string strfmt(Args... args)
Definition strfmt.hpp:35