MimIR
0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
normalize.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
mim/def.h
"
4
5
namespace
mim
{
6
7
/// Utility class when folding constants in normalizers.
8
class
Res
{
9
public
:
10
Res
()
11
: data_{} {}
12
template
<
class
T>
13
Res
(T val)
14
: data_(
mim
::
bitcast
<
u64
>(val)) {}
15
16
constexpr
const
u64
&
operator*
() const& {
return
*data_; }
17
constexpr
u64
&
operator*
() & {
return
*data_; }
18
explicit
operator
bool
()
const
{
return
data_.has_value(); }
19
20
private
:
21
std::optional<u64> data_;
22
};
23
24
}
// namespace mim
mim::Res::operator*
constexpr u64 & operator*() &
Definition
normalize.h:17
mim::Res::Res
Res()
Definition
normalize.h:10
mim::Res::operator*
constexpr const u64 & operator*() const &
Definition
normalize.h:16
mim::Res::Res
Res(T val)
Definition
normalize.h:13
def.h
bool
mim
Definition
ast.h:14
mim::bitcast
D bitcast(const S &src)
A bitcast from src of type S to D.
Definition
util.h:23
mim::u64
uint64_t u64
Definition
types.h:34
include
mim
normalize.h
Generated by
1.13.2