mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-12 15:11:02 +00:00
@@ -8,4 +8,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
hex = { workspace = true }
|
||||
evmil = { workspace = true }
|
||||
revive-ir = { path = "../ir" }
|
||||
|
||||
revive-ir = { path = "../ir" }
|
||||
revive-codegen = { path = "../codegen" }
|
||||
revive-target-polkavm = { path = "../target-polkavm" }
|
||||
+13
-2
@@ -1,10 +1,21 @@
|
||||
use evmil::bytecode::Disassemble;
|
||||
use revive_ir::cfg::{BasicBlockFormatOption, Program};
|
||||
use revive_ir::cfg::BasicBlockFormatOption;
|
||||
use revive_target_polkavm::PolkaVm;
|
||||
|
||||
fn main() {
|
||||
let hexcode = std::fs::read_to_string(std::env::args().nth(1).unwrap()).unwrap();
|
||||
let bytecode = hex::decode(hexcode.trim()).unwrap();
|
||||
let instructions = bytecode.disassemble();
|
||||
|
||||
Program::new(instructions).dot(BasicBlockFormatOption::ByteCode);
|
||||
let mut ir = revive_ir::cfg::Program::new(&instructions);
|
||||
ir.optimize();
|
||||
ir.dot(BasicBlockFormatOption::Ir);
|
||||
|
||||
let target = PolkaVm::default();
|
||||
let program = revive_codegen::program::Program::new(&target).unwrap();
|
||||
program.emit(ir);
|
||||
|
||||
let artifact = program.compile_and_link();
|
||||
|
||||
std::fs::write("/tmp/out.pvm", artifact).unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user