Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c0059c3

Browse files
committedDec 5, 2021
Feat: update nightly to 2021-12-04 in anticipation for 0.2
1 parent 93d9057 commit c0059c3

File tree

10 files changed

+103
-180
lines changed

10 files changed

+103
-180
lines changed
 

‎crates/cuda_std/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@
2424
#![cfg_attr(
2525
target_os = "cuda",
2626
no_std,
27-
feature(register_attr, alloc_error_handler, asm, link_llvm_intrinsics),
27+
feature(
28+
register_attr,
29+
alloc_error_handler,
30+
asm,
31+
asm_experimental_arch,
32+
link_llvm_intrinsics
33+
),
2834
register_attr(nvvm_internal)
2935
)]
3036

‎crates/rustc_codegen_nvvm/src/abi.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,15 +220,7 @@ impl LlvmType for CastTarget {
220220
let mut args: Vec<_> = self
221221
.prefix
222222
.iter()
223-
.flat_map(|option_kind| {
224-
option_kind.map(|kind| {
225-
Reg {
226-
kind,
227-
size: self.prefix_chunk_size,
228-
}
229-
.llvm_type(cx)
230-
})
231-
})
223+
.flat_map(|option_reg| option_reg.map(|reg| reg.llvm_type(cx)))
232224
.chain((0..rest_count).map(|_| rest_ll_unit))
233225
.collect();
234226

@@ -538,16 +530,18 @@ impl<'a, 'll, 'tcx> AbiBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
538530
fn_abi.apply_attrs_callsite(self, callsite)
539531
}
540532

541-
fn get_param(&self, index: usize) -> Self::Value {
533+
fn get_param(&mut self, index: usize) -> Self::Value {
542534
let val = llvm::get_param(self.llfn(), index as c_uint);
543535
trace!("Get param `{:?}`", val);
544536
unsafe {
545537
let llfnty = LLVMRustGetFunctionType(self.llfn());
546-
let map = self.remapped_integer_args.borrow();
538+
// destructure so rustc doesnt complain in the call to transmute_llval
539+
let Self { cx, llbuilder } = self;
540+
let map = cx.remapped_integer_args.borrow();
547541
if let Some((_, key)) = map.get(llfnty) {
548542
if let Some((_, new_ty)) = key.iter().find(|t| t.0 == index) {
549543
trace!("Casting irregular param {:?} to {:?}", val, new_ty);
550-
return transmute_llval(*self.llbuilder.lock().unwrap(), self.cx, val, *new_ty);
544+
return transmute_llval(llbuilder, cx, val, *new_ty);
551545
}
552546
}
553547
val

‎crates/rustc_codegen_nvvm/src/asm.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_codegen_ssa::{
1414
};
1515
use rustc_hash::FxHashMap;
1616
use rustc_hir::LlvmInlineAsmInner;
17-
use rustc_middle::span_bug;
17+
use rustc_middle::{span_bug, ty::Instance};
1818
use rustc_span::{Pos, Span};
1919
use rustc_target::asm::{InlineAsmRegClass, InlineAsmRegOrRegClass, NvptxInlineAsmRegClass};
2020

@@ -118,6 +118,7 @@ impl<'a, 'll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
118118
operands: &[InlineAsmOperandRef<'tcx, Self>],
119119
options: rustc_ast::InlineAsmOptions,
120120
line_spans: &[Span],
121+
_inst: Instance,
121122
) {
122123
// Collect the types of output operands
123124
let mut constraints = vec![];

‎crates/rustc_codegen_nvvm/src/back.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol) -> (ModuleCodegen
246246
tcx,
247247
cgu_name,
248248
module_codegen,
249-
dep_graph::hash_result,
249+
Some(dep_graph::hash_result),
250250
);
251251

252252
fn module_codegen(tcx: TyCtxt<'_>, cgu_name: Symbol) -> ModuleCodegen<LlvmMod> {

‎crates/rustc_codegen_nvvm/src/builder.rs

Lines changed: 70 additions & 157 deletions
Large diffs are not rendered by default.

‎crates/rustc_codegen_nvvm/src/debug_info/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl<'a, 'll, 'tcx> DebugInfoBuilderMethods for Builder<'a, 'll, 'tcx> {
139139
fn set_dbg_loc(&mut self, dbg_loc: &'ll DILocation) {
140140
unsafe {
141141
let dbg_loc_as_llval = llvm::LLVMRustMetadataAsValue(self.cx().llcx, dbg_loc);
142-
llvm::LLVMSetCurrentDebugLocation(*self.llbuilder.lock().unwrap(), dbg_loc_as_llval);
142+
llvm::LLVMSetCurrentDebugLocation(self.llbuilder, dbg_loc_as_llval);
143143
}
144144
}
145145

@@ -256,7 +256,7 @@ impl<'ll, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
256256
type_names::push_item_name(self.tcx(), def_id, false, &mut name);
257257

258258
// Find the enclosing function, in case this is a closure.
259-
let enclosing_fn_def_id = self.tcx().closure_base_def_id(def_id);
259+
let enclosing_fn_def_id = self.tcx().typeck_root_def_id(def_id);
260260

261261
// Get_template_parameters() will append a `<...>` clause to the function
262262
// name if necessary.

‎crates/rustc_codegen_nvvm/src/intrinsic.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,9 @@ impl<'a, 'll, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> {
466466
)
467467
}
468468

469-
fn sideeffect(&mut self) {
470-
trace!("Generate sideeffect call");
471-
let fnname = self.get_intrinsic("llvm.sideeffect");
472-
self.call(self.type_i1(), fnname, &[], None);
469+
fn type_test(&mut self, _pointer: Self::Value, _typeid: Self::Value) -> Self::Value {
470+
// LLVM CFI doesnt make sense on the GPU
471+
self.const_i32(0)
473472
}
474473

475474
fn va_start(&mut self, va_list: &'ll Value) -> Self::Value {

‎crates/rustc_codegen_nvvm/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl CodegenBackend for NvvmCodegenBackend {
110110
Ok(readjust_fn_abi(tcx, result?))
111111
};
112112
}
113-
fn provide_extern(&self, _providers: &mut query::Providers) {}
113+
fn provide_extern(&self, _providers: &mut query::ExternProviders) {}
114114

115115
fn codegen_crate(
116116
&self,

‎crates/rustc_codegen_nvvm/src/llvm.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,11 +414,15 @@ extern "C" {
414414
pub(crate) type ThinLTOData;
415415
}
416416

417+
unsafe impl Send for ThinLTOData {}
418+
417419
/// LLVMRustThinLTOBuffer
418420
extern "C" {
419421
pub(crate) type ThinLTOBuffer;
420422
}
421423

424+
unsafe impl Send for ThinLTOBuffer {}
425+
422426
/// LLVMRustThinLTOModule
423427
#[repr(C)]
424428
pub(crate) struct ThinLTOModule {
@@ -443,6 +447,9 @@ extern "C" {
443447
extern "C" {
444448
pub type Context;
445449
}
450+
451+
unsafe impl Send for Context {}
452+
446453
extern "C" {
447454
pub(crate) type Type;
448455
}
@@ -468,6 +475,9 @@ pub(crate) struct OperandBundleDef<'a>(InvariantOpaque<'a>);
468475
extern "C" {
469476
pub(crate) type ModuleBuffer;
470477
}
478+
479+
unsafe impl Send for ModuleBuffer {}
480+
471481
#[repr(C)]
472482
pub struct PassManager<'a>(InvariantOpaque<'a>);
473483
extern "C" {

‎rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".
66

77
[toolchain]
8-
channel = "nightly-2021-10-18"
8+
channel = "nightly-2021-12-04"
99
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

0 commit comments

Comments
 (0)
Please sign in to comment.