|
|
@@ -59,34 +59,16 @@ fn main() {
|
|
|
.multiple(true),
|
|
|
)
|
|
|
.arg(
|
|
|
- Arg::with_name("CFG")
|
|
|
- .help("emit Control Flow Graph")
|
|
|
- .long("emit-cfg")
|
|
|
- .group("EMIT"),
|
|
|
- )
|
|
|
- .arg(
|
|
|
- Arg::with_name("LLVM")
|
|
|
- .help("emit llvm IR rather than WASM")
|
|
|
- .long("emit-llvm")
|
|
|
- .group("EMIT"),
|
|
|
- )
|
|
|
- .arg(
|
|
|
- Arg::with_name("LLVM-BC")
|
|
|
- .help("emit llvm BC rather than WASM")
|
|
|
- .long("emit-bc")
|
|
|
- .group("EMIT"),
|
|
|
- )
|
|
|
- .arg(
|
|
|
- Arg::with_name("OBJECT")
|
|
|
- .help("emit WASM object file")
|
|
|
- .long("emit-object")
|
|
|
- .group("EMIT"),
|
|
|
+ Arg::with_name("EMIT")
|
|
|
+ .help("Emit compiler state at early stage")
|
|
|
+ .long("emit")
|
|
|
+ .takes_value(true)
|
|
|
+ .possible_values(&["cfg", "llvm", "bc", "object"]),
|
|
|
)
|
|
|
.arg(
|
|
|
Arg::with_name("STD-JSON")
|
|
|
.help("mimic solidity json output on stdout")
|
|
|
.long("standard-json")
|
|
|
- .group("EMIT"),
|
|
|
)
|
|
|
.arg(
|
|
|
Arg::with_name("VERBOSE")
|
|
|
@@ -158,7 +140,7 @@ fn main() {
|
|
|
|
|
|
// emit phase
|
|
|
for contract in &contracts {
|
|
|
- if matches.is_present("CFG") {
|
|
|
+ if let Some("cfg") = matches.value_of("EMIT") {
|
|
|
println!("{}", contract.to_string());
|
|
|
continue;
|
|
|
}
|
|
|
@@ -167,12 +149,12 @@ fn main() {
|
|
|
|
|
|
let contract = emit::Contract::new(contract, &filename);
|
|
|
|
|
|
- if matches.is_present("LLVM") {
|
|
|
+ if let Some("llvm") = matches.value_of("EMIT") {
|
|
|
contract.dump_llvm();
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- if matches.is_present("LLVM-BC") {
|
|
|
+ if let Some("bc") = matches.value_of("EMIT") {
|
|
|
let bc = contract.bitcode();
|
|
|
let bc_filename = output_file(&contract.name, "bc");
|
|
|
|
|
|
@@ -189,7 +171,7 @@ fn main() {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- if matches.is_present("OBJECT") {
|
|
|
+ if let Some("object") = matches.value_of("EMIT") {
|
|
|
let obj_filename = output_file(&contract.name, "o");
|
|
|
|
|
|
let mut file = File::create(obj_filename).unwrap();
|