Jlm
concat.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014 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 
7 #ifndef JLM_RVSDG_BITSTRING_CONCAT_HPP
8 #define JLM_RVSDG_BITSTRING_CONCAT_HPP
9 
10 #include <jlm/rvsdg/binary.hpp>
12 #include <jlm/rvsdg/node.hpp>
13 
14 #include <vector>
15 
16 namespace jlm::rvsdg
17 {
18 
19 class BitConcatOperation final : public BinaryOperation
20 {
21 public:
22  ~BitConcatOperation() noexcept override;
23 
24  explicit BitConcatOperation(const std::vector<std::shared_ptr<const BitType>> types)
25  : BinaryOperation({ types.begin(), types.end() }, aggregate_arguments(types))
26  {}
27 
28  bool
29  operator==(const Operation & other) const noexcept override;
30 
33  const noexcept override;
34 
38  jlm::rvsdg::Output * arg1,
39  jlm::rvsdg::Output * arg2) const override;
40 
42  flags() const noexcept override;
43 
44  [[nodiscard]] std::string
45  debug_string() const override;
46 
47  [[nodiscard]] std::unique_ptr<Operation>
48  copy() const override;
49 
50 private:
51  static std::shared_ptr<const BitType>
52  aggregate_arguments(const std::vector<std::shared_ptr<const BitType>> & types) noexcept;
53 };
54 
55 jlm::rvsdg::Output *
56 bitconcat(const std::vector<jlm::rvsdg::Output *> & operands);
57 
58 std::optional<std::vector<rvsdg::Output *>>
60  const BitConcatOperation & operation,
61  const std::vector<rvsdg::Output *> & operands);
62 
63 }
64 
65 #endif
std::string debug_string() const override
Definition: concat.cpp:131
static std::shared_ptr< const BitType > aggregate_arguments(const std::vector< std::shared_ptr< const BitType >> &types) noexcept
Definition: concat.cpp:26
enum BinaryOperation::flags flags() const noexcept override
Definition: concat.cpp:125
BitConcatOperation(const std::vector< std::shared_ptr< const BitType >> types)
Definition: concat.hpp:24
binop_reduction_path_t can_reduce_operand_pair(const jlm::rvsdg::Output *arg1, const jlm::rvsdg::Output *arg2) const noexcept override
Definition: concat.cpp:56
std::unique_ptr< Operation > copy() const override
Definition: concat.cpp:137
bool operator==(const Operation &other) const noexcept override
Definition: concat.cpp:40
jlm::rvsdg::Output * reduce_operand_pair(binop_reduction_path_t path, jlm::rvsdg::Output *arg1, jlm::rvsdg::Output *arg2) const override
Definition: concat.cpp:94
~BitConcatOperation() noexcept override
size_t binop_reduction_path_t
Definition: binary.hpp:19
std::optional< std::vector< rvsdg::Output * > > FlattenBitConcatOperation(const BitConcatOperation &, const std::vector< rvsdg::Output * > &operands)
Definition: concat.cpp:154
jlm::rvsdg::Output * bitconcat(const std::vector< jlm::rvsdg::Output * > &operands)
Definition: concat.cpp:16
static std::vector< jlm::rvsdg::Output * > operands(const Node *node)
Definition: node.hpp:1049