Skip to content

Commit 92f765f

Browse files
committed
Remove support for x86 oldBE
1 parent c39cb46 commit 92f765f

File tree

7 files changed

+26
-68
lines changed

7 files changed

+26
-68
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
os: [ubuntu-latest, macos-latest]
15-
env:
16-
- BACKEND: ""
17-
- BACKEND: --oldbe
1815

1916
steps:
2017
- uses: actions/checkout@v2
@@ -54,7 +51,7 @@ jobs:
5451
export COMPILE_RUNS=2
5552
export RUN_RUNS=2
5653
57-
./test.sh $BACKEND
54+
./test.sh
5855
5956
- name: Package prebuilt cg_clif
6057
run: tar cvfJ cg_clif.tar.xz build

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ crate-type = ["dylib"]
99

1010
[dependencies]
1111
# These have to be in sync with each other
12-
cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", features = ["unwind", "x86", "x64"] }
12+
cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", features = ["unwind", "x64"] }
1313
cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
1414
cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
1515
cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", optional = true }
@@ -38,7 +38,6 @@ smallvec = "1.6.1"
3838
default = ["jit", "inline_asm"]
3939
jit = ["cranelift-jit", "libloading"]
4040
inline_asm = []
41-
oldbe = []
4241

4342
[profile.dev]
4443
# By compiling dependencies with optimizations, performing tests gets much faster.

build.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ set -e
55
export CHANNEL="release"
66
build_sysroot="clif"
77
target_dir='build'
8-
oldbe=''
98
while [[ $# != 0 ]]; do
109
case $1 in
1110
"--debug")
@@ -19,12 +18,9 @@ while [[ $# != 0 ]]; do
1918
target_dir=$2
2019
shift
2120
;;
22-
"--oldbe")
23-
oldbe='--features oldbe'
24-
;;
2521
*)
2622
echo "Unknown flag '$1'"
27-
echo "Usage: ./build.sh [--debug] [--sysroot none|clif|llvm] [--target-dir DIR] [--oldbe]"
23+
echo "Usage: ./build.sh [--debug] [--sysroot none|clif|llvm] [--target-dir DIR]"
2824
exit 1
2925
;;
3026
esac
@@ -44,9 +40,9 @@ else
4440
exit 1
4541
fi
4642
if [[ "$CHANNEL" == "release" ]]; then
47-
cargo build $oldbe --release
43+
cargo build --release
4844
else
49-
cargo build $oldbe
45+
cargo build
5046
fi
5147

5248
source scripts/ext_config.sh

src/base.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,12 @@ pub(crate) fn codegen_fn<'tcx>(
149149
&clif_comments,
150150
);
151151

152-
if let Some(mach_compile_result) = &context.mach_compile_result {
153-
if let Some(disasm) = &mach_compile_result.disasm {
154-
crate::pretty_clif::write_ir_file(
155-
tcx,
156-
&format!("{}.vcode", tcx.symbol_name(instance).name),
157-
|file| file.write_all(disasm.as_bytes()),
158-
)
159-
}
152+
if let Some(disasm) = &context.mach_compile_result.as_ref().unwrap().disasm {
153+
crate::pretty_clif::write_ir_file(
154+
tcx,
155+
&format!("{}.vcode", tcx.symbol_name(instance).name),
156+
|file| file.write_all(disasm.as_bytes()),
157+
)
160158
}
161159

162160
// Define debuginfo for function

src/debuginfo/line_info.rs

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ impl<'tcx> DebugContext<'tcx> {
129129

130130
pub(super) fn create_debug_lines(
131131
&mut self,
132-
isa: &dyn cranelift_codegen::isa::TargetIsa,
133132
symbol: usize,
134133
entry_id: UnitEntryId,
135134
context: &Context,
@@ -138,7 +137,6 @@ impl<'tcx> DebugContext<'tcx> {
138137
) -> CodeOffset {
139138
let tcx = self.tcx;
140139
let line_program = &mut self.dwarf.unit.line_program;
141-
let func = &context.func;
142140

143141
let line_strings = &mut self.dwarf.line_strings;
144142
let mut last_span = None;
@@ -202,43 +200,22 @@ impl<'tcx> DebugContext<'tcx> {
202200

203201
let mut func_end = 0;
204202

205-
if let Some(ref mcr) = &context.mach_compile_result {
206-
for &MachSrcLoc { start, end, loc } in mcr.buffer.get_srclocs_sorted() {
207-
line_program.row().address_offset = u64::from(start);
208-
if !loc.is_default() {
209-
let source_info = *source_info_set.get_index(loc.bits() as usize).unwrap();
210-
create_row_for_span(line_program, source_info.span);
211-
} else {
212-
create_row_for_span(line_program, function_span);
213-
}
214-
func_end = end;
215-
}
216-
217-
line_program.end_sequence(u64::from(func_end));
218-
219-
func_end = mcr.buffer.total_size();
220-
} else {
221-
let encinfo = isa.encoding_info();
222-
let mut blocks = func.layout.blocks().collect::<Vec<_>>();
223-
blocks.sort_by_key(|block| func.offsets[*block]); // Ensure inst offsets always increase
224-
225-
for block in blocks {
226-
for (offset, inst, size) in func.inst_offsets(block, &encinfo) {
227-
let srcloc = func.srclocs[inst];
228-
line_program.row().address_offset = u64::from(offset);
229-
if !srcloc.is_default() {
230-
let source_info =
231-
*source_info_set.get_index(srcloc.bits() as usize).unwrap();
232-
create_row_for_span(line_program, source_info.span);
233-
} else {
234-
create_row_for_span(line_program, function_span);
235-
}
236-
func_end = offset + size;
237-
}
203+
let mcr = context.mach_compile_result.as_ref().unwrap();
204+
for &MachSrcLoc { start, end, loc } in mcr.buffer.get_srclocs_sorted() {
205+
line_program.row().address_offset = u64::from(start);
206+
if !loc.is_default() {
207+
let source_info = *source_info_set.get_index(loc.bits() as usize).unwrap();
208+
create_row_for_span(line_program, source_info.span);
209+
} else {
210+
create_row_for_span(line_program, function_span);
238211
}
239-
line_program.end_sequence(u64::from(func_end));
212+
func_end = end;
240213
}
241214

215+
line_program.end_sequence(u64::from(func_end));
216+
217+
let func_end = mcr.buffer.total_size();
218+
242219
assert_ne!(func_end, 0);
243220

244221
let entry = self.dwarf.unit.get_mut(entry_id);

src/debuginfo/mod.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,18 +252,13 @@ impl<'tcx> DebugContext<'tcx> {
252252
AttributeValue::StringRef(name_id),
253253
);
254254

255-
let end =
256-
self.create_debug_lines(isa, symbol, entry_id, context, mir.span, source_info_set);
255+
let end = self.create_debug_lines(symbol, entry_id, context, mir.span, source_info_set);
257256

258257
self.unit_range_list.0.push(Range::StartLength {
259258
begin: Address::Symbol { symbol, addend: 0 },
260259
length: u64::from(end),
261260
});
262261

263-
if isa.get_mach_backend().is_some() {
264-
return; // Not yet implemented for the AArch64 backend.
265-
}
266-
267262
let func_entry = self.dwarf.unit.get_mut(entry_id);
268263
// Gdb requires both DW_AT_low_pc and DW_AT_high_pc. Otherwise the DW_TAG_subprogram is skipped.
269264
func_entry.set(

src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,7 @@ fn build_isa(sess: &Session) -> Box<dyn isa::TargetIsa + 'static> {
343343

344344
let flags = settings::Flags::new(flags_builder);
345345

346-
let variant = if cfg!(feature = "oldbe") {
347-
cranelift_codegen::isa::BackendVariant::Legacy
348-
} else {
349-
cranelift_codegen::isa::BackendVariant::MachInst
350-
};
346+
let variant = cranelift_codegen::isa::BackendVariant::MachInst;
351347
let mut isa_builder = cranelift_codegen::isa::lookup_variant(target_triple, variant).unwrap();
352348
// Don't use "haswell", as it implies `has_lzcnt`.macOS CI is still at Ivy Bridge EP, so `lzcnt`
353349
// is interpreted as `bsr`.

0 commit comments

Comments
 (0)