7#ifndef JLM_RVSDG_BITSTRING_VALUE_REPRESENTATION_HPP
8#define JLM_RVSDG_BITSTRING_VALUE_REPRESENTATION_HPP
41 throw util::Error(
"Value cannot be represented with the given number of bits.");
45 data_.push_back(
'0' + (value & 1));
57 if (
s[
n] !=
'0' &&
s[
n] !=
'1' &&
s[
n] !=
'X' &&
s[
n] !=
'D')
65 if (
c !=
'0' &&
c !=
'1' &&
c !=
'X' &&
c !=
'D')
199 add(
char a,
char b,
char c)
const noexcept
223 for (
size_t n = 0;
n <
nbits();
n++)
225 remainder = remainder.
shl(1);
299 return !(*
this ==
other);
320 for (
size_t n = 0;
n <
other.size();
n++)
332 return !(*
this ==
other);
358 if (
bit ==
'X' ||
bit ==
'D')
368 return sign() ==
'1';
380 slice(
size_t low,
size_t high)
const
423 return std::string(
data_.begin(),
data_.end());
440 for (
size_t n = 1;
n <
nbits();
n++)
463 for (
size_t n = 0;
n <
nbits();
n++)
486 for (
size_t n = 0;
n <
nbits();
n++)
530 for (
size_t n = 0;
n <
nbits();
n++)
547 for (
size_t n = 0;
n <
nbits();
n++)
561 for (
size_t n = 0;
n <
nbits();
n++)
575 for (
size_t n = 0;
n <
nbits();
n++)
592 for (
size_t n = 0;
n <
nbits();
n++)
673 remainder = remainder.
neg();
696 remainder = remainder.
neg();
BitValueRepresentation shl(size_t shift) const
void udiv(const BitValueRepresentation &divisor, BitValueRepresentation "ient, BitValueRepresentation &remainder) const
BitValueRepresentation & operator=(const BitValueRepresentation &other)
BitValueRepresentation(const char c)
BitValueRepresentation land(const BitValueRepresentation &other) const
BitValueRepresentation smod(const BitValueRepresentation &other) const
BitValueRepresentation(const char *s)
BitValueRepresentation sext(size_t nbits) const
BitValueRepresentation(const BitValueRepresentation &other)
void mul(const BitValueRepresentation &factor1, const BitValueRepresentation &factor2, BitValueRepresentation &product) const
size_t nbits() const noexcept
static BitValueRepresentation create(const std::vector< BitValueRepresentation > &bitValues)
char sgt(const BitValueRepresentation &other) const
char sge(const BitValueRepresentation &other) const
BitValueRepresentation mul(const BitValueRepresentation &other) const
BitValueRepresentation sdiv(const BitValueRepresentation &other) const
bool operator==(int64_t value) const
char ne(const BitValueRepresentation &other) const
bool is_defined() const noexcept
char ule(const BitValueRepresentation &other) const
bool operator==(const std::string &other) const noexcept
BitValueRepresentation trunc(const size_t numBits) const
BitValueRepresentation & operator=(BitValueRepresentation &&other)
char ult(const BitValueRepresentation &other) const
BitValueRepresentation neg() const
BitValueRepresentation umulh(const BitValueRepresentation &other) const
char carry(char a, char b, char c) const noexcept
char lor(char a, char b) const noexcept
char sign() const noexcept
BitValueRepresentation()=default
bool operator!=(const std::string &other) const noexcept
bool operator==(const BitValueRepresentation &other) const noexcept
char ugt(const BitValueRepresentation &other) const
BitValueRepresentation concat(const BitValueRepresentation &other) const
std::vector< char > data_
char eq(const BitValueRepresentation &other) const
BitValueRepresentation(size_t nbits, int64_t value)
bool operator!=(const BitValueRepresentation &other) const noexcept
char lxor(char a, char b) const noexcept
BitValueRepresentation lxor(const BitValueRepresentation &other) const
BitValueRepresentation sub(const BitValueRepresentation &other) const
void Append(const BitValueRepresentation &other)
BitValueRepresentation lor(const BitValueRepresentation &other) const
char slt(const BitValueRepresentation &other) const
BitValueRepresentation ashr(size_t shift) const
BitValueRepresentation(BitValueRepresentation &&other)
BitValueRepresentation zext(size_t nbits) const
BitValueRepresentation udiv(const BitValueRepresentation &other) const
static BitValueRepresentation repeat(size_t nbits, char bit)
BitValueRepresentation shr(size_t shift) const
bool operator!=(int64_t value) const
char & operator[](size_t n)
BitValueRepresentation umod(const BitValueRepresentation &other) const
BitValueRepresentation slice(size_t low, size_t high) const
BitValueRepresentation smulh(const BitValueRepresentation &other) const
bool is_negative() const noexcept
BitValueRepresentation lnot() const
char sle(const BitValueRepresentation &other) const
char land(char a, char b) const noexcept
const char & operator[](size_t n) const
BitValueRepresentation add(const BitValueRepresentation &other) const
char uge(const BitValueRepresentation &other) const
char lnot(char a) const noexcept
char add(char a, char b, char c) const noexcept
bool is_known() const noexcept
NodeType * TryGetOwnerNode(const rvsdg::Input &input) noexcept
Checks if this is an input to a node of specified type.
static std::string strfmt(Args... args)