Jlm
Loading...
Searching...
No Matches
comparison-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_COMPARISON_IMPL_HPP
7#define JLM_RVSDG_BITSTRING_COMPARISON_IMPL_HPP
8
10
11namespace jlm::rvsdg
12{
13
14template<typename reduction, const char * name, enum BinaryOperation::flags opflags>
17
18template<typename reduction, const char * name, enum BinaryOperation::flags opflags>
19bool
21 const Operation & other) const noexcept
22{
24 return op && op->type() == type();
25}
26
27template<typename reduction, const char * name, enum BinaryOperation::flags opflags>
31 const BitValueRepresentation & arg2) const
32{
33 switch (reduction()(arg1, arg2))
34 {
35 case '0':
37 case '1':
39 default:
41 }
42}
43
44template<typename reduction, const char * name, enum BinaryOperation::flags opflags>
50
51template<typename reduction, const char * name, enum BinaryOperation::flags opflags>
52std::string
57
58template<typename reduction, const char * name, enum BinaryOperation::flags opflags>
59std::unique_ptr<Operation>
61{
62 return std::make_unique<MakeBitComparisonOperation>(*this);
63}
64
65template<typename reduction, const char * name, enum BinaryOperation::flags opflags>
66std::unique_ptr<BitCompareOperation>
68{
69 return std::make_unique<MakeBitComparisonOperation>(nbits);
70}
71
72}
73
74#endif
const BitType & type() const noexcept
enum BinaryOperation::flags flags() const noexcept override
std::string debug_string() const override
compare_result reduce_constants(const BitValueRepresentation &arg1, const BitValueRepresentation &arg2) const override
std::unique_ptr< BitCompareOperation > create(size_t nbits) const override
std::unique_ptr< Operation > copy() const override
bool operator==(const Operation &other) const noexcept 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