Jlm
Loading...
Searching...
No Matches
arithmetic.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2014 2015 2024 Helge Bahmann <hcb@chaoticmind.net>
3 * Copyright 2011 2012 2013 2014 Nico Reißmann <nico.reissmann@gmail.com>
4 * See COPYING for terms of redistribution.
5 */
6
10
11namespace jlm::rvsdg
12{
13
14// This provides the explicit template instantiations underlying
15// all bitstring operation classes: This ensures that there is a
16// single definition for all virtual functions, vmts etc in the
17// rvsdg library (instead of the compiler template-instantiating
18// them multiple times in each translation unit, and then relying
19// on linker to do de-duplication).
20
22{
25 {
26 return arg.neg();
27 }
28};
29
30const char BitNegateLabel[] = "BitNegate";
32
34{
37 {
38 return arg.lnot();
39 }
40};
41
42const char BitNotLabel[] = "BitNot";
44
46{
49 {
50 return arg1.add(arg2);
51 }
52};
53
54const char BitAddLabel[] = "BitAdd";
55template class MakeBitBinaryOperation<
59
61{
64 {
65 return arg1.land(arg2);
66 }
67};
68
69const char BitAndLabel[] = "BitAnd";
70template class MakeBitBinaryOperation<
74
76{
79 {
80 return arg1.ashr(arg2.to_uint());
81 }
82};
83
84const char BitAShrLabel[] = "BitAShr";
86
88{
91 {
92 return arg1.mul(arg2);
93 }
94};
95
96const char BitMulLabel[] = "BitMul";
97template class MakeBitBinaryOperation<
101
103{
106 {
107 return arg1.lor(arg2);
108 }
109};
110
111const char BitOrLabel[] = "BitOr";
112template class MakeBitBinaryOperation<
113 reduce_or,
116
118{
121 {
122 return arg1.sdiv(arg2);
123 }
124};
125
126const char BitSDivLabel[] = "BitSDiv";
128
130{
133 {
134 return arg1.shl(arg2.to_uint());
135 }
136};
137
138const char BitShlLabel[] = "BitShl";
140
142{
145 {
146 return arg1.shr(arg2.to_uint());
147 }
148};
149
150const char BitShrLabel[] = "BitShr";
152
154{
157 {
158 return arg1.smod(arg2);
159 }
160};
161
162const char BitSModLabel[] = "BitSMod";
164
166{
169 {
170 return arg1.smulh(arg2);
171 }
172};
173
174const char BitSMulHLabel[] = "BitSMulH";
175template class MakeBitBinaryOperation<
179
181{
184 {
185 return arg1.sub(arg2);
186 }
187};
188
189const char BitSubLabel[] = "BitSub";
191
193{
196 {
197 return arg1.udiv(arg2);
198 }
199};
200
201const char BitUDivLabel[] = "BitUDiv";
203
205{
208 {
209 return arg1.umod(arg2);
210 }
211};
212
213const char BitUModLabel[] = "BitUMod";
215
217{
220 {
221 return arg1.umulh(arg2);
222 }
223};
224
225const char BitUMulHLabel[] = "BitUMulH";
226template class MakeBitBinaryOperation<
230
232{
235 {
236 return arg1.lxor(arg2);
237 }
238};
239
240const char BitXorLabel[] = "BitXor";
241template class MakeBitBinaryOperation<
245
246}
BitValueRepresentation shl(size_t shift) const
void udiv(const BitValueRepresentation &divisor, BitValueRepresentation &quotient, BitValueRepresentation &remainder) const
BitValueRepresentation smod(const BitValueRepresentation &other) const
void mul(const BitValueRepresentation &factor1, const BitValueRepresentation &factor2, BitValueRepresentation &product) const
BitValueRepresentation sdiv(const BitValueRepresentation &other) const
BitValueRepresentation neg() const
BitValueRepresentation umulh(const BitValueRepresentation &other) const
char lor(char a, char b) const noexcept
char lxor(char a, char b) const noexcept
BitValueRepresentation sub(const BitValueRepresentation &other) const
BitValueRepresentation ashr(size_t shift) const
BitValueRepresentation shr(size_t shift) const
BitValueRepresentation umod(const BitValueRepresentation &other) const
BitValueRepresentation smulh(const BitValueRepresentation &other) const
char land(char a, char b) const noexcept
char add(char a, char b, char c) const noexcept
const char BitOrLabel[]
const char BitNegateLabel[]
const char BitSMulHLabel[]
const char BitAndLabel[]
const char BitShrLabel[]
const char BitAShrLabel[]
const char BitSDivLabel[]
const char BitUDivLabel[]
const char BitShlLabel[]
const char BitUModLabel[]
const char BitNotLabel[]
const char BitMulLabel[]
const char BitXorLabel[]
const char BitUMulHLabel[]
const char BitSubLabel[]
const char BitAddLabel[]
NodeType * TryGetOwnerNode(const rvsdg::Input &input) noexcept
Checks if this is an input to a node of specified type.
Definition node.hpp:872
const char BitSModLabel[]
BitValueRepresentation operator()(const BitValueRepresentation &arg1, const BitValueRepresentation &arg2) const
BitValueRepresentation operator()(const BitValueRepresentation &arg1, const BitValueRepresentation &arg2) const
BitValueRepresentation operator()(const BitValueRepresentation &arg1, const BitValueRepresentation &arg2) const
BitValueRepresentation operator()(const BitValueRepresentation &arg1, const BitValueRepresentation &arg2) const
BitValueRepresentation operator()(const BitValueRepresentation &arg) const
BitValueRepresentation operator()(const BitValueRepresentation &arg) const
BitValueRepresentation operator()(const BitValueRepresentation &arg1, const BitValueRepresentation &arg2) const
BitValueRepresentation operator()(const BitValueRepresentation &arg1, const BitValueRepresentation &arg2) const
BitValueRepresentation operator()(const BitValueRepresentation &arg1, const BitValueRepresentation &arg2) const
BitValueRepresentation operator()(const BitValueRepresentation &arg1, const BitValueRepresentation &arg2) const
BitValueRepresentation operator()(const BitValueRepresentation &arg1, const BitValueRepresentation &arg2) const
BitValueRepresentation operator()(const BitValueRepresentation &arg1, const BitValueRepresentation &arg2) const
BitValueRepresentation operator()(const BitValueRepresentation &arg1, const BitValueRepresentation &arg2) const
BitValueRepresentation operator()(const BitValueRepresentation &arg1, const BitValueRepresentation &arg2) const
BitValueRepresentation operator()(const BitValueRepresentation &arg1, const BitValueRepresentation &arg2) const
BitValueRepresentation operator()(const BitValueRepresentation &arg1, const BitValueRepresentation &arg2) const
BitValueRepresentation operator()(const BitValueRepresentation &arg1, const BitValueRepresentation &arg2) const