1;; This is a prelude of standard definitions for ISLE, the instruction-selector 2;; DSL, as we use it bound to our interfaces. 3;; 4;; Note that all `extern` functions here are typically defined in the 5;; `isle_prelude_methods` macro defined in `src/isa/isle.rs` 6 7;;;; Primitive and External Types ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 8 9;; `()` 10(type Unit (primitive Unit)) 11 12;; `bool` is declared in `clif.isle`. 13(extern const $true bool) 14(extern const $false bool) 15 16(type u8 (primitive u8)) 17(type u16 (primitive u16)) 18(type u32 (primitive u32)) 19(type u64 (primitive u64)) 20(type u128 (primitive u128)) 21(type usize (primitive usize)) 22 23(type i8 (primitive i8)) 24(type i16 (primitive i16)) 25(type i32 (primitive i32)) 26(type i64 (primitive i64)) 27(type i128 (primitive i128)) 28(type isize (primitive isize)) 29 30;; `cranelift-entity`-based identifiers. 31(type Inst (primitive Inst)) 32(type Type (primitive Type)) 33(type Value (primitive Value)) 34 35;; ISLE representation of `&[Value]`. 36(type ValueSlice (primitive ValueSlice)) 37 38(type ValueList (primitive ValueList)) 39(type ValueRegs (primitive ValueRegs)) 40 41;; Instruction lowering result: a vector of `ValueRegs`. 42(type InstOutput (primitive InstOutput)) 43;; (Mutable) builder to incrementally construct an `InstOutput`. 44(type InstOutputBuilder extern (enum)) 45 46(decl u32_add (u32 u32) u32) 47(extern constructor u32_add u32_add) 48 49;; Pure/fallible constructor that tries to add two `u32`s, interpreted 50;; as signed values, and fails to match on overflow. 51(decl pure s32_add_fallible (u32 u32) u32) 52(extern constructor s32_add_fallible s32_add_fallible) 53 54;; Extractor that matches a `u32` only if non-negative. 55(decl u32_nonnegative (u32) u32) 56(extern extractor u32_nonnegative u32_nonnegative) 57 58;; Extractor that pulls apart an Offset32 into a u32 with the raw 59;; signed-32-bit twos-complement bits. 60(decl offset32 (u32) Offset32) 61(extern extractor offset32 offset32) 62 63;; Pure/fallible constructor that tests if one u32 is less than or 64;; equal to another. 65(decl pure u32_lteq (u32 u32) Unit) 66(extern constructor u32_lteq u32_lteq) 67 68;; Get a signed 32-bit immediate in an u32 from an Imm64, if possible. 69(decl simm32 (u32) Imm64) 70(extern extractor simm32 simm32) 71 72;; Get an unsigned 8-bit immediate in a u8 from an Imm64, if possible. 73(decl uimm8 (u8) Imm64) 74(extern extractor uimm8 uimm8) 75 76(decl u8_and (u8 u8) u8) 77(extern constructor u8_and u8_and) 78 79;;;; Registers ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 80 81(type Reg (primitive Reg)) 82(type WritableReg (primitive WritableReg)) 83(type OptionWritableReg (primitive OptionWritableReg)) 84(type VecReg extern (enum)) 85(type VecWritableReg extern (enum)) 86 87;; Construct a `ValueRegs` of one register. 88(decl value_reg (Reg) ValueRegs) 89(extern constructor value_reg value_reg) 90 91;; Construct a `ValueRegs` of two registers. 92(decl value_regs (Reg Reg) ValueRegs) 93(extern constructor value_regs value_regs) 94 95;; Construct an empty `ValueRegs` containing only invalid register sentinels. 96(decl value_regs_invalid () ValueRegs) 97(extern constructor value_regs_invalid value_regs_invalid) 98 99;; Construct an empty `InstOutput`. 100(decl output_none () InstOutput) 101(extern constructor output_none output_none) 102 103;; Construct a single-element `InstOutput`. 104(decl output (ValueRegs) InstOutput) 105(extern constructor output output) 106 107;; Construct a two-element `InstOutput`. 108(decl output_pair (ValueRegs ValueRegs) InstOutput) 109(extern constructor output_pair output_pair) 110 111;; Construct a single-element `InstOutput` from a single register. 112(decl output_reg (Reg) InstOutput) 113(rule (output_reg reg) (output (value_reg reg))) 114 115;; Construct a single-element `InstOutput` from a value. 116(decl output_value (Value) InstOutput) 117(rule (output_value val) (output (put_in_regs val))) 118 119;; Initially empty `InstOutput` builder. 120(decl output_builder_new () InstOutputBuilder) 121(extern constructor output_builder_new output_builder_new) 122 123;; Append a `ValueRegs` to an `InstOutput` under construction. 124(decl output_builder_push (InstOutputBuilder ValueRegs) Unit) 125(extern constructor output_builder_push output_builder_push) 126 127;; Finish building an `InstOutput` incrementally. 128(decl output_builder_finish (InstOutputBuilder) InstOutput) 129(extern constructor output_builder_finish output_builder_finish) 130 131;; Get a temporary register for writing. 132(decl temp_writable_reg (Type) WritableReg) 133(extern constructor temp_writable_reg temp_writable_reg) 134 135;; Get a temporary register for reading. 136(decl temp_reg (Type) Reg) 137(rule (temp_reg ty) 138 (writable_reg_to_reg (temp_writable_reg ty))) 139 140;; Get or match the invalid register. 141(decl invalid_reg () Reg) 142(extern constructor invalid_reg invalid_reg) 143(extern extractor invalid_reg invalid_reg_etor) 144 145;; Match any register but the invalid register. 146(decl valid_reg () Reg) 147(extern extractor valid_reg valid_reg) 148 149;; Put the given value into a register. 150;; 151;; Asserts that the value fits into a single register, and doesn't require 152;; multiple registers for its representation (like `i128` on x64 for example). 153;; 154;; As a side effect, this marks the value as used. 155(decl put_in_reg (Value) Reg) 156(extern constructor put_in_reg put_in_reg) 157 158;; Put the given value into one or more registers. 159;; 160;; As a side effect, this marks the value as used. 161(decl put_in_regs (Value) ValueRegs) 162(extern constructor put_in_regs put_in_regs) 163 164;; If the given reg is a real register, cause the value in reg to be in a virtual 165;; reg, by copying it into a new virtual reg. 166(decl ensure_in_vreg (Reg Type) Reg) 167(extern constructor ensure_in_vreg ensure_in_vreg) 168 169;; Get the `n`th register inside a `ValueRegs`. 170(decl value_regs_get (ValueRegs usize) Reg) 171(extern constructor value_regs_get value_regs_get) 172 173;; Put the value into one or more registers and return the first register. 174;; 175;; Unlike `put_in_reg`, this does not assert that the value fits in a single 176;; register. This is useful for things like a `i128` shift amount, where we mask 177;; the shift amount to the bit width of the value being shifted, and so the high 178;; half of the `i128` won't ever be used. 179;; 180;; As a side efect, this marks that value as used. 181(decl lo_reg (Value) Reg) 182(rule (lo_reg val) 183 (let ((regs ValueRegs (put_in_regs val))) 184 (value_regs_get regs 0))) 185 186;;;; Common Mach Types ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 187 188(type MachLabel (primitive MachLabel)) 189(type VecMachLabel extern (enum)) 190(type ValueLabel (primitive ValueLabel)) 191(type UnwindInst (primitive UnwindInst)) 192(type ExternalName (primitive ExternalName)) 193(type BoxExternalName (primitive BoxExternalName)) 194(type RelocDistance (primitive RelocDistance)) 195 196;;;; Primitive Type Conversions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 197 198(decl pure u8_as_u32 (u8) u32) 199(extern constructor u8_as_u32 u8_as_u32) 200 201(decl pure u8_as_u64 (u8) u64) 202(extern constructor u8_as_u64 u8_as_u64) 203 204(decl pure u16_as_u64 (u16) u64) 205(extern constructor u16_as_u64 u16_as_u64) 206 207(decl pure u32_as_u64 (u32) u64) 208(extern constructor u32_as_u64 u32_as_u64) 209 210(decl pure i64_as_u64 (i64) u64) 211(extern constructor i64_as_u64 i64_as_u64) 212 213;;;; Primitive Arithmetic ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 214 215(decl pure u64_add (u64 u64) u64) 216(extern constructor u64_add u64_add) 217 218(decl pure u64_sub (u64 u64) u64) 219(extern constructor u64_sub u64_sub) 220 221(decl pure u64_and (u64 u64) u64) 222(extern constructor u64_and u64_and) 223 224;;;; `cranelift_codegen::ir::Type` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 225 226(extern const $B1 Type) 227(extern const $B8 Type) 228(extern const $B16 Type) 229(extern const $B32 Type) 230(extern const $B64 Type) 231(extern const $B128 Type) 232 233(extern const $I8 Type) 234(extern const $I16 Type) 235(extern const $I32 Type) 236(extern const $I64 Type) 237(extern const $I128 Type) 238 239(extern const $R32 Type) 240(extern const $R64 Type) 241 242(extern const $F32 Type) 243(extern const $F64 Type) 244 245(extern const $B8X16 Type) 246(extern const $B16X8 Type) 247(extern const $B32X4 Type) 248(extern const $B64X2 Type) 249 250(extern const $I8X16 Type) 251(extern const $I16X8 Type) 252(extern const $I32X4 Type) 253(extern const $I64X2 Type) 254 255(extern const $F32X4 Type) 256(extern const $F64X2 Type) 257 258;; Get the bit width of a given type. 259(decl pure ty_bits (Type) u8) 260(extern constructor ty_bits ty_bits) 261 262;; Get the bit width of a given type. 263(decl ty_bits_u16 (Type) u16) 264(extern constructor ty_bits_u16 ty_bits_u16) 265 266;; Get the bit width of a given type. 267(decl ty_bits_u64 (Type) u64) 268(extern constructor ty_bits_u64 ty_bits_u64) 269 270;; Get a mask for the width of a given type. 271(decl ty_mask (Type) u64) 272(extern constructor ty_mask ty_mask) 273 274;; Get the byte width of a given type. 275(decl ty_bytes (Type) u16) 276(extern constructor ty_bytes ty_bytes) 277 278;; Get the type of each lane in the given type. 279(decl lane_type (Type) Type) 280(extern constructor lane_type lane_type) 281 282;;;; Helper Clif Extractors ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 283 284;; An extractor that only matches types that can fit in 16 bits. 285(decl fits_in_16 (Type) Type) 286(extern extractor fits_in_16 fits_in_16) 287 288;; An extractor that only matches types that can fit in 32 bits. 289(decl fits_in_32 (Type) Type) 290(extern extractor fits_in_32 fits_in_32) 291 292;; An extractor that only matches types that can fit in 64 bits. 293(decl fits_in_64 (Type) Type) 294(extern extractor fits_in_64 fits_in_64) 295 296;; An extractor that matches 32- and 64-bit types only. 297(decl ty_32_or_64 (Type) Type) 298(extern extractor ty_32_or_64 ty_32_or_64) 299 300;; An extractor that matches 8- and 16-bit types only. 301(decl ty_8_or_16 (Type) Type) 302(extern extractor ty_8_or_16 ty_8_or_16) 303 304;; An extractor that matches I64 or B64. 305(decl ty_int_bool_64 (Type) Type) 306(extern extractor ty_int_bool_64 ty_int_bool_64) 307 308;; An extractor that matches I64 or B64 or R64. 309(decl ty_int_bool_ref_64 (Type) Type) 310(extern extractor ty_int_bool_ref_64 ty_int_bool_ref_64) 311 312;; An extractor that matches I128 or B128. 313(decl ty_int_bool_128 (Type) Type) 314(extern extractor ty_int_bool_128 ty_int_bool_128) 315 316;; An extractor that only matches scalar floating-point types--F32 or F64. 317(decl ty_scalar_float (Type) Type) 318(extern extractor ty_scalar_float ty_scalar_float) 319 320;; An extractor that only matches 128-bit vector types. 321(decl ty_vec128 (Type) Type) 322(extern extractor ty_vec128 ty_vec128) 323 324;; An extractor that only matches 128-bit vector types with integer 325;; lanes (I8X16, I16X8, I32X4, I64X2). 326(decl ty_vec128_int (Type) Type) 327(extern extractor ty_vec128_int ty_vec128_int) 328 329;; An extractor that matches everything except i64x2 330(decl not_i64x2 () Type) 331(extern extractor not_i64x2 not_i64x2) 332 333;; Extractor to get a `ValueSlice` out of a `ValueList`. 334(decl value_list_slice (ValueSlice) ValueList) 335(extern extractor infallible value_list_slice value_list_slice) 336 337;; Extractor to test whether a `ValueSlice` is empty. 338(decl value_slice_empty () ValueSlice) 339(extern extractor value_slice_empty value_slice_empty) 340 341;; Extractor to split a `ValueSlice` into its first element plus a tail. 342(decl value_slice_unwrap (Value ValueSlice) ValueSlice) 343(extern extractor value_slice_unwrap value_slice_unwrap) 344 345;; Return the length of a `ValueSlice`. 346(decl value_slice_len (ValueSlice) usize) 347(extern constructor value_slice_len value_slice_len) 348 349;; Return any element of a `ValueSlice`. 350(decl value_slice_get (ValueSlice usize) Value) 351(extern constructor value_slice_get value_slice_get) 352 353;; Extractor to get the first element from a value list, along with its tail as 354;; a `ValueSlice`. 355(decl unwrap_head_value_list_1 (Value ValueSlice) ValueList) 356(extractor (unwrap_head_value_list_1 head tail) 357 (value_list_slice (value_slice_unwrap head tail))) 358 359;; Extractor to get the first two elements from a value list, along with its 360;; tail as a `ValueSlice`. 361(decl unwrap_head_value_list_2 (Value Value ValueSlice) ValueList) 362(extractor (unwrap_head_value_list_2 head1 head2 tail) 363 (value_list_slice (value_slice_unwrap head1 (value_slice_unwrap head2 tail)))) 364 365;; Turn a `Writable<Reg>` into a `Reg` via `Writable::to_reg`. 366(decl writable_reg_to_reg (WritableReg) Reg) 367(extern constructor writable_reg_to_reg writable_reg_to_reg) 368 369;; Extract a `u8` from an `Uimm8`. 370(decl u8_from_uimm8 (u8) Uimm8) 371(extern extractor infallible u8_from_uimm8 u8_from_uimm8) 372 373;; Extract a `u64` from an `Imm64`. 374(decl u64_from_imm64 (u64) Imm64) 375(extern extractor infallible u64_from_imm64 u64_from_imm64) 376 377;; Extract a `u64` from an `Imm64` which is not zero. 378(decl nonzero_u64_from_imm64 (u64) Imm64) 379(extern extractor nonzero_u64_from_imm64 nonzero_u64_from_imm64) 380 381;; Extract a `u64` from an `Ieee32`. 382(decl u64_from_ieee32 (u64) Ieee32) 383(extern extractor infallible u64_from_ieee32 u64_from_ieee32) 384 385;; Extract a `u64` from an `Ieee64`. 386(decl u64_from_ieee64 (u64) Ieee64) 387(extern extractor infallible u64_from_ieee64 u64_from_ieee64) 388 389;; Extract the result values for the given instruction. 390(decl inst_results (ValueSlice) Inst) 391(extern extractor infallible inst_results inst_results) 392 393;; Extract the first result value of the given instruction. 394(decl first_result (Value) Inst) 395(extern extractor first_result first_result) 396 397;; Extract the `InstructionData` for an `Inst`. 398(decl inst_data (InstructionData) Inst) 399(extern extractor infallible inst_data inst_data) 400 401;; Extract the type of a `Value`. 402(decl value_type (Type) Value) 403(extern extractor infallible value_type value_type) 404 405;; Extract the type of the instruction's first result. 406(decl result_type (Type) Inst) 407(extractor (result_type ty) 408 (first_result (value_type ty))) 409 410;; Extract the type of the instruction's first result and pass along the 411;; instruction as well. 412(decl has_type (Type Inst) Inst) 413(extractor (has_type ty inst) 414 (and (result_type ty) 415 inst)) 416 417;; Match a multi-lane type, extracting (# bits per lane, # lanes) from the given 418;; type. Will only match when there is more than one lane. 419(decl multi_lane (u8 u16) Type) 420(extern extractor multi_lane multi_lane) 421 422;; Match the instruction that defines the given value, if any. 423(decl def_inst (Inst) Value) 424(extern extractor def_inst def_inst) 425 426;; Extract a constant `u64` from a value defined by an `iconst`. 427(decl u64_from_iconst (u64) Value) 428(extractor (u64_from_iconst x) 429 (def_inst (iconst (u64_from_imm64 x)))) 430 431;; Convert an `Offset32` to a primitive number. 432(decl offset32_to_u32 (Offset32) u32) 433(extern constructor offset32_to_u32 offset32_to_u32) 434 435;; Instruction creation helpers ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 436 437;; Emit an instruction. 438;; 439;; This is low-level and side-effectful; it should only be used as an 440;; implementation detail by helpers that preserve the SSA facade themselves. 441 442(decl emit (MInst) Unit) 443(extern constructor emit emit) 444 445;;;; Helpers for Side-Effectful Instructions Without Results ;;;;;;;;;;;;;;;;;;; 446 447(type SideEffectNoResult (enum 448 (Inst (inst MInst)) 449 (Inst2 (inst1 MInst) 450 (inst2 MInst)))) 451 452;; Create an empty `InstOutput`, but do emit the given side-effectful 453;; instruction. 454(decl side_effect (SideEffectNoResult) InstOutput) 455(rule (side_effect (SideEffectNoResult.Inst inst)) 456 (let ((_ Unit (emit inst))) 457 (output_none))) 458(rule (side_effect (SideEffectNoResult.Inst2 inst1 inst2)) 459 (let ((_1 Unit (emit inst1)) 460 (_2 Unit (emit inst2))) 461 (output_none))) 462 463(decl side_effect_concat (SideEffectNoResult SideEffectNoResult) SideEffectNoResult) 464(rule (side_effect_concat (SideEffectNoResult.Inst inst1) (SideEffectNoResult.Inst inst2)) 465 (SideEffectNoResult.Inst2 inst1 inst2)) 466 467;;;; Helpers for Working with Flags ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 468 469;; Newtype wrapper around `MInst` for instructions that are used for their 470;; effect on flags. 471;; 472;; Variant determines how result is given when combined with a 473;; ConsumesFlags. See `with_flags` below for more. 474(type ProducesFlags (enum 475 (ProducesFlagsSideEffect (inst MInst)) 476 ;; Not directly combinable with a ConsumesFlags; 477 ;; used in s390x and unwrapped directly by `trapif`. 478 (ProducesFlagsReturnsReg (inst MInst) (result Reg)) 479 (ProducesFlagsReturnsResultWithConsumer (inst MInst) (result Reg)))) 480 481;; Newtype wrapper around `MInst` for instructions that consume flags. 482;; 483;; Variant determines how result is given when combined with a 484;; ProducesFlags. See `with_flags` below for more. 485(type ConsumesFlags (enum 486 (ConsumesFlagsReturnsResultWithProducer (inst MInst) (result Reg)) 487 (ConsumesFlagsReturnsReg (inst MInst) (result Reg)) 488 (ConsumesFlagsTwiceReturnsValueRegs (inst1 MInst) 489 (inst2 MInst) 490 (result ValueRegs)) 491 (ConsumesFlagsFourTimesReturnsValueRegs (inst1 MInst) 492 (inst2 MInst) 493 (inst3 MInst) 494 (inst4 MInst) 495 (result ValueRegs)))) 496 497 498 499;; Get the produced register out of a ProducesFlags. 500(decl produces_flags_get_reg (ProducesFlags) Reg) 501(rule (produces_flags_get_reg (ProducesFlags.ProducesFlagsReturnsReg _ reg)) reg) 502 503;; Modify a ProducesFlags to use it only for its side-effect, ignoring 504;; its result. 505(decl produces_flags_ignore (ProducesFlags) ProducesFlags) 506(rule (produces_flags_ignore (ProducesFlags.ProducesFlagsReturnsReg inst _)) 507 (ProducesFlags.ProducesFlagsSideEffect inst)) 508(rule (produces_flags_ignore (ProducesFlags.ProducesFlagsReturnsResultWithConsumer inst _)) 509 (ProducesFlags.ProducesFlagsSideEffect inst)) 510 511;; Helper for combining two flags-consumer instructions that return a 512;; single Reg, giving a ConsumesFlags that returns both values in a 513;; ValueRegs. 514(decl consumes_flags_concat (ConsumesFlags ConsumesFlags) ConsumesFlags) 515(rule (consumes_flags_concat (ConsumesFlags.ConsumesFlagsReturnsReg inst1 reg1) 516 (ConsumesFlags.ConsumesFlagsReturnsReg inst2 reg2)) 517 (ConsumesFlags.ConsumesFlagsTwiceReturnsValueRegs 518 inst1 519 inst2 520 (value_regs reg1 reg2))) 521 522;; Combine flags-producing and -consuming instructions together, ensuring that 523;; they are emitted back-to-back and no other instructions can be emitted 524;; between them and potentially clobber the flags. 525;; 526;; Returns a `ValueRegs` according to the specific combination of ProducesFlags and ConsumesFlags modes: 527;; - SideEffect + ReturnsReg --> ValueReg with one Reg from consumer 528;; - SideEffect + ReturnsValueRegs --> ValueReg as given from consumer 529;; - ReturnsResultWithProducer + ReturnsResultWithConsumer --> ValueReg with low part from producer, high part from consumer 530;; 531;; See `with_flags_reg` below for a variant that extracts out just the lower Reg. 532(decl with_flags (ProducesFlags ConsumesFlags) ValueRegs) 533 534(rule (with_flags (ProducesFlags.ProducesFlagsReturnsResultWithConsumer producer_inst producer_result) 535 (ConsumesFlags.ConsumesFlagsReturnsResultWithProducer consumer_inst consumer_result)) 536 (let ((_x Unit (emit producer_inst)) 537 (_y Unit (emit consumer_inst))) 538 (value_regs producer_result consumer_result))) 539 540(rule (with_flags (ProducesFlags.ProducesFlagsSideEffect producer_inst) 541 (ConsumesFlags.ConsumesFlagsReturnsReg consumer_inst consumer_result)) 542 (let ((_x Unit (emit producer_inst)) 543 (_y Unit (emit consumer_inst))) 544 (value_reg consumer_result))) 545 546(rule (with_flags (ProducesFlags.ProducesFlagsSideEffect producer_inst) 547 (ConsumesFlags.ConsumesFlagsTwiceReturnsValueRegs consumer_inst_1 548 consumer_inst_2 549 consumer_result)) 550 ;; We must emit these instructions in order as the creator of 551 ;; the ConsumesFlags may be relying on dataflow dependencies 552 ;; amongst them. 553 (let ((_x Unit (emit producer_inst)) 554 (_y Unit (emit consumer_inst_1)) 555 (_z Unit (emit consumer_inst_2))) 556 consumer_result)) 557 558(rule (with_flags (ProducesFlags.ProducesFlagsSideEffect producer_inst) 559 (ConsumesFlags.ConsumesFlagsFourTimesReturnsValueRegs consumer_inst_1 560 consumer_inst_2 561 consumer_inst_3 562 consumer_inst_4 563 consumer_result)) 564 ;; We must emit these instructions in order as the creator of 565 ;; the ConsumesFlags may be relying on dataflow dependencies 566 ;; amongst them. 567 (let ((_x Unit (emit producer_inst)) 568 (_y Unit (emit consumer_inst_1)) 569 (_z Unit (emit consumer_inst_2)) 570 (_w Unit (emit consumer_inst_3)) 571 (_v Unit (emit consumer_inst_4))) 572 consumer_result)) 573 574(decl with_flags_reg (ProducesFlags ConsumesFlags) Reg) 575(rule (with_flags_reg p c) 576 (let ((v ValueRegs (with_flags p c))) 577 (value_regs_get v 0))) 578 579;;;; Helpers for Working with TrapCode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 580 581(decl trap_code_division_by_zero () TrapCode) 582(extern constructor trap_code_division_by_zero trap_code_division_by_zero) 583 584(decl trap_code_integer_overflow () TrapCode) 585(extern constructor trap_code_integer_overflow trap_code_integer_overflow) 586 587(decl trap_code_bad_conversion_to_integer () TrapCode) 588(extern constructor trap_code_bad_conversion_to_integer trap_code_bad_conversion_to_integer) 589 590;;;; Helpers for accessing compilation flags ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 591 592(decl avoid_div_traps () Type) 593(extern extractor avoid_div_traps avoid_div_traps) 594 595;;;; Helpers for accessing instruction data ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 596 597;; Accessor for `FuncRef`. 598 599(decl func_ref_data (SigRef ExternalName RelocDistance) FuncRef) 600(extern extractor infallible func_ref_data func_ref_data) 601 602;; Accessor for `GobalValue`. 603 604(decl symbol_value_data (ExternalName RelocDistance i64) GlobalValue) 605(extern extractor symbol_value_data symbol_value_data) 606 607;; Accessor for `RelocDistance`. 608 609(decl reloc_distance_near () RelocDistance) 610(extern extractor reloc_distance_near reloc_distance_near) 611 612;;;; Automatic conversions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 613 614(convert Inst Value def_inst) 615(convert Reg ValueRegs value_reg) 616(convert Value Reg put_in_reg) 617(convert Value ValueRegs put_in_regs) 618(convert WritableReg Reg writable_reg_to_reg) 619(convert ValueRegs InstOutput output) 620(convert Reg InstOutput output_reg) 621(convert Value InstOutput output_value) 622(convert Offset32 u32 offset32_to_u32) 623