Knowledge (XXG)

Cranelift

Source 📝

329: 220:
Prior to the backend framework rewrite in 2020, the project made use of only one intermediate representation (IR) across all compilation stages prior to machine code emission, namely CLIF (Cranelift IR Format). The old design made use of
225:
legalizations, which involved transforming the high-level IR continuously until each CLIF instruction corresponded to an instruction of the target machine, at which point the
639: 634: 629: 236:
for later compilation stages instead. After this rewrite, a high-level input CLIF would be optimized by a middle layer before being lowered into
472:"Introduce peepmatic: a peephole optimizations DSL and peephole optimizer compiler by fitzgen · Pull Request #1647 · bytecodealliance/wasmtime" 267:/Lowering Expressions DSL), another DSL in the project that was made to ease the development of the instruction selection stage in backends. 334: 540:"egraph-based midend: draw the rest of the owl (productionized). by cfallin · Pull Request #4953 · bytecodealliance/wasmtime" 193: 178: 170: 99: 70: 372: 185:. Unlike compiler backends such as LLVM that focus more on ahead-of-time compilation, Cranelift instead focuses on 308: 294: 249: 186: 347: 264: 245: 417: 256: 118: 392: 624: 317:
An alternative code generator for the Rust compiler that is powered by Cranelift also exists.
287: 182: 41: 301: 130: 106: 226: 565: 539: 489: 471: 446: 209: 135: 111: 514: 618: 590: 260: 222: 490:"Remove Peepmatic!!! by fitzgen · Pull Request #3543 · bytecodealliance/wasmtime" 393:"GitHub - bytecodealliance/cranelift at 399be07fcf00d0974d2a83d1af55f0bee9861d54" 232:
In 2020, the backend was rewritten to use a separate, machine-specific IR called
283: 17: 342: 324: 263:, was added. In addition, the backend framework was reworked to utilize ISLE ( 174: 36: 566:"Performance of WebAssembly runtimes in 2023 | Frank DENIS random thoughts" 515:"Cranelift's Instruction Selector DSL, ISLE: Term-Rewriting Made Practical" 274:
in 2022. The optimization passes are enabled by default starting in 2023.
240:, which would be further transformed by remaining passes in the backend. 166: 123: 271: 201: 595: 377: 205: 197: 270:
The mid-end saw addition of optimization passes that make use of
352: 189:
with short compile time being an explicit goal of the project.
447:"A New Backend for Cranelift, Part 1: Instruction Selection" 181:. The project started in 2016 and is currently developed by 147: 418:"wasmtime/cranelift at main · bytecodealliance/wasmtime" 27:
A compiler backend written in Rust programming language
314:, with performance comparable to LLVM-based runtimes. 259:, which was adapted from the register allocator from 252:(DSL), was also added, though it was later removed. 282:Currently, Cranelift is being utilized by multiple 142: 129: 117: 105: 95: 69: 47: 35: 8: 30: 169:backend that converts a target-independent 440: 438: 29: 364: 7: 591:"Cranelift codegen backend for rust" 335:Free and open-source software portal 76:0.105.2 / February 28, 2024 25: 640:Software using the Apache license 327: 635:Register-based virtual machines 630:Free compilers and interpreters 192:As of 2023, Cranelift supports 177:machine code. It is written in 1: 194:instruction set architectures 244:, a tool used to generate a 171:intermediate representation 656: 53:; 8 years ago 91: 65: 250:domain-specific language 187:just-in-time compilation 348:GNU Compiler Collection 78:; 6 months ago 265:Instruction Selection 138:with LLVM exceptions 165:) is an optimizing 161:(formerly known as 32: 286:runtimes, such as 257:register allocator 246:peephole optimizer 229:could be emitted. 599:. 26 January 2023 312: 298: 183:Bytecode Alliance 156: 155: 42:Bytecode Alliance 16:(Redirected from 647: 609: 608: 606: 604: 587: 581: 580: 578: 576: 561: 555: 554: 552: 550: 536: 530: 529: 527: 525: 510: 504: 503: 501: 500: 486: 480: 479: 468: 462: 461: 459: 457: 442: 433: 432: 430: 428: 414: 408: 407: 405: 403: 389: 383: 382: 369: 337: 332: 331: 330: 313: 306: 299: 292: 152: 149: 107:Operating system 86: 84: 79: 61: 59: 54: 33: 21: 655: 654: 650: 649: 648: 646: 645: 644: 615: 614: 613: 612: 602: 600: 589: 588: 584: 574: 572: 563: 562: 558: 548: 546: 538: 537: 533: 523: 521: 513:Fallin, Chris. 512: 511: 507: 498: 496: 488: 487: 483: 470: 469: 465: 455: 453: 445:Fallin, Chris. 444: 443: 436: 426: 424: 416: 415: 411: 401: 399: 391: 390: 386: 371: 370: 366: 361: 333: 328: 326: 323: 305: 291: 280: 255:In 2022, a new 227:executable code 218: 146: 87: 82: 80: 77: 57: 55: 52: 48:Initial release 28: 23: 22: 18:Draft:Cranelift 15: 12: 11: 5: 653: 651: 643: 642: 637: 632: 627: 617: 616: 611: 610: 582: 564:Denis, Frank. 556: 531: 505: 481: 463: 434: 409: 384: 363: 362: 360: 357: 356: 355: 350: 345: 339: 338: 322: 319: 279: 276: 217: 214: 210:z/Architecture 154: 153: 144: 140: 139: 136:Apache License 133: 127: 126: 121: 115: 114: 112:Cross-platform 109: 103: 102: 97: 93: 92: 89: 88: 75: 73: 71:Stable release 67: 66: 63: 62: 49: 45: 44: 39: 26: 24: 14: 13: 10: 9: 6: 4: 3: 2: 652: 641: 638: 636: 633: 631: 628: 626: 623: 622: 620: 598: 597: 592: 586: 583: 571: 567: 560: 557: 545: 541: 535: 532: 520: 516: 509: 506: 495: 491: 485: 482: 477: 473: 467: 464: 452: 448: 441: 439: 435: 423: 419: 413: 410: 398: 394: 388: 385: 380: 379: 374: 368: 365: 358: 354: 351: 349: 346: 344: 341: 340: 336: 325: 320: 318: 315: 310: 303: 296: 289: 285: 277: 275: 273: 268: 266: 262: 258: 253: 251: 247: 243: 239: 235: 230: 228: 224: 215: 213: 211: 207: 203: 199: 195: 190: 188: 184: 180: 176: 172: 168: 164: 160: 151: 145: 141: 137: 134: 132: 128: 125: 122: 120: 116: 113: 110: 108: 104: 101: 98: 94: 90: 74: 72: 68: 64: 50: 46: 43: 40: 38: 34: 19: 601:. Retrieved 594: 585: 573:. Retrieved 569: 559: 547:. Retrieved 543: 534: 522:. Retrieved 518: 508: 497:. Retrieved 493: 484: 475: 466: 454:. Retrieved 450: 425:. Retrieved 421: 412: 400:. Retrieved 396: 387: 376: 373:"LICENSE.md" 367: 316: 281: 278:Applications 269: 254: 241: 237: 233: 231: 219: 191: 162: 158: 157: 37:Developer(s) 519:cfallin.org 451:cfallin.org 284:WebAssembly 223:instruction 619:Categories 603:26 January 575:26 January 549:26 January 524:26 January 499:2023-02-03 456:26 January 427:26 January 402:26 January 359:References 343:Emscripten 208:, and IBM 175:executable 96:Written in 83:2024-02-28 625:Compilers 261:IonMonkey 242:Peepmatic 159:Cranelift 148:cranelift 31:Cranelift 321:See also 309:Wikidata 295:Wikidata 288:Wasmtime 272:e-graphs 196:such as 167:compiler 163:Cretonne 124:Compiler 570:00f.net 248:from a 216:History 202:AArch64 143:Website 131:License 81: ( 56: ( 596:GitHub 544:GitHub 494:GitHub 476:GitHub 422:GitHub 397:GitHub 378:GitHub 304:  302:Wasmer 290:  206:RISC-V 198:x86-64 311:] 307:[ 297:] 293:[ 238:VCode 234:VCode 173:into 605:2023 577:2023 551:2023 526:2023 458:2023 429:2023 404:2023 353:LLVM 300:and 179:Rust 150:.dev 119:Type 100:Rust 58:2016 51:2016 621:: 593:. 568:. 542:. 517:. 492:. 474:. 449:. 437:^ 420:. 395:. 375:. 212:. 204:, 200:, 607:. 579:. 553:. 528:. 502:. 478:. 460:. 431:. 406:. 381:. 85:) 60:) 20:)

Index

Draft:Cranelift
Developer(s)
Bytecode Alliance
Stable release
Rust
Operating system
Cross-platform
Type
Compiler
License
Apache License
cranelift.dev
compiler
intermediate representation
executable
Rust
Bytecode Alliance
just-in-time compilation
instruction set architectures
x86-64
AArch64
RISC-V
z/Architecture
instruction
executable code
peephole optimizer
domain-specific language
register allocator
IonMonkey
Instruction Selection

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.