Skip to content

Commit

Permalink
Remove support for datalayout upgrade
Browse files Browse the repository at this point in the history
Only keep the downgrade code
  • Loading branch information
nikic committed Jan 7, 2020
1 parent 8b19922 commit c9e996f
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/librustc_codegen_llvm/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,6 @@ fn strip_x86_address_spaces(data_layout: String) -> String {
data_layout.replace("-p270:32:32-p271:32:32-p272:64:64-", "-")
}

fn add_x86_address_spaces(mut data_layout: String) -> String {
let address_spaces = "-p270:32:32-p271:32:32-p272:64:64";
if !data_layout.contains(address_spaces) && data_layout.starts_with("e-m:") {
let mut insert_pos = "e-m:?".len();
if data_layout[insert_pos..].starts_with("-p:32:32") {
insert_pos += "-p:32:32".len();
}
data_layout.insert_str(insert_pos, address_spaces);
}
data_layout
}

pub unsafe fn create_module(
tcx: TyCtxt<'_>,
llcx: &'ll llvm::Context,
Expand All @@ -172,11 +160,9 @@ pub unsafe fn create_module(
if llvm_util::get_major_version() < 9 {
target_data_layout = strip_function_ptr_alignment(target_data_layout);
}
if sess.target.target.arch == "x86" || sess.target.target.arch == "x86_64" {
if llvm_util::get_major_version() < 10 {
if llvm_util::get_major_version() < 10 {
if sess.target.target.arch == "x86" || sess.target.target.arch == "x86_64" {
target_data_layout = strip_x86_address_spaces(target_data_layout);
} else {
target_data_layout = add_x86_address_spaces(target_data_layout);
}
}

Expand Down

0 comments on commit c9e996f

Please sign in to comment.