Jlm
Loading...
Searching...
No Matches
lambda.hpp
Go to the documentation of this file.
1/*
2 * Copyright 2018 Nico Reißmann <nico.reissmann@gmail.com>
3 * See COPYING for terms of redistribution.
4 */
5
6#ifndef JLM_LLVM_IR_OPERATORS_LAMBDA_HPP
7#define JLM_LLVM_IR_OPERATORS_LAMBDA_HPP
8
13#include <jlm/llvm/ir/types.hpp>
14#include <jlm/rvsdg/graph.hpp>
15#include <jlm/rvsdg/lambda.hpp>
19
20#include <utility>
21
22namespace jlm::llvm
23{
24
30{
31public:
33
35 std::shared_ptr<const jlm::rvsdg::FunctionType> type,
36 std::string name,
40
41 [[nodiscard]] const std::string &
42 name() const noexcept
43 {
44 return name_;
45 }
46
47 [[nodiscard]] const jlm::llvm::Linkage &
48 linkage() const noexcept
49 {
50 return linkage_;
51 }
52
53 [[nodiscard]] CallingConvention
54 callingConvention() const noexcept
55 {
56 return callingConvention_;
57 }
58
59 [[nodiscard]] const jlm::llvm::AttributeSet &
60 attributes() const noexcept
61 {
62 return attributes_;
63 }
64
65 [[nodiscard]] std::string
66 debug_string() const override;
67
68 bool
69 operator==(const Operation & other) const noexcept override;
70
71 [[nodiscard]] std::unique_ptr<Operation>
72 copy() const override;
73
74 [[nodiscard]] const jlm::llvm::AttributeSet &
75 GetArgumentAttributes(std::size_t index) const noexcept;
76
77 void
79
80 [[nodiscard]] static rvsdg::Output &
81 getIOStateArgument(const rvsdg::LambdaNode & lambdaNode) noexcept;
82
83 static std::unique_ptr<LlvmLambdaOperation>
85 std::shared_ptr<const jlm::rvsdg::FunctionType> type,
86 std::string name,
90 {
91 return std::make_unique<LlvmLambdaOperation>(
92 std::move(type),
93 std::move(name),
94 linkage,
96 std::move(attributes));
97 }
98
103 static std::unique_ptr<LlvmLambdaOperation>
105 std::shared_ptr<const jlm::rvsdg::FunctionType> type,
106 std::string name,
108 {
109 return std::make_unique<LlvmLambdaOperation>(
110 std::move(type),
111 std::move(name),
112 linkage,
115 }
116
117private:
118 std::string name_;
122 std::vector<jlm::llvm::AttributeSet> ArgumentAttributes_;
123};
124
125}
126
127#endif
std::unique_ptr< Operation > copy() const override
Definition lambda.cpp:45
static std::unique_ptr< LlvmLambdaOperation > Create(std::shared_ptr< const jlm::rvsdg::FunctionType > type, std::string name, const jlm::llvm::Linkage &linkage)
Definition lambda.hpp:104
std::vector< jlm::llvm::AttributeSet > ArgumentAttributes_
Definition lambda.hpp:122
CallingConvention callingConvention() const noexcept
Definition lambda.hpp:54
static rvsdg::Output & getIOStateArgument(const rvsdg::LambdaNode &lambdaNode) noexcept
Definition lambda.cpp:67
static std::unique_ptr< LlvmLambdaOperation > Create(std::shared_ptr< const jlm::rvsdg::FunctionType > type, std::string name, const jlm::llvm::Linkage &linkage, jlm::llvm::CallingConvention callingConvention, jlm::llvm::AttributeSet attributes)
Definition lambda.hpp:84
std::string debug_string() const override
Definition lambda.cpp:31
jlm::llvm::AttributeSet attributes_
Definition lambda.hpp:121
jlm::llvm::CallingConvention callingConvention_
Definition lambda.hpp:120
void SetArgumentAttributes(std::size_t index, const jlm::llvm::AttributeSet &attributes)
Definition lambda.cpp:58
const jlm::llvm::Linkage & linkage() const noexcept
Definition lambda.hpp:48
bool operator==(const Operation &other) const noexcept override
Definition lambda.cpp:37
const jlm::llvm::AttributeSet & attributes() const noexcept
Definition lambda.hpp:60
const jlm::llvm::AttributeSet & GetArgumentAttributes(std::size_t index) const noexcept
Definition lambda.cpp:51
jlm::llvm::Linkage linkage_
Definition lambda.hpp:119
const std::string & name() const noexcept
Definition lambda.hpp:42
Lambda operation.
Definition lambda.hpp:29
const FunctionType & type() const noexcept
Definition lambda.hpp:36
Global memory state passed between functions.