Auto merge of #24964 - tamird:cleanup-bitflags, r=alexcrichton
Depends on #24921. r? @alexcrichton
This commit is contained in:
commit
347ee73ef7
16 changed files with 90 additions and 93 deletions
|
|
@ -45,8 +45,6 @@ use std::collections::hash_map::Entry;
|
|||
bitflags! {
|
||||
#[derive(RustcEncodable, RustcDecodable)]
|
||||
flags ConstQualif: u8 {
|
||||
// Const rvalue which can be placed behind a reference.
|
||||
const PURE_CONST = 0,
|
||||
// Inner mutability (can not be placed behind a reference) or behind
|
||||
// &mut in a non-global expression. Can be copied from static memory.
|
||||
const MUTABLE_MEM = 1 << 0,
|
||||
|
|
@ -104,7 +102,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
|
|||
{
|
||||
let (old_mode, old_qualif) = (self.mode, self.qualif);
|
||||
self.mode = mode;
|
||||
self.qualif = ConstQualif::PURE_CONST;
|
||||
self.qualif = ConstQualif::empty();
|
||||
let r = f(self);
|
||||
self.mode = old_mode;
|
||||
self.qualif = old_qualif;
|
||||
|
|
@ -128,7 +126,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
|
|||
Entry::Occupied(entry) => return *entry.get(),
|
||||
Entry::Vacant(entry) => {
|
||||
// Prevent infinite recursion on re-entry.
|
||||
entry.insert(ConstQualif::PURE_CONST);
|
||||
entry.insert(ConstQualif::empty());
|
||||
}
|
||||
}
|
||||
self.with_mode(mode, |this| {
|
||||
|
|
@ -273,7 +271,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckCrateVisitor<'a, 'tcx> {
|
|||
|
||||
fn visit_expr(&mut self, ex: &ast::Expr) {
|
||||
let mut outer = self.qualif;
|
||||
self.qualif = ConstQualif::PURE_CONST;
|
||||
self.qualif = ConstQualif::empty();
|
||||
|
||||
let node_ty = ty::node_id_to_type(self.tcx, ex.id);
|
||||
check_expr(self, ex, node_ty);
|
||||
|
|
|
|||
|
|
@ -850,9 +850,10 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
|
|||
// Compute maximum lifetime of this rvalue. This is 'static if
|
||||
// we can promote to a constant, otherwise equal to enclosing temp
|
||||
// lifetime.
|
||||
let re = match qualif & check_const::ConstQualif::NON_STATIC_BORROWS {
|
||||
check_const::ConstQualif::PURE_CONST => ty::ReStatic,
|
||||
_ => self.temporary_scope(id),
|
||||
let re = if qualif.intersects(check_const::ConstQualif::NON_STATIC_BORROWS) {
|
||||
self.temporary_scope(id)
|
||||
} else {
|
||||
ty::ReStatic
|
||||
};
|
||||
let ret = self.cat_rvalue(id, span, re, expr_ty);
|
||||
debug!("cat_rvalue_node ret {}", ret.repr(self.tcx()));
|
||||
|
|
|
|||
|
|
@ -849,7 +849,6 @@ impl<'tcx> ctxt<'tcx> {
|
|||
// recursing over the type itself.
|
||||
bitflags! {
|
||||
flags TypeFlags: u32 {
|
||||
const NO_TYPE_FLAGS = 0,
|
||||
const HAS_PARAMS = 1 << 0,
|
||||
const HAS_SELF = 1 << 1,
|
||||
const HAS_TY_INFER = 1 << 2,
|
||||
|
|
@ -2925,7 +2924,7 @@ struct FlagComputation {
|
|||
|
||||
impl FlagComputation {
|
||||
fn new() -> FlagComputation {
|
||||
FlagComputation { flags: TypeFlags::NO_TYPE_FLAGS, depth: 0 }
|
||||
FlagComputation { flags: TypeFlags::empty(), depth: 0 }
|
||||
}
|
||||
|
||||
fn for_sty(st: &sty) -> FlagComputation {
|
||||
|
|
|
|||
|
|
@ -125,32 +125,32 @@ pub enum DiagnosticSeverity {
|
|||
|
||||
bitflags! {
|
||||
flags Attribute : u32 {
|
||||
const ZExtAttribute = 1 << 0,
|
||||
const SExtAttribute = 1 << 1,
|
||||
const NoReturnAttribute = 1 << 2,
|
||||
const InRegAttribute = 1 << 3,
|
||||
const StructRetAttribute = 1 << 4,
|
||||
const NoUnwindAttribute = 1 << 5,
|
||||
const NoAliasAttribute = 1 << 6,
|
||||
const ByValAttribute = 1 << 7,
|
||||
const NestAttribute = 1 << 8,
|
||||
const ReadNoneAttribute = 1 << 9,
|
||||
const ReadOnlyAttribute = 1 << 10,
|
||||
const NoInlineAttribute = 1 << 11,
|
||||
const AlwaysInlineAttribute = 1 << 12,
|
||||
const OptimizeForSizeAttribute = 1 << 13,
|
||||
const StackProtectAttribute = 1 << 14,
|
||||
const StackProtectReqAttribute = 1 << 15,
|
||||
const AlignmentAttribute = 1 << 16,
|
||||
const NoCaptureAttribute = 1 << 21,
|
||||
const NoRedZoneAttribute = 1 << 22,
|
||||
const NoImplicitFloatAttribute = 1 << 23,
|
||||
const NakedAttribute = 1 << 24,
|
||||
const InlineHintAttribute = 1 << 25,
|
||||
const StackAttribute = 7 << 26,
|
||||
const ReturnsTwiceAttribute = 1 << 29,
|
||||
const UWTableAttribute = 1 << 30,
|
||||
const NonLazyBindAttribute = 1 << 31,
|
||||
const ZExt = 1 << 0,
|
||||
const SExt = 1 << 1,
|
||||
const NoReturn = 1 << 2,
|
||||
const InReg = 1 << 3,
|
||||
const StructRet = 1 << 4,
|
||||
const NoUnwind = 1 << 5,
|
||||
const NoAlias = 1 << 6,
|
||||
const ByVal = 1 << 7,
|
||||
const Nest = 1 << 8,
|
||||
const ReadNone = 1 << 9,
|
||||
const ReadOnly = 1 << 10,
|
||||
const NoInline = 1 << 11,
|
||||
const AlwaysInline = 1 << 12,
|
||||
const OptimizeForSize = 1 << 13,
|
||||
const StackProtect = 1 << 14,
|
||||
const StackProtectReq = 1 << 15,
|
||||
const Alignment = 1 << 16,
|
||||
const NoCapture = 1 << 21,
|
||||
const NoRedZone = 1 << 22,
|
||||
const NoImplicitFloat = 1 << 23,
|
||||
const Naked = 1 << 24,
|
||||
const InlineHint = 1 << 25,
|
||||
const Stack = 7 << 26,
|
||||
const ReturnsTwice = 1 << 29,
|
||||
const UWTable = 1 << 30,
|
||||
const NonLazyBind = 1 << 31,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,13 +39,13 @@ pub fn split_stack(val: ValueRef, set: bool) {
|
|||
pub fn inline(val: ValueRef, inline: InlineAttr) {
|
||||
use self::InlineAttr::*;
|
||||
match inline {
|
||||
Hint => llvm::SetFunctionAttribute(val, llvm::Attribute::InlineHintAttribute),
|
||||
Always => llvm::SetFunctionAttribute(val, llvm::Attribute::AlwaysInlineAttribute),
|
||||
Never => llvm::SetFunctionAttribute(val, llvm::Attribute::NoInlineAttribute),
|
||||
Hint => llvm::SetFunctionAttribute(val, llvm::Attribute::InlineHint),
|
||||
Always => llvm::SetFunctionAttribute(val, llvm::Attribute::AlwaysInline),
|
||||
Never => llvm::SetFunctionAttribute(val, llvm::Attribute::NoInline),
|
||||
None => {
|
||||
let attr = llvm::Attribute::InlineHintAttribute |
|
||||
llvm::Attribute::AlwaysInlineAttribute |
|
||||
llvm::Attribute::NoInlineAttribute;
|
||||
let attr = llvm::Attribute::InlineHint |
|
||||
llvm::Attribute::AlwaysInline |
|
||||
llvm::Attribute::NoInline;
|
||||
unsafe {
|
||||
llvm::LLVMRemoveFunctionAttr(val, attr.bits() as c_ulonglong)
|
||||
}
|
||||
|
|
@ -57,12 +57,12 @@ pub fn inline(val: ValueRef, inline: InlineAttr) {
|
|||
#[inline]
|
||||
pub fn emit_uwtable(val: ValueRef, emit: bool) {
|
||||
if emit {
|
||||
llvm::SetFunctionAttribute(val, llvm::Attribute::UWTableAttribute);
|
||||
llvm::SetFunctionAttribute(val, llvm::Attribute::UWTable);
|
||||
} else {
|
||||
unsafe {
|
||||
llvm::LLVMRemoveFunctionAttr(
|
||||
val,
|
||||
llvm::Attribute::UWTableAttribute.bits() as c_ulonglong,
|
||||
llvm::Attribute::UWTable.bits() as c_ulonglong,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -76,11 +76,11 @@ pub fn unwind(val: ValueRef, can_unwind: bool) {
|
|||
unsafe {
|
||||
llvm::LLVMRemoveFunctionAttr(
|
||||
val,
|
||||
llvm::Attribute::NoUnwindAttribute.bits() as c_ulonglong,
|
||||
llvm::Attribute::NoUnwind.bits() as c_ulonglong,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
llvm::SetFunctionAttribute(val, llvm::Attribute::NoUnwindAttribute);
|
||||
llvm::SetFunctionAttribute(val, llvm::Attribute::NoUnwind);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -89,12 +89,12 @@ pub fn unwind(val: ValueRef, can_unwind: bool) {
|
|||
#[allow(dead_code)] // possibly useful function
|
||||
pub fn set_optimize_for_size(val: ValueRef, optimize: bool) {
|
||||
if optimize {
|
||||
llvm::SetFunctionAttribute(val, llvm::Attribute::OptimizeForSizeAttribute);
|
||||
llvm::SetFunctionAttribute(val, llvm::Attribute::OptimizeForSize);
|
||||
} else {
|
||||
unsafe {
|
||||
llvm::LLVMRemoveFunctionAttr(
|
||||
val,
|
||||
llvm::Attribute::OptimizeForSizeAttribute.bits() as c_ulonglong,
|
||||
llvm::Attribute::OptimizeForSize.bits() as c_ulonglong,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ pub fn from_fn_attrs(ccx: &CrateContext, attrs: &[ast::Attribute], llfn: ValueRe
|
|||
llvm::ColdAttribute as u64)
|
||||
}
|
||||
} else if attr.check_name("allocator") {
|
||||
llvm::Attribute::NoAliasAttribute.apply_llfn(llvm::ReturnIndex as c_uint, llfn);
|
||||
llvm::Attribute::NoAlias.apply_llfn(llvm::ReturnIndex as c_uint, llfn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -185,9 +185,9 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
|
|||
// The outptr can be noalias and nocapture because it's entirely
|
||||
// invisible to the program. We also know it's nonnull as well
|
||||
// as how many bytes we can dereference
|
||||
attrs.arg(1, llvm::Attribute::StructRetAttribute)
|
||||
.arg(1, llvm::Attribute::NoAliasAttribute)
|
||||
.arg(1, llvm::Attribute::NoCaptureAttribute)
|
||||
attrs.arg(1, llvm::Attribute::StructRet)
|
||||
.arg(1, llvm::Attribute::NoAlias)
|
||||
.arg(1, llvm::Attribute::NoCapture)
|
||||
.arg(1, llvm::DereferenceableAttribute(llret_sz));
|
||||
|
||||
// Add one more since there's an outptr
|
||||
|
|
@ -199,7 +199,7 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
|
|||
// `~` pointer return values never alias because ownership
|
||||
// is transferred
|
||||
ty::ty_uniq(it) if common::type_is_sized(ccx.tcx(), it) => {
|
||||
attrs.ret(llvm::Attribute::NoAliasAttribute);
|
||||
attrs.ret(llvm::Attribute::NoAlias);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
@ -216,7 +216,7 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
|
|||
}
|
||||
|
||||
if let ty::ty_bool = ret_ty.sty {
|
||||
attrs.ret(llvm::Attribute::ZExtAttribute);
|
||||
attrs.ret(llvm::Attribute::ZExt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -230,20 +230,20 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
|
|||
// For non-immediate arguments the callee gets its own copy of
|
||||
// the value on the stack, so there are no aliases. It's also
|
||||
// program-invisible so can't possibly capture
|
||||
attrs.arg(idx, llvm::Attribute::NoAliasAttribute)
|
||||
.arg(idx, llvm::Attribute::NoCaptureAttribute)
|
||||
attrs.arg(idx, llvm::Attribute::NoAlias)
|
||||
.arg(idx, llvm::Attribute::NoCapture)
|
||||
.arg(idx, llvm::DereferenceableAttribute(llarg_sz));
|
||||
}
|
||||
|
||||
ty::ty_bool => {
|
||||
attrs.arg(idx, llvm::Attribute::ZExtAttribute);
|
||||
attrs.arg(idx, llvm::Attribute::ZExt);
|
||||
}
|
||||
|
||||
// `~` pointer parameters never alias because ownership is transferred
|
||||
ty::ty_uniq(inner) => {
|
||||
let llsz = machine::llsize_of_real(ccx, type_of::type_of(ccx, inner));
|
||||
|
||||
attrs.arg(idx, llvm::Attribute::NoAliasAttribute)
|
||||
attrs.arg(idx, llvm::Attribute::NoAlias)
|
||||
.arg(idx, llvm::DereferenceableAttribute(llsz));
|
||||
}
|
||||
|
||||
|
|
@ -256,15 +256,15 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
|
|||
!ty::type_contents(ccx.tcx(), mt.ty).interior_unsafe() => {
|
||||
|
||||
let llsz = machine::llsize_of_real(ccx, type_of::type_of(ccx, mt.ty));
|
||||
attrs.arg(idx, llvm::Attribute::NoAliasAttribute)
|
||||
attrs.arg(idx, llvm::Attribute::NoAlias)
|
||||
.arg(idx, llvm::DereferenceableAttribute(llsz));
|
||||
|
||||
if mt.mutbl == ast::MutImmutable {
|
||||
attrs.arg(idx, llvm::Attribute::ReadOnlyAttribute);
|
||||
attrs.arg(idx, llvm::Attribute::ReadOnly);
|
||||
}
|
||||
|
||||
if let ReLateBound(_, BrAnon(_)) = *b {
|
||||
attrs.arg(idx, llvm::Attribute::NoCaptureAttribute);
|
||||
attrs.arg(idx, llvm::Attribute::NoCapture);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -272,7 +272,7 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
|
|||
// reference to escape this function (returned or stored beyond the call by a closure).
|
||||
ty::ty_rptr(&ReLateBound(_, BrAnon(_)), mt) => {
|
||||
let llsz = machine::llsize_of_real(ccx, type_of::type_of(ccx, mt.ty));
|
||||
attrs.arg(idx, llvm::Attribute::NoCaptureAttribute)
|
||||
attrs.arg(idx, llvm::Attribute::NoCapture)
|
||||
.arg(idx, llvm::DereferenceableAttribute(llsz));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ fn is_homogenous_aggregate_ty(ty: Type) -> Option<(Type, u64)> {
|
|||
|
||||
fn classify_ret_ty(ccx: &CrateContext, ty: Type) -> ArgType {
|
||||
if is_reg_ty(ty) {
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
|
||||
return ArgType::direct(ty, None, None, attr);
|
||||
}
|
||||
if let Some((base_ty, members)) = is_homogenous_aggregate_ty(ty) {
|
||||
|
|
@ -185,12 +185,12 @@ fn classify_ret_ty(ccx: &CrateContext, ty: Type) -> ArgType {
|
|||
};
|
||||
return ArgType::direct(ty, Some(llty), None, None);
|
||||
}
|
||||
ArgType::indirect(ty, Some(Attribute::StructRetAttribute))
|
||||
ArgType::indirect(ty, Some(Attribute::StructRet))
|
||||
}
|
||||
|
||||
fn classify_arg_ty(ccx: &CrateContext, ty: Type) -> ArgType {
|
||||
if is_reg_ty(ty) {
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
|
||||
return ArgType::direct(ty, None, None, attr);
|
||||
}
|
||||
if let Some((base_ty, members)) = is_homogenous_aggregate_ty(ty) {
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ fn ty_size(ty: Type, align_fn: TyAlignFn) -> usize {
|
|||
|
||||
fn classify_ret_ty(ccx: &CrateContext, ty: Type, align_fn: TyAlignFn) -> ArgType {
|
||||
if is_reg_ty(ty) {
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
|
||||
return ArgType::direct(ty, None, None, attr);
|
||||
}
|
||||
let size = ty_size(ty, align_fn);
|
||||
|
|
@ -145,12 +145,12 @@ fn classify_ret_ty(ccx: &CrateContext, ty: Type, align_fn: TyAlignFn) -> ArgType
|
|||
};
|
||||
return ArgType::direct(ty, Some(llty), None, None);
|
||||
}
|
||||
ArgType::indirect(ty, Some(Attribute::StructRetAttribute))
|
||||
ArgType::indirect(ty, Some(Attribute::StructRet))
|
||||
}
|
||||
|
||||
fn classify_arg_ty(ccx: &CrateContext, ty: Type, align_fn: TyAlignFn) -> ArgType {
|
||||
if is_reg_ty(ty) {
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
|
||||
return ArgType::direct(ty, None, None, attr);
|
||||
}
|
||||
let align = align_fn(ty);
|
||||
|
|
|
|||
|
|
@ -88,10 +88,10 @@ fn ty_size(ty: Type) -> usize {
|
|||
|
||||
fn classify_ret_ty(ccx: &CrateContext, ty: Type) -> ArgType {
|
||||
if is_reg_ty(ty) {
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
|
||||
ArgType::direct(ty, None, None, attr)
|
||||
} else {
|
||||
ArgType::indirect(ty, Some(Attribute::StructRetAttribute))
|
||||
ArgType::indirect(ty, Some(Attribute::StructRet))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ fn classify_arg_ty(ccx: &CrateContext, ty: Type, offset: &mut usize) -> ArgType
|
|||
*offset += align_up_to(size, align * 8) / 8;
|
||||
|
||||
if is_reg_ty(ty) {
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
|
||||
ArgType::direct(ty, None, None, attr)
|
||||
} else {
|
||||
ArgType::direct(
|
||||
|
|
|
|||
|
|
@ -84,10 +84,10 @@ fn ty_size(ty: Type) -> usize {
|
|||
|
||||
fn classify_ret_ty(ccx: &CrateContext, ty: Type) -> ArgType {
|
||||
if is_reg_ty(ty) {
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
|
||||
ArgType::direct(ty, None, None, attr)
|
||||
} else {
|
||||
ArgType::indirect(ty, Some(Attribute::StructRetAttribute))
|
||||
ArgType::indirect(ty, Some(Attribute::StructRet))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ fn classify_arg_ty(ccx: &CrateContext, ty: Type, offset: &mut usize) -> ArgType
|
|||
*offset += align_up_to(size, align * 8) / 8;
|
||||
|
||||
if is_reg_ty(ty) {
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
|
||||
ArgType::direct(ty, None, None, attr)
|
||||
} else {
|
||||
ArgType::direct(
|
||||
|
|
|
|||
|
|
@ -52,11 +52,11 @@ pub fn compute_abi_info(ccx: &CrateContext,
|
|||
ret_ty = ArgType::direct(rty, Some(t), None, None);
|
||||
}
|
||||
RetPointer => {
|
||||
ret_ty = ArgType::indirect(rty, Some(Attribute::StructRetAttribute));
|
||||
ret_ty = ArgType::indirect(rty, Some(Attribute::StructRet));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let attr = if rty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
|
||||
let attr = if rty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
|
||||
ret_ty = ArgType::direct(rty, None, None, attr);
|
||||
}
|
||||
|
||||
|
|
@ -67,11 +67,11 @@ pub fn compute_abi_info(ccx: &CrateContext,
|
|||
if size == 0 {
|
||||
ArgType::ignore(t)
|
||||
} else {
|
||||
ArgType::indirect(t, Some(Attribute::ByValAttribute))
|
||||
ArgType::indirect(t, Some(Attribute::ByVal))
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
let attr = if t == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
|
||||
let attr = if t == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
|
||||
ArgType::direct(t, None, None, attr)
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -406,19 +406,19 @@ pub fn compute_abi_info(ccx: &CrateContext,
|
|||
None)
|
||||
}
|
||||
} else {
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
|
||||
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
|
||||
ArgType::direct(ty, None, None, attr)
|
||||
}
|
||||
}
|
||||
|
||||
let mut arg_tys = Vec::new();
|
||||
for t in atys {
|
||||
let ty = x86_64_ty(ccx, *t, |cls| cls.is_pass_byval(), Attribute::ByValAttribute);
|
||||
let ty = x86_64_ty(ccx, *t, |cls| cls.is_pass_byval(), Attribute::ByVal);
|
||||
arg_tys.push(ty);
|
||||
}
|
||||
|
||||
let ret_ty = if ret_def {
|
||||
x86_64_ty(ccx, rty, |cls| cls.is_ret_bysret(), Attribute::StructRetAttribute)
|
||||
x86_64_ty(ccx, rty, |cls| cls.is_ret_bysret(), Attribute::StructRet)
|
||||
} else {
|
||||
ArgType::direct(Type::void(ccx), None, None, None)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ pub fn compute_abi_info(ccx: &CrateContext,
|
|||
2 => ArgType::direct(rty, Some(Type::i16(ccx)), None, None),
|
||||
4 => ArgType::direct(rty, Some(Type::i32(ccx)), None, None),
|
||||
8 => ArgType::direct(rty, Some(Type::i64(ccx)), None, None),
|
||||
_ => ArgType::indirect(rty, Some(Attribute::StructRetAttribute))
|
||||
_ => ArgType::indirect(rty, Some(Attribute::StructRet))
|
||||
};
|
||||
} else {
|
||||
let attr = if rty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
|
||||
let attr = if rty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
|
||||
ret_ty = ArgType::direct(rty, None, None, attr);
|
||||
}
|
||||
|
||||
|
|
@ -46,11 +46,11 @@ pub fn compute_abi_info(ccx: &CrateContext,
|
|||
2 => ArgType::direct(rty, Some(Type::i16(ccx)), None, None),
|
||||
4 => ArgType::direct(rty, Some(Type::i32(ccx)), None, None),
|
||||
8 => ArgType::direct(rty, Some(Type::i64(ccx)), None, None),
|
||||
_ => ArgType::indirect(t, Some(Attribute::ByValAttribute))
|
||||
_ => ArgType::indirect(t, Some(Attribute::ByVal))
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
let attr = if t == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
|
||||
let attr = if t == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
|
||||
ArgType::direct(t, None, None, attr)
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ fn get_const_val(ccx: &CrateContext,
|
|||
ref_expr: &ast::Expr) -> ValueRef {
|
||||
let expr = get_const_expr(ccx, def_id, ref_expr);
|
||||
let empty_substs = ccx.tcx().mk_substs(Substs::trans_empty());
|
||||
get_const_expr_as_global(ccx, expr, check_const::ConstQualif::PURE_CONST, empty_substs)
|
||||
get_const_expr_as_global(ccx, expr, check_const::ConstQualif::empty(), empty_substs)
|
||||
}
|
||||
|
||||
pub fn get_const_expr_as_global<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
||||
|
|
|
|||
|
|
@ -71,12 +71,12 @@ pub fn declare_fn(ccx: &CrateContext, name: &str, callconv: llvm::CallConv, ty:
|
|||
llvm::SetUnnamedAddr(llfn, true);
|
||||
|
||||
if output == ty::FnDiverging {
|
||||
llvm::SetFunctionAttribute(llfn, llvm::Attribute::NoReturnAttribute);
|
||||
llvm::SetFunctionAttribute(llfn, llvm::Attribute::NoReturn);
|
||||
}
|
||||
|
||||
if ccx.tcx().sess.opts.cg.no_redzone
|
||||
.unwrap_or(ccx.tcx().sess.target.target.options.disable_redzone) {
|
||||
llvm::SetFunctionAttribute(llfn, llvm::Attribute::NoRedZoneAttribute)
|
||||
llvm::SetFunctionAttribute(llfn, llvm::Attribute::NoRedZone)
|
||||
}
|
||||
|
||||
if ccx.is_split_stack_supported() && !ccx.sess().opts.cg.no_stack_check {
|
||||
|
|
|
|||
|
|
@ -349,8 +349,8 @@ pub fn trans_native_call<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
|||
// The outptr can be noalias and nocapture because it's entirely
|
||||
// invisible to the program. We also know it's nonnull as well
|
||||
// as how many bytes we can dereference
|
||||
attrs.arg(1, llvm::Attribute::NoAliasAttribute)
|
||||
.arg(1, llvm::Attribute::NoCaptureAttribute)
|
||||
attrs.arg(1, llvm::Attribute::NoAlias)
|
||||
.arg(1, llvm::Attribute::NoCapture)
|
||||
.arg(1, llvm::DereferenceableAttribute(llret_sz));
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,6 @@ use std::slice;
|
|||
|
||||
bitflags! {
|
||||
flags Restrictions: u8 {
|
||||
const UNRESTRICTED = 0,
|
||||
const RESTRICTION_STMT_EXPR = 1 << 0,
|
||||
const RESTRICTION_NO_STRUCT_LITERAL = 1 << 1,
|
||||
}
|
||||
|
|
@ -339,7 +338,7 @@ impl<'a> Parser<'a> {
|
|||
buffer_start: 0,
|
||||
buffer_end: 0,
|
||||
tokens_consumed: 0,
|
||||
restrictions: Restrictions::UNRESTRICTED,
|
||||
restrictions: Restrictions::empty(),
|
||||
quote_depth: 0,
|
||||
obsolete_set: HashSet::new(),
|
||||
mod_path_stack: Vec::new(),
|
||||
|
|
@ -2991,7 +2990,7 @@ impl<'a> Parser<'a> {
|
|||
|
||||
/// Parse an expression
|
||||
pub fn parse_expr_nopanic(&mut self) -> PResult<P<Expr>> {
|
||||
return self.parse_expr_res(Restrictions::UNRESTRICTED);
|
||||
self.parse_expr_res(Restrictions::empty())
|
||||
}
|
||||
|
||||
/// Parse an expression, subject to the given restrictions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue