Skip to content

Commit f33f9d4

Browse files
committed
---
yaml --- r: 276571 b: refs/heads/try c: 7bc6c75 h: refs/heads/master i: 276569: 7feea67 276567: c7857ba
1 parent cec0ced commit f33f9d4

File tree

6 files changed

+70
-95
lines changed

6 files changed

+70
-95
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 6dbb0e86aec11050480beb76eade6fb805010ba7
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
4-
refs/heads/try: 65bc9d77308e55321f36f7c8381a98ed10f93f6a
4+
refs/heads/try: 7bc6c75d0f6ec012e8baa1f59f80d2c53faefd3b
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/bootstrap/build/native.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ pub fn llvm(build: &Build, target: &str) {
3939

4040
let _ = fs::remove_dir_all(&dst.join("build"));
4141
t!(fs::create_dir_all(&dst.join("build")));
42-
let assertions = if build.config.llvm_assertions {"ON"} else {"OFF"};
42+
let mut assertions = if build.config.llvm_assertions {"ON"} else {"OFF"};
43+
44+
// Disable LLVM assertions on ARM compilers until #32360 is fixed
45+
if target.contains("arm") && target.contains("gnu") {
46+
assertions = "OFF";
47+
}
4348

4449
// http://llvm.org/docs/CMake.html
4550
let mut cfg = cmake::Config::new(build.src.join("src/llvm"));

branches/try/src/librustc_llvm/lib.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -964,10 +964,9 @@ extern {
964964
pub fn LLVMAddFunctionAttrStringValue(Fn: ValueRef, index: c_uint,
965965
Name: *const c_char,
966966
Value: *const c_char);
967-
pub fn LLVMRemoveFunctionAttributes(Fn: ValueRef, index: c_uint, attr: uint64_t);
968967
pub fn LLVMRemoveFunctionAttrString(Fn: ValueRef, index: c_uint, Name: *const c_char);
969-
pub fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_uint;
970-
pub fn LLVMRemoveFunctionAttr(Fn: ValueRef, val: c_uint);
968+
pub fn LLVMGetFunctionAttr(Fn: ValueRef) -> c_ulonglong;
969+
pub fn LLVMRemoveFunctionAttr(Fn: ValueRef, val: c_ulonglong);
971970

972971
/* Operations on parameters */
973972
pub fn LLVMCountParams(Fn: ValueRef) -> c_uint;
@@ -2185,13 +2184,6 @@ pub fn SetFunctionAttribute(fn_: ValueRef, attr: Attribute) {
21852184
}
21862185
}
21872186

2188-
pub fn RemoveFunctionAttributes(fn_: ValueRef, attr: Attribute) {
2189-
unsafe {
2190-
LLVMRemoveFunctionAttributes(fn_, FunctionIndex as c_uint,
2191-
attr.bits() as uint64_t)
2192-
}
2193-
}
2194-
21952187
/* Memory-managed interface to target data. */
21962188

21972189
pub struct TargetData {

branches/try/src/librustc_resolve/build_reduced_graph.rs

Lines changed: 36 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use ParentLink::{ModuleParentLink, BlockParentLink};
2424
use Resolver;
2525
use {resolve_error, resolve_struct_error, ResolutionError};
2626

27-
use rustc::middle::cstore::{CrateStore, ChildItem, DlDef, DlField, DlImpl};
27+
use rustc::middle::cstore::{CrateStore, ChildItem, DlDef};
2828
use rustc::middle::def::*;
2929
use rustc::middle::def_id::{CRATE_DEF_INDEX, DefId};
3030
use rustc::middle::ty::VariantKind;
@@ -42,7 +42,6 @@ use rustc_front::hir::{ItemForeignMod, ItemImpl, ItemMod, ItemStatic, ItemDefaul
4242
use rustc_front::hir::{ItemStruct, ItemTrait, ItemTy, ItemUse};
4343
use rustc_front::hir::{PathListIdent, PathListMod, StmtDecl};
4444
use rustc_front::hir::{Variant, ViewPathGlob, ViewPathList, ViewPathSimple};
45-
use rustc_front::hir::Visibility;
4645
use rustc_front::intravisit::{self, Visitor};
4746

4847
use std::mem::replace;
@@ -439,42 +438,48 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
439438
}
440439
}
441440

442-
fn handle_external_def(&mut self,
443-
def: Def,
444-
vis: Visibility,
445-
final_ident: &str,
446-
name: Name,
447-
new_parent: Module<'b>) {
448-
debug!("(building reduced graph for external crate) building external def {}, priv {:?}",
449-
final_ident,
450-
vis);
451-
let is_public = vis == hir::Public || new_parent.is_trait();
441+
/// Builds the reduced graph for a single item in an external crate.
442+
fn build_reduced_graph_for_external_crate_def(&mut self, parent: Module<'b>, xcdef: ChildItem) {
443+
let def = match xcdef.def {
444+
DlDef(def) => def,
445+
_ => return,
446+
};
447+
448+
if let Def::ForeignMod(def_id) = def {
449+
// Foreign modules have no names. Recur and populate eagerly.
450+
for child in self.session.cstore.item_children(def_id) {
451+
self.build_reduced_graph_for_external_crate_def(parent, child);
452+
}
453+
return;
454+
}
455+
456+
let name = xcdef.name;
457+
let is_public = xcdef.vis == hir::Public || parent.is_trait();
452458

453459
let mut modifiers = DefModifiers::empty();
454460
if is_public {
455461
modifiers = modifiers | DefModifiers::PUBLIC;
456462
}
457-
if new_parent.is_normal() {
463+
if parent.is_normal() {
458464
modifiers = modifiers | DefModifiers::IMPORTABLE;
459465
}
460466

461467
match def {
462468
Def::Mod(_) | Def::ForeignMod(_) | Def::Enum(..) => {
463469
debug!("(building reduced graph for external crate) building module {} {}",
464-
final_ident,
470+
name,
465471
is_public);
466-
let parent_link = ModuleParentLink(new_parent, name);
472+
let parent_link = ModuleParentLink(parent, name);
467473
let module = self.new_module(parent_link, Some(def), true, is_public);
468-
self.try_define(new_parent, name, TypeNS, (module, DUMMY_SP));
474+
self.try_define(parent, name, TypeNS, (module, DUMMY_SP));
469475
}
470476
Def::Variant(_, variant_id) => {
471-
debug!("(building reduced graph for external crate) building variant {}",
472-
final_ident);
477+
debug!("(building reduced graph for external crate) building variant {}", name);
473478
// Variants are always treated as importable to allow them to be glob used.
474479
// All variants are defined in both type and value namespaces as future-proofing.
475480
let modifiers = DefModifiers::PUBLIC | DefModifiers::IMPORTABLE;
476-
self.try_define(new_parent, name, TypeNS, (def, DUMMY_SP, modifiers));
477-
self.try_define(new_parent, name, ValueNS, (def, DUMMY_SP, modifiers));
481+
self.try_define(parent, name, TypeNS, (def, DUMMY_SP, modifiers));
482+
self.try_define(parent, name, ValueNS, (def, DUMMY_SP, modifiers));
478483
if self.session.cstore.variant_kind(variant_id) == Some(VariantKind::Struct) {
479484
// Not adding fields for variants as they are not accessed with a self receiver
480485
self.structs.insert(variant_id, Vec::new());
@@ -486,12 +491,11 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
486491
Def::AssociatedConst(..) |
487492
Def::Method(..) => {
488493
debug!("(building reduced graph for external crate) building value (fn/static) {}",
489-
final_ident);
490-
self.try_define(new_parent, name, ValueNS, (def, DUMMY_SP, modifiers));
494+
name);
495+
self.try_define(parent, name, ValueNS, (def, DUMMY_SP, modifiers));
491496
}
492497
Def::Trait(def_id) => {
493-
debug!("(building reduced graph for external crate) building type {}",
494-
final_ident);
498+
debug!("(building reduced graph for external crate) building type {}", name);
495499

496500
// If this is a trait, add all the trait item names to the trait
497501
// info.
@@ -508,24 +512,22 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
508512
self.trait_item_map.insert((trait_item_name, def_id), trait_item_def.def_id());
509513
}
510514

511-
let parent_link = ModuleParentLink(new_parent, name);
515+
let parent_link = ModuleParentLink(parent, name);
512516
let module = self.new_module(parent_link, Some(def), true, is_public);
513-
self.try_define(new_parent, name, TypeNS, (module, DUMMY_SP));
517+
self.try_define(parent, name, TypeNS, (module, DUMMY_SP));
514518
}
515519
Def::TyAlias(..) | Def::AssociatedTy(..) => {
516-
debug!("(building reduced graph for external crate) building type {}",
517-
final_ident);
518-
self.try_define(new_parent, name, TypeNS, (def, DUMMY_SP, modifiers));
520+
debug!("(building reduced graph for external crate) building type {}", name);
521+
self.try_define(parent, name, TypeNS, (def, DUMMY_SP, modifiers));
519522
}
520523
Def::Struct(def_id)
521524
if self.session.cstore.tuple_struct_definition_if_ctor(def_id).is_none() => {
522-
debug!("(building reduced graph for external crate) building type and value for \
523-
{}",
524-
final_ident);
525-
self.try_define(new_parent, name, TypeNS, (def, DUMMY_SP, modifiers));
525+
debug!("(building reduced graph for external crate) building type and value for {}",
526+
name);
527+
self.try_define(parent, name, TypeNS, (def, DUMMY_SP, modifiers));
526528
if let Some(ctor_def_id) = self.session.cstore.struct_ctor_def_id(def_id) {
527529
let def = Def::Struct(ctor_def_id);
528-
self.try_define(new_parent, name, ValueNS, (def, DUMMY_SP, modifiers));
530+
self.try_define(parent, name, ValueNS, (def, DUMMY_SP, modifiers));
529531
}
530532

531533
// Record the def ID and fields of this struct.
@@ -545,39 +547,6 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
545547
}
546548
}
547549

548-
/// Builds the reduced graph for a single item in an external crate.
549-
fn build_reduced_graph_for_external_crate_def(&mut self,
550-
root: Module<'b>,
551-
xcdef: ChildItem) {
552-
match xcdef.def {
553-
DlDef(def) => {
554-
// Add the new child item, if necessary.
555-
match def {
556-
Def::ForeignMod(def_id) => {
557-
// Foreign modules have no names. Recur and populate
558-
// eagerly.
559-
for child in self.session.cstore.item_children(def_id) {
560-
self.build_reduced_graph_for_external_crate_def(root, child)
561-
}
562-
}
563-
_ => {
564-
self.handle_external_def(def,
565-
xcdef.vis,
566-
&xcdef.name.as_str(),
567-
xcdef.name,
568-
root);
569-
}
570-
}
571-
}
572-
DlImpl(_) => {
573-
debug!("(building reduced graph for external crate) ignoring impl");
574-
}
575-
DlField => {
576-
debug!("(building reduced graph for external crate) ignoring field");
577-
}
578-
}
579-
}
580-
581550
/// Builds the reduced graph rooted at the given external module.
582551
fn populate_external_module(&mut self, module: Module<'b>) {
583552
debug!("(populating external module) attempting to populate {}",

branches/try/src/librustc_trans/trans/attributes.rs

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010
//! Set and unset common attributes on LLVM values.
1111
12-
use libc::c_uint;
12+
use libc::{c_uint, c_ulonglong};
1313
use llvm::{self, ValueRef};
1414
use session::config::NoDebugInfo;
1515
pub use syntax::attr::InlineAttr;
@@ -28,7 +28,9 @@ pub fn inline(val: ValueRef, inline: InlineAttr) {
2828
let attr = llvm::Attribute::InlineHint |
2929
llvm::Attribute::AlwaysInline |
3030
llvm::Attribute::NoInline;
31-
llvm::RemoveFunctionAttributes(val, attr)
31+
unsafe {
32+
llvm::LLVMRemoveFunctionAttr(val, attr.bits() as c_ulonglong)
33+
}
3234
},
3335
};
3436
}
@@ -39,15 +41,25 @@ pub fn emit_uwtable(val: ValueRef, emit: bool) {
3941
if emit {
4042
llvm::SetFunctionAttribute(val, llvm::Attribute::UWTable);
4143
} else {
42-
llvm::RemoveFunctionAttributes(val, llvm::Attribute::UWTable);
44+
unsafe {
45+
llvm::LLVMRemoveFunctionAttr(
46+
val,
47+
llvm::Attribute::UWTable.bits() as c_ulonglong,
48+
);
49+
}
4350
}
4451
}
4552

4653
/// Tell LLVM whether the function can or cannot unwind.
4754
#[inline]
4855
pub fn unwind(val: ValueRef, can_unwind: bool) {
4956
if can_unwind {
50-
llvm::RemoveFunctionAttributes(val, llvm::Attribute::NoUnwind);
57+
unsafe {
58+
llvm::LLVMRemoveFunctionAttr(
59+
val,
60+
llvm::Attribute::NoUnwind.bits() as c_ulonglong,
61+
);
62+
}
5163
} else {
5264
llvm::SetFunctionAttribute(val, llvm::Attribute::NoUnwind);
5365
}
@@ -60,7 +72,12 @@ pub fn set_optimize_for_size(val: ValueRef, optimize: bool) {
6072
if optimize {
6173
llvm::SetFunctionAttribute(val, llvm::Attribute::OptimizeForSize);
6274
} else {
63-
llvm::RemoveFunctionAttributes(val, llvm::Attribute::OptimizeForSize);
75+
unsafe {
76+
llvm::LLVMRemoveFunctionAttr(
77+
val,
78+
llvm::Attribute::OptimizeForSize.bits() as c_ulonglong,
79+
);
80+
}
6481
}
6582
}
6683

@@ -70,7 +87,9 @@ pub fn naked(val: ValueRef, is_naked: bool) {
7087
if is_naked {
7188
llvm::SetFunctionAttribute(val, llvm::Attribute::Naked);
7289
} else {
73-
llvm::RemoveFunctionAttributes(val, llvm::Attribute::Naked);
90+
unsafe {
91+
llvm::LLVMRemoveFunctionAttr(val, llvm::Attribute::Naked.bits() as c_ulonglong);
92+
}
7493
}
7594
}
7695

branches/try/src/rustllvm/RustWrapper.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,6 @@ extern "C" void LLVMAddFunctionAttrStringValue(LLVMValueRef Fn, unsigned index,
151151
F->addAttributes(index, AttributeSet::get(F->getContext(), index, B));
152152
}
153153

154-
extern "C" void LLVMRemoveFunctionAttributes(LLVMValueRef Fn, unsigned index, uint64_t Val) {
155-
Function *A = unwrap<Function>(Fn);
156-
const AttributeSet PAL = A->getAttributes();
157-
AttrBuilder B(Val);
158-
const AttributeSet PALnew =
159-
PAL.removeAttributes(A->getContext(), index,
160-
AttributeSet::get(A->getContext(), index, B));
161-
A->setAttributes(PALnew);
162-
}
163-
164154
extern "C" void LLVMRemoveFunctionAttrString(LLVMValueRef fn, unsigned index, const char *Name) {
165155
Function *f = unwrap<Function>(fn);
166156
LLVMContext &C = f->getContext();

0 commit comments

Comments
 (0)