Jlm
SpecializedArithmeticIntrinsicOperations.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2025 Nico Reißmann <nico.reissmann@gmail.com>
3  * See COPYING for terms of redistribution.
4  */
5 
6 #ifndef JLM_LLVM_IR_OPERATORS_SPECIALIZEDARITHMETICINTRINSICOPERATIONS_HPP
7 #define JLM_LLVM_IR_OPERATORS_SPECIALIZEDARITHMETICINTRINSICOPERATIONS_HPP
8 
9 #include <jlm/llvm/ir/tac.hpp>
10 #include <jlm/llvm/ir/types.hpp>
12 
13 namespace jlm::llvm
14 {
15 
23 {
24 public:
25  ~FMulAddIntrinsicOperation() noexcept override;
26 
27  explicit FMulAddIntrinsicOperation(const std::shared_ptr<const rvsdg::Type> & type)
28  : SimpleOperation({ type, type, type }, { type })
29  {
30  CheckType(type);
31  }
32 
33  bool
34  operator==(const Operation & other) const noexcept override;
35 
36  std::string
37  debug_string() const override;
38 
39  [[nodiscard]] std::unique_ptr<Operation>
40  copy() const override;
41 
42  static rvsdg::SimpleNode &
43  CreateNode(rvsdg::Output & multiplier, rvsdg::Output & multiplicand, rvsdg::Output & summand)
44  {
45  return rvsdg::CreateOpNode<FMulAddIntrinsicOperation>(
46  { &multiplier, &multiplicand, &summand },
47  multiplier.Type());
48  }
49 
50  static std::unique_ptr<ThreeAddressCode>
51  CreateTac(const Variable & multiplier, const Variable & multiplicand, const Variable & summand)
52  {
53  auto operation = std::make_unique<FMulAddIntrinsicOperation>(multiplier.Type());
54  return ThreeAddressCode::create(std::move(operation), { &multiplier, &multiplicand, &summand });
55  }
56 
57 private:
58  static void
59  CheckType(const std::shared_ptr<const rvsdg::Type> & type);
60 };
61 
62 }
63 
64 #endif // JLM_LLVM_IR_OPERATORS_SPECIALIZEDARITHMETICINTRINSICOPERATIONS_HPP
std::unique_ptr< Operation > copy() const override
static std::unique_ptr< ThreeAddressCode > CreateTac(const Variable &multiplier, const Variable &multiplicand, const Variable &summand)
static rvsdg::SimpleNode & CreateNode(rvsdg::Output &multiplier, rvsdg::Output &multiplicand, rvsdg::Output &summand)
static void CheckType(const std::shared_ptr< const rvsdg::Type > &type)
bool operator==(const Operation &other) const noexcept override
~FMulAddIntrinsicOperation() noexcept override
static std::unique_ptr< llvm::ThreeAddressCode > create(std::unique_ptr< rvsdg::SimpleOperation > operation, const std::vector< const Variable * > &operands)
Definition: tac.hpp:135
const std::shared_ptr< const jlm::rvsdg::Type > Type() const noexcept
Definition: variable.hpp:62
const std::shared_ptr< const rvsdg::Type > & Type() const noexcept
Definition: node.hpp:366
SimpleOperation(std::vector< std::shared_ptr< const jlm::rvsdg::Type >> operands, std::vector< std::shared_ptr< const jlm::rvsdg::Type >> results)
Definition: operation.hpp:61
Global memory state passed between functions.
static std::string type(const Node *n)
Definition: view.cpp:255