@@ -4,7 +4,7 @@ use std::collections::HashMap;
44use gccjit:: {
55 Block , CType , Context , Function , FunctionPtrType , FunctionType , LValue , Location , RValue , Type ,
66} ;
7- use rustc_abi:: { HasDataLayout , PointeeInfo , Size , TargetDataLayout , VariantIdx } ;
7+ use rustc_abi:: { Align , HasDataLayout , PointeeInfo , Size , TargetDataLayout , VariantIdx } ;
88use rustc_codegen_ssa:: base:: wants_msvc_seh;
99use rustc_codegen_ssa:: errors as ssa_errors;
1010use rustc_codegen_ssa:: traits:: { BackendTypes , BaseTypeCodegenMethods , MiscCodegenMethods } ;
@@ -135,6 +135,9 @@ pub struct CodegenCx<'gcc, 'tcx> {
135135
136136 #[ cfg( feature = "master" ) ]
137137 pub cleanup_blocks : RefCell < FxHashSet < Block < ' gcc > > > ,
138+ /// The alignment of a u128/i128 type.
139+ // We cache this, since it is needed for alignment checks during loads.
140+ pub int128_align : Align ,
138141}
139142
140143impl < ' gcc , ' tcx > CodegenCx < ' gcc , ' tcx > {
@@ -226,6 +229,11 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
226229 }
227230
228231 let mut cx = Self {
232+ int128_align : tcx
233+ . layout_of ( ty:: TypingEnv :: fully_monomorphized ( ) . as_query_input ( tcx. types . i128 ) )
234+ . expect ( "Can't get the layout of `i128`" )
235+ . align
236+ . abi ,
229237 const_cache : Default :: default ( ) ,
230238 codegen_unit,
231239 context,
0 commit comments