Skip to content

Commit b1d0e03

Browse files
authored
Merge pull request #19726 from lnicola/sync-from-rust
Sync from downstream again
2 parents 4818031 + eaa8a1b commit b1d0e03

File tree

5 files changed

+20
-14
lines changed

5 files changed

+20
-14
lines changed

src/asm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ fn dummy_output_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, reg: InlineAsmRegCl
829829

830830
impl<'gcc, 'tcx> AsmCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
831831
fn codegen_global_asm(
832-
&self,
832+
&mut self,
833833
template: &[InlineAsmTemplatePiece],
834834
operands: &[GlobalAsmOperandRef<'tcx>],
835835
options: InlineAsmOptions,

src/base.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ pub fn compile_codegen_unit(
206206
let f128_type_supported = target_info.supports_target_dependent_type(CType::Float128);
207207
let u128_type_supported = target_info.supports_target_dependent_type(CType::UInt128t);
208208
// TODO: improve this to avoid passing that many arguments.
209-
let cx = CodegenCx::new(
209+
let mut cx = CodegenCx::new(
210210
&context,
211211
cgu,
212212
tcx,
@@ -223,8 +223,8 @@ pub fn compile_codegen_unit(
223223
}
224224

225225
// ... and now that we have everything pre-defined, fill out those definitions.
226-
for &(mono_item, _) in &mono_items {
227-
mono_item.define::<Builder<'_, '_, '_>>(&cx);
226+
for &(mono_item, item_data) in &mono_items {
227+
mono_item.define::<Builder<'_, '_, '_>>(&mut cx, item_data);
228228
}
229229

230230
// If this codegen unit contains the main function, also create the

src/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ enum ExtremumOperation {
4545
Min,
4646
}
4747

48-
pub struct Builder<'a: 'gcc, 'gcc, 'tcx> {
48+
pub struct Builder<'a, 'gcc, 'tcx> {
4949
pub cx: &'a CodegenCx<'gcc, 'tcx>,
5050
pub block: Block<'gcc>,
5151
pub location: Option<Location<'gcc>>,

src/gcc_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec<Stri
5555
)
5656
} else if let Some(feature) = feature.strip_prefix('-') {
5757
// FIXME: Why do we not remove implied features on "-" here?
58-
// We do the equivalent above in `target_features_cfg`.
58+
// We do the equivalent above in `target_config`.
5959
// See <https://github.com/rust-lang/rust/issues/134792>.
6060
all_rust_features.push((false, feature));
6161
} else if !feature.is_empty() && diagnostics {

src/lib.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ use rustc_codegen_ssa::back::write::{
102102
};
103103
use rustc_codegen_ssa::base::codegen_crate;
104104
use rustc_codegen_ssa::traits::{CodegenBackend, ExtraBackendMethods, WriteBackendMethods};
105-
use rustc_codegen_ssa::{CodegenResults, CompiledModule, ModuleCodegen};
105+
use rustc_codegen_ssa::{CodegenResults, CompiledModule, ModuleCodegen, TargetConfig};
106106
use rustc_data_structures::fx::FxIndexMap;
107107
use rustc_data_structures::sync::IntoDynSyncSend;
108108
use rustc_errors::DiagCtxtHandle;
@@ -260,8 +260,8 @@ impl CodegenBackend for GccCodegenBackend {
260260
.join(sess)
261261
}
262262

263-
fn target_features_cfg(&self, sess: &Session) -> (Vec<Symbol>, Vec<Symbol>) {
264-
target_features_cfg(sess, &self.target_info)
263+
fn target_config(&self, sess: &Session) -> TargetConfig {
264+
target_config(sess, &self.target_info)
265265
}
266266
}
267267

@@ -485,10 +485,7 @@ fn to_gcc_opt_level(optlevel: Option<OptLevel>) -> OptimizationLevel {
485485
}
486486

487487
/// Returns the features that should be set in `cfg(target_feature)`.
488-
fn target_features_cfg(
489-
sess: &Session,
490-
target_info: &LockedTargetInfo,
491-
) -> (Vec<Symbol>, Vec<Symbol>) {
488+
fn target_config(sess: &Session, target_info: &LockedTargetInfo) -> TargetConfig {
492489
// TODO(antoyo): use global_gcc_features.
493490
let f = |allow_unstable| {
494491
sess.target
@@ -523,5 +520,14 @@ fn target_features_cfg(
523520

524521
let target_features = f(false);
525522
let unstable_target_features = f(true);
526-
(target_features, unstable_target_features)
523+
524+
TargetConfig {
525+
target_features,
526+
unstable_target_features,
527+
// There are no known bugs with GCC support for f16 or f128
528+
has_reliable_f16: true,
529+
has_reliable_f16_math: true,
530+
has_reliable_f128: true,
531+
has_reliable_f128_math: true,
532+
}
527533
}

0 commit comments

Comments
 (0)