Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
thorin::plug::core Namespace Reference

The core Plugin More...

Enumerations

%core.mode
enum  mode : flags_t {
  us = 0x1104c60000000200 ,
  uS = 0x1104c60000000201 ,
  Us = 0x1104c60000000202 ,
  US = 0x1104c60000000203 ,
  nuw = 0x1104c60000000204 ,
  nsw = 0x1104c60000000205 ,
  nusw = 0x1104c60000000206
}
 
%core.minus
enum  minus : flags_t
 

Functions

void register_normalizers (Normalizers &normalizers)
 
extract_unsafe
Ref extract_unsafe (Ref d, Ref i)
 
Ref extract_unsafe (Ref d, u64 i)
 
insert_unsafe
Ref insert_unsafe (Ref d, Ref i, Ref val)
 
Ref insert_unsafe (Ref d, u64 i, Ref val)
 
Convert TBound to Sigma

This is WIP.

template<bool up>
const Sigmaconvert (const TBound< up > *b)
 
const Sigmaconvert (const Bound *b)
 

Variables

static constexpr plugin_t Plugin_Id = 0x1104c60000000000
 

Mode

What should happen if Idx arithmetic overflows?

enum class  Mode : nat_t {
  none = 0 ,
  nsw = 1 << 0 ,
  nuw = 1 << 1 ,
  nusw = nuw | nsw
}
 
using VMode = std::variant< Mode, nat_t, Ref >
 Give Mode as thorin::plug::math::Mode, thorin::nat_t or Ref.
 
Ref mode (World &w, VMode m)
 thorin::plug::core::VMode -> Ref.
 

%core.nat

enum  nat : flags_t {
  add = 0x1104c60000000000 ,
  sub = 0x1104c60000000001 ,
  mul = 0x1104c60000000002
}
 
template<nat id>
Ref normalize_nat (Ref type, Ref callee, Ref arg)
 

%core.ncmp

enum  ncmp : flags_t {
  gle = 0x1104c60000000100 ,
  f = gle ,
  glE = 0x1104c60000000101 ,
  e = glE ,
  gLe = 0x1104c60000000102 ,
  l = gLe ,
  gLE = 0x1104c60000000103 ,
  le = gLE ,
  Gle = 0x1104c60000000104 ,
  g = Gle ,
  GlE = 0x1104c60000000105 ,
  ge = GlE ,
  GLe = 0x1104c60000000106 ,
  ne = GLe ,
  GLE = 0x1104c60000000107 ,
  t = GLE
}
 
template<ncmp id>
Ref normalize_ncmp (Ref type, Ref callee, Ref arg)
 

%core.idx

enum  idx : flags_t
 
Ref normalize_idx (Ref type, Ref c, Ref arg)
 

%core.bit1

enum  bit1 : flags_t {
  f = gle ,
  neg = 0x1104c60000000401 ,
  id = 0x1104c60000000402 ,
  t = GLE
}
 
template<bit1 id>
Ref normalize_bit1 (Ref type, Ref c, Ref a)
 

%core.bit2

enum  bit2 : flags_t {
  f = gle ,
  nor = 0x1104c60000000501 ,
  nciff = 0x1104c60000000502 ,
  nfst = 0x1104c60000000503 ,
  niff = 0x1104c60000000504 ,
  nsnd = 0x1104c60000000505 ,
  xor_ = 0x1104c60000000506 ,
  nand = 0x1104c60000000507 ,
  and_ = 0x1104c60000000508 ,
  nxor = 0x1104c60000000509 ,
  snd = 0x1104c6000000050a ,
  iff = 0x1104c6000000050b ,
  fst = 0x1104c6000000050c ,
  ciff = 0x1104c6000000050d ,
  or_ = 0x1104c6000000050e ,
  t = GLE
}
 
constexpr std::array< std::array< u64, 2 >, 2 > make_truth_table (bit2 id)
 Use like this: a op b = tab[a][b]
 
template<bit2 id>
Ref normalize_bit2 (Ref type, Ref c, Ref arg)
 

%core.shr

enum  shr : flags_t {
  a = 0x1104c60000000600 ,
  l = gLe
}
 
template<shr id>
Ref normalize_shr (Ref type, Ref c, Ref arg)
 

%core.wrap

enum  wrap : flags_t {
  add = 0x1104c60000000000 ,
  sub = 0x1104c60000000001 ,
  mul = 0x1104c60000000002 ,
  shl = 0x1104c60000000703
}
 
template<wrap id>
Ref normalize_wrap (Ref type, Ref c, Ref arg)
 

%core.div

enum  div : flags_t {
  sdiv = 0x1104c60000000900 ,
  udiv = 0x1104c60000000901 ,
  srem = 0x1104c60000000902 ,
  urem = 0x1104c60000000903
}
 
template<div id>
Ref normalize_div (Ref full_type, Ref c, Ref arg)
 

%core.icmp

enum  icmp : flags_t {
  xygle = 0x1104c60000000a00 ,
  f = gle ,
  xyglE = 0x1104c60000000a01 ,
  e = glE ,
  xygLe = 0x1104c60000000a02 ,
  xygLE = 0x1104c60000000a03 ,
  xyGle = 0x1104c60000000a04 ,
  xyGlE = 0x1104c60000000a05 ,
  xyGLe = 0x1104c60000000a06 ,
  xyGLE = 0x1104c60000000a07 ,
  xYgle = 0x1104c60000000a08 ,
  xYglE = 0x1104c60000000a09 ,
  xYgLe = 0x1104c60000000a0a ,
  sl = xYgLe ,
  xYgLE = 0x1104c60000000a0b ,
  sle = xYgLE ,
  xYGle = 0x1104c60000000a0c ,
  ug = xYGle ,
  xYGlE = 0x1104c60000000a0d ,
  uge = xYGlE ,
  xYGLe = 0x1104c60000000a0e ,
  xYGLE = 0x1104c60000000a0f ,
  Xygle = 0x1104c60000000a10 ,
  XyglE = 0x1104c60000000a11 ,
  XygLe = 0x1104c60000000a12 ,
  ul = XygLe ,
  XygLE = 0x1104c60000000a13 ,
  ule = XygLE ,
  XyGle = 0x1104c60000000a14 ,
  sg = XyGle ,
  XyGlE = 0x1104c60000000a15 ,
  sge = XyGlE ,
  XyGLe = 0x1104c60000000a16 ,
  XyGLE = 0x1104c60000000a17 ,
  XYgle = 0x1104c60000000a18 ,
  XYglE = 0x1104c60000000a19 ,
  XYgLe = 0x1104c60000000a1a ,
  XYgLE = 0x1104c60000000a1b ,
  XYGle = 0x1104c60000000a1c ,
  XYGlE = 0x1104c60000000a1d ,
  XYGLe = 0x1104c60000000a1e ,
  ne = GLe ,
  XYGLE = 0x1104c60000000a1f ,
  t = GLE
}
 
template<icmp id>
Ref normalize_icmp (Ref type, Ref c, Ref arg)
 

%core.extrema

enum  extrema : flags_t {
  sm = 0x1104c60000000b00 ,
  umin = sm ,
  sM = 0x1104c60000000b01 ,
  umax = sM ,
  Sm = 0x1104c60000000b02 ,
  smin = Sm ,
  SM = 0x1104c60000000b03 ,
  smax = SM
}
 
template<extrema id>
Ref normalize_extrema (Ref type, Ref c, Ref arg)
 

%core.abs

enum  abs : flags_t
 
Ref normalize_abs (Ref type, Ref c, Ref arg)
 

%core.conv

enum  conv : flags_t {
  s = 0x1104c60000000d00 ,
  u = 0x1104c60000000d01
}
 
template<conv id>
Ref normalize_conv (Ref dst_t, Ref c, Ref x)
 

%core.bitcast

enum  bitcast : flags_t
 
Ref normalize_bitcast (Ref dst_t, Ref callee, Ref src)
 

%core.trait

enum  trait : flags_t {
  size = 0x1104c60000000f00 ,
  align = 0x1104c60000000f01
}
 
Ref op (trait o, Ref type)
 
template<trait id>
Ref normalize_trait (Ref nat, Ref callee, Ref type)
 

%core.pe

enum  pe : flags_t {
  hlt = 0x1104c60000001000 ,
  run = 0x1104c60000001001 ,
  known = 0x1104c60000001002
}
 
Ref op (pe o, Ref def)
 
template<pe id>
Ref normalize_pe (Ref type, Ref callee, Ref arg)
 

%core.zip

enum  zip : flags_t
 
Ref normalize_zip (Ref type, Ref c, Ref arg)
 

Detailed Description

Typedef Documentation

◆ VMode

using thorin::plug::core::VMode = typedef std::variant<Mode, nat_t, Ref>

Give Mode as thorin::plug::math::Mode, thorin::nat_t or Ref.

Definition at line 23 of file core.h.

Enumeration Type Documentation

◆ abs

Definition at line 293 of file autogen.h.

◆ bit1

Enumerator
neg 
id 

Definition at line 95 of file autogen.h.

◆ bit2

Enumerator
nor 
nciff 
nfst 
niff 
nsnd 
xor_ 
nand 
and_ 
nxor 
snd 
iff 
fst 
ciff 
or_ 

Definition at line 114 of file autogen.h.

◆ bitcast

Definition at line 322 of file autogen.h.

◆ conv

Enumerator

Definition at line 305 of file autogen.h.

◆ div

Enumerator
sdiv 
udiv 
srem 
urem 

Definition at line 192 of file autogen.h.

◆ extrema

Enumerator
sm 
umin 
sM 
umax 
Sm 
smin 
SM 
smax 

Definition at line 270 of file autogen.h.

◆ icmp

Enumerator
xygle 
xyglE 
xygLe 
xygLE 
xyGle 
xyGlE 
xyGLe 
xyGLE 
xYgle 
xYglE 
xYgLe 
sl 
xYgLE 
sle 
xYGle 
ug 
xYGlE 
uge 
xYGLe 
xYGLE 
Xygle 
XyglE 
XygLe 
ul 
XygLE 
ule 
XyGle 
sg 
XyGlE 
sge 
XyGLe 
XyGLE 
XYgle 
XYglE 
XYgLe 
XYgLE 
XYGle 
XYGlE 
XYGLe 
ne 
XYGLE 

Definition at line 211 of file autogen.h.

◆ idx

Definition at line 83 of file autogen.h.

◆ minus

Definition at line 181 of file autogen.h.

◆ mode

Enumerator
us 
uS 
Us 
US 
nuw 
nsw 
nusw 

Definition at line 64 of file autogen.h.

◆ Mode

enum class thorin::plug::core::Mode : nat_t
strong
Enumerator
none 

Wrap around.

nsw 

No Signed Wrap around.

nuw 

No Unsigned Wrap around.

nusw 

Definition at line 13 of file core.h.

◆ nat

Enumerator
add 
sub 
mul 

Definition at line 15 of file autogen.h.

◆ ncmp

Enumerator
gle 
glE 
gLe 
gLE 
le 
Gle 
GlE 
ge 
GLe 
ne 
GLE 

Definition at line 33 of file autogen.h.

◆ pe

Enumerator
hlt 
run 
known 

Definition at line 351 of file autogen.h.

◆ shr

Enumerator

Definition at line 145 of file autogen.h.

◆ trait

Enumerator
size 
align 

Definition at line 334 of file autogen.h.

◆ wrap

Enumerator
add 
sub 
mul 
shl 

Definition at line 162 of file autogen.h.

◆ zip

Definition at line 369 of file autogen.h.

Function Documentation

◆ convert() [1/2]

const Sigma * thorin::plug::core::convert ( const Bound b)
inline

Definition at line 90 of file core.h.

References convert().

◆ convert() [2/2]

template<bool up>
const Sigma * thorin::plug::core::convert ( const TBound< up > *  b)

Definition at line 19 of file core.cpp.

References a, align, thorin::Lit::isa(), thorin::Def::num_ops(), op(), thorin::Def::ops(), s, size, and thorin::Def::world().

Referenced by convert(), and normalize_trait().

◆ extract_unsafe() [1/2]

Ref thorin::plug::core::extract_unsafe ( Ref  d,
Ref  i 
)
inline

Definition at line 63 of file core.h.

References u.

Referenced by extract_unsafe().

◆ extract_unsafe() [2/2]

Ref thorin::plug::core::extract_unsafe ( Ref  d,
u64  i 
)
inline

Definition at line 67 of file core.h.

References extract_unsafe().

◆ insert_unsafe() [1/2]

Ref thorin::plug::core::insert_unsafe ( Ref  d,
Ref  i,
Ref  val 
)
inline

Definition at line 75 of file core.h.

References u.

Referenced by insert_unsafe().

◆ insert_unsafe() [2/2]

Ref thorin::plug::core::insert_unsafe ( Ref  d,
u64  i,
Ref  val 
)
inline

Definition at line 79 of file core.h.

References insert_unsafe().

◆ make_truth_table()

constexpr std::array< std::array< u64, 2 >, 2 > thorin::plug::core::make_truth_table ( bit2  id)
constexpr

Use like this: a op b = tab[a][b]

Definition at line 53 of file core.h.

Referenced by normalize_bit2().

◆ mode()

Ref thorin::plug::core::mode ( World w,
VMode  m 
)
inline

thorin::plug::core::VMode -> Ref.

Definition at line 26 of file core.h.

◆ normalize_abs()

Ref thorin::plug::core::normalize_abs ( Ref  type,
Ref  c,
Ref  arg 
)

Definition at line 299 of file normalizers.cpp.

References a, thorin::Def::projs(), and thorin::Def::world().

◆ normalize_bit1()

template<bit1 id>
Ref thorin::plug::core::normalize_bit1 ( Ref  type,
Ref  c,
Ref  a 
)

◆ normalize_bit2()

template<bit2 id>
Ref thorin::plug::core::normalize_bit2 ( Ref  type,
Ref  c,
Ref  arg 
)

◆ normalize_bitcast()

Ref thorin::plug::core::normalize_bitcast ( Ref  dst_t,
Ref  callee,
Ref  src 
)

◆ normalize_conv()

template<conv id>
Ref thorin::plug::core::normalize_conv ( Ref  dst_t,
Ref  c,
Ref  x 
)

◆ normalize_div()

template<div id>
Ref thorin::plug::core::normalize_div ( Ref  full_type,
Ref  c,
Ref  arg 
)

Definition at line 515 of file normalizers.cpp.

References a, thorin::Lit::isa(), thorin::Def::projs(), sdiv, srem, udiv, urem, and thorin::Def::world().

◆ normalize_extrema()

template<extrema id>
Ref thorin::plug::core::normalize_extrema ( Ref  type,
Ref  c,
Ref  arg 
)

Definition at line 291 of file normalizers.cpp.

References a, thorin::Def::projs(), and thorin::Def::world().

◆ normalize_icmp()

template<icmp id>
Ref thorin::plug::core::normalize_icmp ( Ref  type,
Ref  c,
Ref  arg 
)

Definition at line 275 of file normalizers.cpp.

References a, e, f, ne, thorin::Def::projs(), t, and thorin::Def::world().

◆ normalize_idx()

Ref thorin::plug::core::normalize_idx ( Ref  type,
Ref  c,
Ref  arg 
)

Definition at line 412 of file normalizers.cpp.

References thorin::Lit::isa(), s, thorin::Idx::size(), and thorin::Def::world().

◆ normalize_nat()

template<nat id>
Ref thorin::plug::core::normalize_nat ( Ref  type,
Ref  callee,
Ref  arg 
)

◆ normalize_ncmp()

template<ncmp id>
Ref thorin::plug::core::normalize_ncmp ( Ref  type,
Ref  callee,
Ref  arg 
)

◆ normalize_pe()

template<pe id>
Ref thorin::plug::core::normalize_pe ( Ref  type,
Ref  callee,
Ref  arg 
)

◆ normalize_shr()

template<shr id>
Ref thorin::plug::core::normalize_shr ( Ref  type,
Ref  c,
Ref  arg 
)

◆ normalize_trait()

◆ normalize_wrap()

template<wrap id>
Ref thorin::plug::core::normalize_wrap ( Ref  type,
Ref  c,
Ref  arg 
)

◆ normalize_zip()

Ref thorin::plug::core::normalize_zip ( Ref  type,
Ref  c,
Ref  arg 
)

◆ op() [1/2]

Ref thorin::plug::core::op ( pe  o,
Ref  def 
)
inline

Definition at line 43 of file core.h.

References thorin::Def::type(), and thorin::Def::world().

◆ op() [2/2]

Ref thorin::plug::core::op ( trait  o,
Ref  type 
)
inline

Definition at line 35 of file core.h.

References thorin::Def::world().

Referenced by convert(), and normalize_trait().

◆ register_normalizers()

void thorin::plug::core::register_normalizers ( Normalizers normalizers)

Referenced by thorin_get_plugin().

Variable Documentation

◆ Plugin_Id

constexpr plugin_t thorin::plug::core::Plugin_Id = 0x1104c60000000000
staticconstexpr

Definition at line 10 of file autogen.h.