Add serde functionality into lib. (#422)
* Adds decoration to the verifier errors.
example:
function %bad(i32) fast {
ebb0(v0: i32):
brnz.i32 v0, ebb1
return
^~~~~~
verifier inst1: Internal return not allowed with return_at_end=1
ebb1:
trapz.i32 v0, user6
return
}
Fixes #68
* Making it so that pretty_function_error and write_function_plain are both private.
* Changes write_ebb to decorate_ebb.
Adds documentation line to decorate_function.
* Removing Cargo.toml lib/serde addition
* Add serde functionality into lib.
* Fix so code is compatible with Rust version 1.25.0.
* Move ser/de functions to utility file, update description, remove borrow from arms.
* Remove commented out code.
This commit is contained in:
committed by
Dan Gohman
parent
13fea26c95
commit
65a1a6bb28
30
lib/serde/README.md
Normal file
30
lib/serde/README.md
Normal file
@@ -0,0 +1,30 @@
|
||||
This crate performs serialization of the [Cranelift](https://crates.io/crates/cranelift) IR.
|
||||
|
||||
This crate is structured as an optional ability to serialize and deserialize cranelift IR into JSON format.
|
||||
|
||||
Status
|
||||
------
|
||||
|
||||
Cranelift IR can be serialized into JSON.
|
||||
|
||||
Deserialize is a work in progress, as it currently deserializes into the serializable data structure that can be utilized by serde instead of the actual Cranelift IR data structure.
|
||||
|
||||
|
||||
Building and Using Cranelift Serde
|
||||
----------------------------------
|
||||
|
||||
clif-json usage:
|
||||
|
||||
clif-json serialize [-p] <file>
|
||||
clif-json deserialize <file>
|
||||
|
||||
Where the -p flag outputs Cranelift IR as pretty JSON.
|
||||
|
||||
For example to build and use clif-json:
|
||||
|
||||
``` {.sourceCode .sh}
|
||||
cd lib/serde
|
||||
cargo build
|
||||
clif-json serialize -p test.clif
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user