mini-llvm 0.1.0
Loading...
Searching...
No Matches
RISCVRegisterOperand.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2
3#pragma once
4
5#include <string>
6
9
10namespace mini_llvm::mc {
11
12class RISCVRegisterOperand final : public Operand {
13public:
14 explicit RISCVRegisterOperand(int idx) : idx_(idx) {}
15
16 int idx() const {
17 return idx_;
18 }
19
20 void setIdx(int idx) {
21 idx_ = idx;
22 }
23
24 std::string format() const override {
25 return name(static_cast<RISCVRegister>(idx()));
26 }
27
28private:
29 int idx_;
30};
31
32} // namespace mini_llvm::mc
std::string format() const override
Definition RISCVRegisterOperand.h:24
int idx() const
Definition RISCVRegisterOperand.h:16
void setIdx(int idx)
Definition RISCVRegisterOperand.h:20
RISCVRegisterOperand(int idx)
Definition RISCVRegisterOperand.h:14
Definition Directive.h:8
RISCVRegister
Definition RISCVRegister.h:9
constexpr const char * name(RISCVRegister reg)
Definition RISCVRegister.h:17