mini-llvm 0.1.0
Loading...
Searching...
No Matches
Argument.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2
3#pragma once
4
5#include <cstdlib>
6#include <memory>
7#include <string>
8#include <utility>
9
10#include "mini-llvm/ir/Type.h"
11#include "mini-llvm/ir/Value.h"
12
13namespace mini_llvm::ir {
14
15class Argument final : public Value {
16public:
17 explicit Argument(std::unique_ptr<Type> type) : type_(std::move(type)) {}
18
19 std::unique_ptr<Type> type() const override {
20 return type_->clone();
21 }
22
23 std::string format() const override {
24 abort();
25 }
26
27 std::string formatAsOperand() const override {
28 return "%" + formatName();
29 }
30
31 std::unique_ptr<Value> clone() const override {
32 abort();
33 }
34
35private:
36 std::unique_ptr<Type> type_;
37};
38
39} // namespace mini_llvm::ir
std::string formatAsOperand() const override
Definition Argument.h:27
std::unique_ptr< Value > clone() const override
Definition Argument.h:31
std::unique_ptr< Type > type() const override
Definition Argument.h:19
Argument(std::unique_ptr< Type > type)
Definition Argument.h:17
std::string format() const override
Definition Argument.h:23
std::string formatName() const
Definition Argument.h:13