Make cretonne-codegen's `result` module private, and instead just export
`CodegenError` and `CodegenResult` at the top level of the
cretonne-codegen crate. This makes them more consistent with Result and
Error types in other cretonne crates.
This switches from a custom list of architectures to use the
target-lexicon crate.
- "set is_64bit=1; isa x86" is replaced with "target x86_64", and
similar for other architectures, and the `is_64bit` flag is removed
entirely.
- The `is_compressed` flag is removed too; it's no longer being used to
control REX prefixes on x86-64, ARM and Thumb are separate
architectures in target-lexicon, and we can figure out how to
select RISC-V compressed encodings when we're ready.
* Update to rustfmt-preview.
* Run "cargo fmt --all" with rustfmt 0.4.1.
rustfmt 0.4.1 is the latest release of rustfmt-preview available on the
stable channel.
* Fix a long line that rustfmt 0.4.1 can't handle.
* Remove unneeded commas left behind by rustfmt.
* test-no_std: use cargo +nightly
assume folks have rustup set to use stable by default
* cretonne-module, -faerie, -simplejit: use new ModuleError enum
CtonError is not really appropriate for use in the module system.
Instead, create a new enum ModuleError, which implements failure::Fail
(works with no_std). Translate existing panics and unimplemented
error cases to return ModuleErrors.
* cretonne-faerie: export FaerieProduct
* cretonne-module: expose FuncOrDataId, and Module::get_name to lookup
This is helpful for looking up a name that has already been declared.
Also, implement FuncOrDataId -> ExternalName conversion.
* cretonne-faerie: depend on faerie 0.3.0
which has bugfix for data relocations
* cretonne-module: change InvalidDefinition to InvalidImportDefinition
per dan's code review. plus another typo fix
* cretonne-faerie: add optional manifest of all traps from codegen
* cretonne-module: provide more context in panics
* cretonne-faerie: updates to docs
* cretonne-faerie: return an Err instead of debug_assert when isa not pic
These are the main obvious place where ExternalName is exposed in the
Module API, so add comments advising users that they can use Module to
call these functions with the appropriate ExternalNames automatically.
This eliminates API confusion and surface area with respect to what state
the `Backend` needs to be in at different points.
Now, API users will construct a `Builder`, and pass it into the `Module`
which uses it to constrct a `Backend`. The `Backend` instance only lives
inside the `Module`. And when finished, the `Module` can return a
`Product` back to the user providing any outputs it has.
It turns out that "cargo test --release" doesn't use
`[profile.release]`; it uses `[profile.bench]` instead; see
[here](https://doc.rust-lang.org/cargo/reference/manifest.html) for details.
So the plan to run the tests in optimized mode but with debug-assertions
enabled didn't actually work, and we had an actual failing unit test that
was hidden because assertions were disabled.
So, this makes test-all.sh just run the unit tests in debug mode, as is
the norm for Rust packages, and fixes the buggy test.
This also removes the `[profile.release]` override from the top-level
Cargo.toml file too. We don't need it now that we're not running tests
in release mode, and it had confused multiple people because it made
Cretonne's in-tree builds different from how Cretonne is built when used as
a dependency in other projects.
* Initial skeleton.
* Add basic faerie support.
This adds enough functionality to enable simple .o file writing through
faerie. This included adding the functionality to Module to support
RelocSink implementations.
* Add basic SimpleJIT support.
This adds enough functionality to enable a simple program to be jitted
and executed.
* Make declare_func_in_func take a Function instead of a Context.
It only needs the Function, and sometimes it's useful to call it from
places that don't have a full Context.
* Temporarily disable local and exported global variables in the Faerie backend.
Faerie assumes these variables use pc-relative offset instructions, and
Cretonne is not yet emitting those instructions.
* FaerieBackend depends on PIC.
Faerie itself only supports PIC objects for now, so add an assert to
Cretonne to check that it's using a PIC target flag.
* SimpleJIT support for data objects.
* Preliminary faerie support for data objects.
* Support for data objects in faerie using the new colocated flag.
* Unit tests for DataContext and friends.
* Add a Module::consume() function.
This consumes the Module and returns the contained Backend, so that
users can call Backend-specific functions with it. For example, the
Faerie backend has functions to write an object file.
* Update the new crates to version 0.4.4.
* Make FaerieBackend own its TargetIsa.
This simplifies its interface, as it eliminates a lifetime parameter.
While we may eventually want to look into allowing multiple clients to
share a TargetIsa, it isn't worth the complexity for FaerieBackend
right now.
* Don't try to protect faerie from multiple declarations.
Let faerie decide for itself whether it wants to consider two
declarations to be compatible.
* Use debug_assert_eq rather than debug_assert with ==.
* Fix FaerieRelocSink's reloc_external to handle data object names.
* Relax the asserts in get_function_definition and get_data_definition.
These functions don't require definable symbols, but they do require
that definable symbols be defined. This is needed for the simplejit
backend.
* Add a function to the faerie backend to retrieve the artifact name.
* Sync up with cretonne changes.