MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
target.h
Go to the documentation of this file.
1#pragma once
2
3#include <string_view>
4
5#include "mim/util/types.h"
6
7namespace mim {
8
9/// The machine a native backend compiles for, as far as libmim needs to know it.
10/// A backend plugin registers its Target via Plugin::target; see Driver::target and mim::plug::mach::Target.
11class Target {
12public:
13 Target(std::string_view name)
14 : name_(name) {}
15 virtual ~Target() = default;
16
17 /// The plugin name, used as the prefix of diagnostics.
18 std::string_view name() const { return name_; }
19 /// The size and alignment of a pointer in bytes; see `core.trait`.
20 virtual nat_t ptr_size() const = 0;
21
22private:
23 std::string_view name_;
24};
25
26} // namespace mim
std::string_view name() const
The plugin name, used as the prefix of diagnostics.
Definition target.h:18
Target(std::string_view name)
Definition target.h:13
virtual nat_t ptr_size() const =0
The size and alignment of a pointer in bytes; see core.trait.
virtual ~Target()=default
Definition ast.h:16
u64 nat_t
Definition types.h:37