Rename Cretonne to Cranelift!

This commit is contained in:
Dan Gohman
2018-07-13 09:01:28 -07:00
parent 19a636af96
commit f4dbd38a4c
306 changed files with 977 additions and 975 deletions

View File

@@ -1,10 +1,10 @@
//! Defines `FaerieBackend`.
use container;
use cretonne_codegen::binemit::{Addend, CodeOffset, NullTrapSink, Reloc, RelocSink};
use cretonne_codegen::isa::TargetIsa;
use cretonne_codegen::{self, binemit, ir};
use cretonne_module::{
use cranelift_codegen::binemit::{Addend, CodeOffset, NullTrapSink, Reloc, RelocSink};
use cranelift_codegen::isa::TargetIsa;
use cranelift_codegen::{self, binemit, ir};
use cranelift_module::{
Backend, DataContext, DataDescription, Init, Linkage, ModuleError, ModuleNamespace,
ModuleResult,
};
@@ -34,16 +34,16 @@ pub struct FaerieBuilder {
}
impl FaerieBuilder {
/// Create a new `FaerieBuilder` using the given Cretonne target, that
/// Create a new `FaerieBuilder` using the given Cranelift target, that
/// can be passed to
/// [`Module::new`](cretonne_module/struct.Module.html#method.new].
/// [`Module::new`](cranelift_module/struct.Module.html#method.new].
///
/// Faerie output requires that TargetIsa have PIC (Position Independent Code) enabled.
///
/// `collect_traps` setting determines whether trap information is collected in a
/// `FaerieTrapManifest` available in the `FaerieProduct`.
///
/// The `libcall_names` function provides a way to translate `cretonne_codegen`'s `ir::LibCall`
/// The `libcall_names` function provides a way to translate `cranelift_codegen`'s `ir::LibCall`
/// enum to symbols. LibCalls are inserted in the IR as part of the legalization for certain
/// floating point instructions, and for stack probes. If you don't know what to use for this
/// argument, use `FaerieBuilder::default_libcall_names()`.
@@ -68,10 +68,10 @@ impl FaerieBuilder {
/// Default names for `ir::LibCall`s. A function by this name is imported into the object as
/// part of the translation of a `ir::ExternalName::LibCall` variant. Calls to a LibCall should
/// only be inserted into the IR by the `cretonne_codegen` legalizer pass.
/// only be inserted into the IR by the `cranelift_codegen` legalizer pass.
pub fn default_libcall_names() -> Box<Fn(ir::LibCall) -> String> {
Box::new(move |libcall| match libcall {
ir::LibCall::Probestack => "__cretonne_probestack".to_owned(),
ir::LibCall::Probestack => "__cranelift_probestack".to_owned(),
ir::LibCall::CeilF32 => "ceilf".to_owned(),
ir::LibCall::CeilF64 => "ceil".to_owned(),
ir::LibCall::FloorF32 => "floorf".to_owned(),
@@ -111,7 +111,7 @@ impl Backend for FaerieBackend {
/// to memory and files.
type Product = FaerieProduct;
/// Create a new `FaerieBackend` using the given Cretonne target.
/// Create a new `FaerieBackend` using the given Cranelift target.
fn new(builder: FaerieBuilder) -> Self {
Self {
artifact: faerie::Artifact::new(builder.isa.triple().clone(), builder.name),
@@ -143,7 +143,7 @@ impl Backend for FaerieBackend {
fn define_function(
&mut self,
name: &str,
ctx: &cretonne_codegen::Context,
ctx: &cranelift_codegen::Context,
namespace: &ModuleNamespace<Self>,
code_size: u32,
) -> ModuleResult<FaerieCompiledFunction> {
@@ -290,7 +290,7 @@ impl Backend for FaerieBackend {
}
/// This is the output of `Module`'s
/// [`finish`](../cretonne_module/struct.Module.html#method.finish) function.
/// [`finish`](../cranelift_module/struct.Module.html#method.finish) function.
/// It provides functions for writing out the object file to memory or a file.
pub struct FaerieProduct {
/// Faerie artifact with all functions, data, and links from the module defined

View File

@@ -1,6 +1,6 @@
//! Utilities for working with Faerie container formats.
use cretonne_codegen::binemit::Reloc;
use cranelift_codegen::binemit::Reloc;
use target_lexicon::{Architecture, BinaryFormat, Triple};
/// An object file format.
@@ -12,7 +12,7 @@ pub enum Format {
MachO,
}
/// Translate from a Cretonne `Reloc` to a raw object-file-format-specific
/// Translate from a Cranelift `Reloc` to a raw object-file-format-specific
/// relocation code and relocation-implied addend.
pub fn raw_relocation(reloc: Reloc, triple: &Triple) -> (u32, i64) {
match triple.binary_format {
@@ -25,7 +25,7 @@ pub fn raw_relocation(reloc: Reloc, triple: &Triple) -> (u32, i64) {
Reloc::Abs4 => elf::reloc::R_X86_64_32,
Reloc::Abs8 => elf::reloc::R_X86_64_64,
Reloc::X86PCRel4 | Reloc::X86CallPCRel4 => elf::reloc::R_X86_64_PC32,
// TODO: Get Cretonne to tell us when we can use
// TODO: Get Cranelift to tell us when we can use
// R_X86_64_GOTPCRELX/R_X86_64_REX_GOTPCRELX.
Reloc::X86CallPLTRel4 => elf::reloc::R_X86_64_PLT32,
Reloc::X86GOTPCRel4 => elf::reloc::R_X86_64_GOTPCREL,

View File

@@ -1,4 +1,4 @@
//! Top-level lib.rs for `cretonne_faerie`.
//! Top-level lib.rs for `cranelift_faerie`.
//!
//! Users of this module should not have to depend on faerie directly.
@@ -14,8 +14,8 @@
)
)]
extern crate cretonne_codegen;
extern crate cretonne_module;
extern crate cranelift_codegen;
extern crate cranelift_module;
extern crate faerie;
extern crate failure;
extern crate goblin;

View File

@@ -1,15 +1,15 @@
//! Faerie trap manifests record every `TrapCode` that cretonne outputs during code generation,
//! Faerie trap manifests record every `TrapCode` that cranelift outputs during code generation,
//! for every function in the module. This data may be useful at runtime.
use cretonne_codegen::{binemit, ir};
use cranelift_codegen::{binemit, ir};
/// Record of the arguments cretonne passes to `TrapSink::trap`
/// Record of the arguments cranelift passes to `TrapSink::trap`
pub struct FaerieTrapSite {
/// Offset into function
pub offset: binemit::CodeOffset,
/// Source location given to cretonne
/// Source location given to cranelift
pub srcloc: ir::SourceLoc,
/// Trap code, as determined by cretonne
/// Trap code, as determined by cranelift
pub code: ir::TrapCode,
}