MimIR
0.6-dev
MimIR is my Intermediate Representation
Toggle main menu visibility
Loading...
Searching...
No Matches
insn.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
mim/axm.h
>
4
#include <
mim/lam.h
>
5
6
#include "
mim/plug/arm/autogen.h
"
7
8
/// Machine facts about the instructions of the `arm` plugin, shared by `arm_isel.gen` and the backend.
9
namespace
mim::plug::arm::insn
{
10
11
/// The latency in cycles of the instruction @p base, roughly as on recent cores.
12
inline
u32
latency
(
flags_t
base) {
13
if
(base ==
Annex::Base<mul>
|| base ==
Annex::Base<madd>
|| base ==
Annex::Base<fadd>
|| base ==
Annex::Base<fsub>
14
|| base ==
Annex::Base<fmul>
)
15
return
3;
16
if
(base ==
Annex::Base<udiv>
|| base ==
Annex::Base<sdiv>
)
return
12;
17
if
(base ==
Annex::Base<fdiv>
)
return
11;
18
if
(base ==
Annex::Base<fsqrt>
)
return
14;
19
if
(base ==
Annex::Base<load>
|| base ==
Annex::Base<fload>
)
return
4;
20
return
1;
21
}
22
23
/// The cost of the instruction @p app: its latency plus one, so of two equally fast covers the shorter wins.
24
inline
u32
cost
(
const
App
* app) {
return
latency
(app->
axm
()->
base
()) + 1; }
25
26
}
// namespace mim::plug::arm::insn
autogen.h
axm.h
mim::App
Definition
lam.h:215
mim::App::axm
const Axm * axm() const
Definition
lam.h:257
mim::Axm::base
flags_t base() const
Definition
axm.h:62
lam.h
mim::plug::arm::insn
Machine facts about the instructions of the arm plugin, shared by arm_isel.gen and the backend.
Definition
insn.h:9
mim::plug::arm::insn::latency
u32 latency(flags_t base)
The latency in cycles of the instruction base, roughly as on recent cores.
Definition
insn.h:12
mim::plug::arm::insn::cost
u32 cost(const App *app)
The cost of the instruction app: its latency plus one, so of two equally fast covers the shorter wins...
Definition
insn.h:24
mim::flags_t
u64 flags_t
Definition
types.h:39
mim::u32
uint32_t u32
Definition
types.h:27
mim::Annex::Base
static constexpr flags_t Base
Definition
plugin.h:276
include
mim
plug
arm
insn.h
Generated by
1.18.0