21 return op && op->
low() == low() && op->high() == high() && op->argument(0) == argument(0);
33 auto node = TryGetOwnerNode<SimpleNode>(*arg);
34 auto & arg_type = *std::dynamic_pointer_cast<const BitType>(arg->Type());
36 if ((low() == 0) && (high() == arg_type.nbits()))
39 if (is<BitSliceOperation>(node->GetOperation()))
42 if (is<BitConstantOperation>(node->GetOperation()))
45 if (is<BitConcatOperation>(node->GetOperation()))
59 auto & node = AssertGetOwnerNode<SimpleNode>(*arg);
70 std::string s(&op.value()[0] +
low(),
high() -
low());
76 size_t pos = 0, n = 0;
77 std::vector<jlm::rvsdg::Output *> arguments;
78 for (n = 0; n < node.ninputs(); n++)
80 auto argument = node.input(n)->origin();
82 size_t nbits = std::static_pointer_cast<const BitType>(
argument->Type())->nbits();
84 if (base <
high() && pos >
low())
86 size_t slice_low = (
low() > base) ? (
low() - base) : 0;
87 size_t slice_high = (
high() < pos) ? (
high() - base) : (pos - base);
99 std::unique_ptr<Operation>
102 return std::make_unique<BitSliceOperation>(*
this);
108 return CreateOpNode<BitSliceOperation>(
110 std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(argument->
Type()),
static Output & create(Region ®ion, BitValueRepresentation value)
unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *arg) const noexcept override
std::unique_ptr< Operation > copy() const override
~BitSliceOperation() noexcept override
jlm::rvsdg::Output * reduce_operand(unop_reduction_path_t path, jlm::rvsdg::Output *arg) const override
std::string debug_string() const override
size_t high() const noexcept
size_t low() const noexcept
rvsdg::Region * region() const noexcept
const std::shared_ptr< const rvsdg::Type > & Type() const noexcept
const std::shared_ptr< const rvsdg::Type > & argument(size_t index) const noexcept
size_t unop_reduction_path_t
jlm::rvsdg::Output * bitconcat(const std::vector< jlm::rvsdg::Output * > &operands)
static const unop_reduction_path_t unop_reduction_idempotent
static const unop_reduction_path_t unop_reduction_constant
static const unop_reduction_path_t unop_reduction_narrow
static const unop_reduction_path_t unop_reduction_none
static const unop_reduction_path_t unop_reduction_distribute
jlm::rvsdg::Output * bitslice(jlm::rvsdg::Output *argument, size_t low, size_t high)
Create bitslice.
static std::string strfmt(Args... args)