Skip to content

Commit cd75da1

Browse files
committed
Fix formatting
1 parent b765157 commit cd75da1

File tree

5 files changed

+87
-56
lines changed

5 files changed

+87
-56
lines changed

src/builder.rs

+16-6
Original file line numberDiff line numberDiff line change
@@ -1018,19 +1018,21 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
10181018
let llty = place.layout.scalar_pair_element_gcc_type(self, i);
10191019
let load = self.load(llty, llptr, align);
10201020
scalar_load_metadata(self, load, scalar);
1021-
if scalar.is_bool() { self.trunc(load, self.type_i1()) } else { load }
1021+
if scalar.is_bool() {
1022+
self.trunc(load, self.type_i1())
1023+
} else {
1024+
load
1025+
}
10221026
};
10231027

10241028
OperandValue::Pair(
10251029
load(0, a, place.align),
10261030
load(1, b, place.align.restrict_for_offset(b_offset)),
10271031
)
1028-
}
1029-
else {
1032+
} else {
10301033
OperandValue::Ref(place.llval, None, place.align)
10311034
};
10321035

1033-
10341036
OperandRef { val, layout: place.layout }
10351037
}
10361038

@@ -2075,7 +2077,11 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
20752077
self.vector_reduce(src, |a, b, context| context.new_binary_op(loc, op, a.get_type(), a, b))
20762078
}
20772079

2078-
pub fn vector_reduce_fadd_reassoc(&mut self, _acc: RValue<'gcc>, _src: RValue<'gcc>) -> RValue<'gcc> {
2080+
pub fn vector_reduce_fadd_reassoc(
2081+
&mut self,
2082+
_acc: RValue<'gcc>,
2083+
_src: RValue<'gcc>,
2084+
) -> RValue<'gcc> {
20792085
unimplemented!();
20802086
}
20812087

@@ -2102,7 +2108,11 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
21022108
unimplemented!();
21032109
}
21042110

2105-
pub fn vector_reduce_fmul_reassoc(&mut self, _acc: RValue<'gcc>, _src: RValue<'gcc>) -> RValue<'gcc> {
2111+
pub fn vector_reduce_fmul_reassoc(
2112+
&mut self,
2113+
_acc: RValue<'gcc>,
2114+
_src: RValue<'gcc>,
2115+
) -> RValue<'gcc> {
21062116
unimplemented!();
21072117
}
21082118

src/errors.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use rustc_errors::{
2-
DiagCtxt, Diag, EmissionGuarantee, IntoDiagnostic, Level,
3-
};
1+
use rustc_errors::{Diag, DiagCtxt, EmissionGuarantee, IntoDiagnostic, Level};
42
use rustc_macros::{Diagnostic, Subdiagnostic};
53
use rustc_span::Span;
64

src/intrinsic/mod.rs

+42-40
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ use rustc_middle::bug;
2222
use rustc_middle::ty::layout::LayoutOf;
2323
#[cfg(feature = "master")]
2424
use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt};
25-
use rustc_span::{Span, Symbol, sym};
26-
use rustc_target::abi::HasDataLayout;
2725
use rustc_middle::ty::{self, Instance, Ty};
26+
use rustc_span::{sym, Span, Symbol};
2827
use rustc_target::abi::call::{ArgAbi, FnAbi, PassMode};
28+
use rustc_target::abi::HasDataLayout;
2929
#[cfg(feature = "master")]
3030
use rustc_target::spec::abi::Abi;
3131
use rustc_target::spec::PanicStrategy;
@@ -122,44 +122,46 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
122122
let result = PlaceRef::new_sized(llresult, fn_abi.ret.layout);
123123

124124
let simple = get_simple_intrinsic(self, name);
125-
let llval =
126-
match name {
127-
_ if simple.is_some() => {
128-
// FIXME(antoyo): remove this cast when the API supports function.
129-
let func = unsafe { std::mem::transmute(simple.expect("simple")) };
130-
self.call(self.type_void(), None, None, func, &args.iter().map(|arg| arg.immediate()).collect::<Vec<_>>(), None)
131-
},
132-
sym::likely => {
133-
self.expect(args[0].immediate(), true)
134-
}
135-
sym::unlikely => {
136-
self.expect(args[0].immediate(), false)
137-
}
138-
sym::is_val_statically_known => {
139-
let a = args[0].immediate();
140-
let builtin = self.context.get_builtin_function("__builtin_constant_p");
141-
let res = self.context.new_call(None, builtin, &[a]);
142-
self.icmp(IntPredicate::IntEQ, res, self.const_i32(0))
143-
}
144-
sym::catch_unwind => {
145-
try_intrinsic(
146-
self,
147-
args[0].immediate(),
148-
args[1].immediate(),
149-
args[2].immediate(),
150-
llresult,
151-
);
152-
return Ok(());
153-
}
154-
sym::breakpoint => {
155-
unimplemented!();
156-
}
157-
sym::va_copy => {
158-
unimplemented!();
159-
}
160-
sym::va_arg => {
161-
unimplemented!();
162-
}
125+
let llval = match name {
126+
_ if simple.is_some() => {
127+
// FIXME(antoyo): remove this cast when the API supports function.
128+
let func = unsafe { std::mem::transmute(simple.expect("simple")) };
129+
self.call(
130+
self.type_void(),
131+
None,
132+
None,
133+
func,
134+
&args.iter().map(|arg| arg.immediate()).collect::<Vec<_>>(),
135+
None,
136+
)
137+
}
138+
sym::likely => self.expect(args[0].immediate(), true),
139+
sym::unlikely => self.expect(args[0].immediate(), false),
140+
sym::is_val_statically_known => {
141+
let a = args[0].immediate();
142+
let builtin = self.context.get_builtin_function("__builtin_constant_p");
143+
let res = self.context.new_call(None, builtin, &[a]);
144+
self.icmp(IntPredicate::IntEQ, res, self.const_i32(0))
145+
}
146+
sym::catch_unwind => {
147+
try_intrinsic(
148+
self,
149+
args[0].immediate(),
150+
args[1].immediate(),
151+
args[2].immediate(),
152+
llresult,
153+
);
154+
return Ok(());
155+
}
156+
sym::breakpoint => {
157+
unimplemented!();
158+
}
159+
sym::va_copy => {
160+
unimplemented!();
161+
}
162+
sym::va_arg => {
163+
unimplemented!();
164+
}
163165

164166
sym::volatile_load | sym::unaligned_volatile_load => {
165167
let tp_ty = fn_args.type_at(0);

src/type_.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
123123
fn type_f16(&self) -> Type<'gcc> {
124124
unimplemented!("f16_f128")
125125
}
126-
126+
127127
fn type_f32(&self) -> Type<'gcc> {
128128
self.float_type
129129
}
130130

131131
fn type_f64(&self) -> Type<'gcc> {
132132
self.double_type
133133
}
134-
134+
135135
fn type_f128(&self) -> Type<'gcc> {
136136
unimplemented!("f16_f128")
137137
}

src/type_of.rs

+26-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ use gccjit::{Struct, Type};
55
use rustc_middle::bug;
66
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
77
use rustc_middle::ty::print::with_no_trimmed_paths;
8-
use rustc_target::abi::{self, Abi, Align, F16, F128, F32, F64, FieldsShape, Int, Integer, Pointer, PointeeInfo, Size, TyAbiInterface, Variants};
98
use rustc_middle::ty::{self, Ty, TypeVisitableExt};
109
use rustc_target::abi::call::{CastTarget, FnAbi, Reg};
10+
use rustc_target::abi::{
11+
self, Abi, Align, FieldsShape, Int, Integer, PointeeInfo, Pointer, Size, TyAbiInterface,
12+
Variants, F128, F16, F32, F64,
13+
};
1114

1215
use crate::abi::{FnAbiGcc, FnAbiGccExt, GccType};
1316
use crate::context::CodegenCx;
@@ -157,9 +160,22 @@ pub trait LayoutGccExt<'tcx> {
157160
fn is_gcc_scalar_pair(&self) -> bool;
158161
fn gcc_type<'gcc>(&self, cx: &CodegenCx<'gcc, 'tcx>) -> Type<'gcc>;
159162
fn immediate_gcc_type<'gcc>(&self, cx: &CodegenCx<'gcc, 'tcx>) -> Type<'gcc>;
160-
fn scalar_gcc_type_at<'gcc>(&self, cx: &CodegenCx<'gcc, 'tcx>, scalar: &abi::Scalar, offset: Size) -> Type<'gcc>;
161-
fn scalar_pair_element_gcc_type<'gcc>(&self, cx: &CodegenCx<'gcc, 'tcx>, index: usize) -> Type<'gcc>;
162-
fn pointee_info_at<'gcc>(&self, cx: &CodegenCx<'gcc, 'tcx>, offset: Size) -> Option<PointeeInfo>;
163+
fn scalar_gcc_type_at<'gcc>(
164+
&self,
165+
cx: &CodegenCx<'gcc, 'tcx>,
166+
scalar: &abi::Scalar,
167+
offset: Size,
168+
) -> Type<'gcc>;
169+
fn scalar_pair_element_gcc_type<'gcc>(
170+
&self,
171+
cx: &CodegenCx<'gcc, 'tcx>,
172+
index: usize,
173+
) -> Type<'gcc>;
174+
fn pointee_info_at<'gcc>(
175+
&self,
176+
cx: &CodegenCx<'gcc, 'tcx>,
177+
offset: Size,
178+
) -> Option<PointeeInfo>;
163179
}
164180

165181
impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
@@ -341,7 +357,12 @@ impl<'gcc, 'tcx> LayoutTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
341357
layout.is_gcc_scalar_pair()
342358
}
343359

344-
fn scalar_pair_element_backend_type(&self, layout: TyAndLayout<'tcx>, index: usize, _immediate: bool) -> Type<'gcc> {
360+
fn scalar_pair_element_backend_type(
361+
&self,
362+
layout: TyAndLayout<'tcx>,
363+
index: usize,
364+
_immediate: bool,
365+
) -> Type<'gcc> {
345366
layout.scalar_pair_element_gcc_type(self, index)
346367
}
347368

0 commit comments

Comments
 (0)