Use opt_level instead of is_compressed for encoding optimizations.

Choosing smaller instruction encodings on eg. x86 is an optimization,
rather than a useful discrete setting.

Use "is_compressed" only for ISAs that have an explicit compression feature
that users of the output may to be aware of, such as RISC-V's RVC or
ARM's Thumb-2.
This commit is contained in:
Dan Gohman
2018-04-19 16:20:01 -07:00
parent fd8df67cfd
commit 583ae56fd2
10 changed files with 13 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
; binary emission of 32-bit code.
test binemit
set is_compressed
set opt_level=best
set allones_funcaddrs
isa x86 haswell

View File

@@ -1,7 +1,7 @@
; binary emission of 64-bit code.
test binemit
set is_64bit
set is_compressed
set opt_level=best
set allones_funcaddrs
isa x86 haswell

View File

@@ -1,7 +1,6 @@
test binemit
set is_64bit
set is_compressed
set opt_level=best
isa x86 baseline
; The binary encodings can be verified with the command:

View File

@@ -1,6 +1,6 @@
; binary emission of x86-32 code.
test binemit
set is_compressed
set opt_level=best
isa x86 haswell
; The binary encodings can be verified with the command:

View File

@@ -1,7 +1,7 @@
; Binary emission of 64-bit floating point code.
test binemit
set is_64bit
set is_compressed
set opt_level=best
isa x86 haswell
; The binary encodings can be verified with the command:

View File

@@ -1,7 +1,7 @@
; binary emission of 64-bit code.
test binemit
set is_64bit
set is_compressed
set opt_level=best
set is_pic
isa x86 haswell

View File

@@ -1,7 +1,7 @@
; binary emission of x86-64 code.
test binemit
set is_64bit
set is_compressed
set opt_level=best
isa x86 haswell
; The binary encodings can be verified with the command:

View File

@@ -1,7 +1,7 @@
; Test legalization of a non-colocated call in 64-bit non-PIC mode.
test legalizer
set is_64bit
set is_compressed
set opt_level=best
isa x86 haswell
function %call() {

View File

@@ -1,6 +1,6 @@
test compile
set is_64bit
set is_compressed
set opt_level=best
set is_pic
isa x86 haswell

View File

@@ -9,6 +9,7 @@ use cretonne_codegen::dbg::DisplayList;
use cretonne_codegen::ir;
use cretonne_codegen::ir::entities::AnyEntity;
use cretonne_codegen::print_errors::pretty_error;
use cretonne_codegen::settings::OptLevel;
use cretonne_reader::TestCommand;
use match_directive::match_directive;
use std::borrow::Cow;
@@ -121,7 +122,7 @@ impl SubTest for TestBinEmit {
.min();
func.stack_slots.frame_size = min_offset.map(|off| (-off) as u32);
let is_compressed = isa.flags().is_compressed();
let opt_level = isa.flags().opt_level();
// Give an encoding to any instruction that doesn't already have one.
let mut divert = RegDiversions::new();
@@ -141,11 +142,11 @@ impl SubTest for TestBinEmit {
recipe_constraints.satisfied(inst, &divert, &func)
});
if is_compressed {
if opt_level == OptLevel::Best {
// Get the smallest legal encoding
legal_encodings.min_by_key(|&e| encinfo.bytes(e))
} else {
// If not using compressed, just use the first encoding.
// If not optimizing, just use the first encoding.
legal_encodings.next()
}
}