Skip to content

Commit 84e7685

Browse files
committed
Don't repeat Attribute in the const names
1 parent e1ff94b commit 84e7685

File tree

11 files changed

+79
-79
lines changed

11 files changed

+79
-79
lines changed

src/librustc_llvm/lib.rs

+26-26
Original file line numberDiff line numberDiff line change
@@ -125,32 +125,32 @@ pub enum DiagnosticSeverity {
125125

126126
bitflags! {
127127
flags Attribute : u32 {
128-
const ZExtAttribute = 1 << 0,
129-
const SExtAttribute = 1 << 1,
130-
const NoReturnAttribute = 1 << 2,
131-
const InRegAttribute = 1 << 3,
132-
const StructRetAttribute = 1 << 4,
133-
const NoUnwindAttribute = 1 << 5,
134-
const NoAliasAttribute = 1 << 6,
135-
const ByValAttribute = 1 << 7,
136-
const NestAttribute = 1 << 8,
137-
const ReadNoneAttribute = 1 << 9,
138-
const ReadOnlyAttribute = 1 << 10,
139-
const NoInlineAttribute = 1 << 11,
140-
const AlwaysInlineAttribute = 1 << 12,
141-
const OptimizeForSizeAttribute = 1 << 13,
142-
const StackProtectAttribute = 1 << 14,
143-
const StackProtectReqAttribute = 1 << 15,
144-
const AlignmentAttribute = 1 << 16,
145-
const NoCaptureAttribute = 1 << 21,
146-
const NoRedZoneAttribute = 1 << 22,
147-
const NoImplicitFloatAttribute = 1 << 23,
148-
const NakedAttribute = 1 << 24,
149-
const InlineHintAttribute = 1 << 25,
150-
const StackAttribute = 7 << 26,
151-
const ReturnsTwiceAttribute = 1 << 29,
152-
const UWTableAttribute = 1 << 30,
153-
const NonLazyBindAttribute = 1 << 31,
128+
const ZExt = 1 << 0,
129+
const SExt = 1 << 1,
130+
const NoReturn = 1 << 2,
131+
const InReg = 1 << 3,
132+
const StructRet = 1 << 4,
133+
const NoUnwind = 1 << 5,
134+
const NoAlias = 1 << 6,
135+
const ByVal = 1 << 7,
136+
const Nest = 1 << 8,
137+
const ReadNone = 1 << 9,
138+
const ReadOnly = 1 << 10,
139+
const NoInline = 1 << 11,
140+
const AlwaysInline = 1 << 12,
141+
const OptimizeForSize = 1 << 13,
142+
const StackProtect = 1 << 14,
143+
const StackProtectReq = 1 << 15,
144+
const Alignment = 1 << 16,
145+
const NoCapture = 1 << 21,
146+
const NoRedZone = 1 << 22,
147+
const NoImplicitFloat = 1 << 23,
148+
const Naked = 1 << 24,
149+
const InlineHint = 1 << 25,
150+
const Stack = 7 << 26,
151+
const ReturnsTwice = 1 << 29,
152+
const UWTable = 1 << 30,
153+
const NonLazyBind = 1 << 31,
154154
}
155155
}
156156

src/librustc_trans/trans/attributes.rs

+26-26
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ pub fn split_stack(val: ValueRef, set: bool) {
3939
pub fn inline(val: ValueRef, inline: InlineAttr) {
4040
use self::InlineAttr::*;
4141
match inline {
42-
Hint => llvm::SetFunctionAttribute(val, llvm::Attribute::InlineHintAttribute),
43-
Always => llvm::SetFunctionAttribute(val, llvm::Attribute::AlwaysInlineAttribute),
44-
Never => llvm::SetFunctionAttribute(val, llvm::Attribute::NoInlineAttribute),
42+
Hint => llvm::SetFunctionAttribute(val, llvm::Attribute::InlineHint),
43+
Always => llvm::SetFunctionAttribute(val, llvm::Attribute::AlwaysInline),
44+
Never => llvm::SetFunctionAttribute(val, llvm::Attribute::NoInline),
4545
None => {
46-
let attr = llvm::Attribute::InlineHintAttribute |
47-
llvm::Attribute::AlwaysInlineAttribute |
48-
llvm::Attribute::NoInlineAttribute;
46+
let attr = llvm::Attribute::InlineHint |
47+
llvm::Attribute::AlwaysInline |
48+
llvm::Attribute::NoInline;
4949
unsafe {
5050
llvm::LLVMRemoveFunctionAttr(val, attr.bits() as c_ulonglong)
5151
}
@@ -57,12 +57,12 @@ pub fn inline(val: ValueRef, inline: InlineAttr) {
5757
#[inline]
5858
pub fn emit_uwtable(val: ValueRef, emit: bool) {
5959
if emit {
60-
llvm::SetFunctionAttribute(val, llvm::Attribute::UWTableAttribute);
60+
llvm::SetFunctionAttribute(val, llvm::Attribute::UWTable);
6161
} else {
6262
unsafe {
6363
llvm::LLVMRemoveFunctionAttr(
6464
val,
65-
llvm::Attribute::UWTableAttribute.bits() as c_ulonglong,
65+
llvm::Attribute::UWTable.bits() as c_ulonglong,
6666
);
6767
}
6868
}
@@ -76,11 +76,11 @@ pub fn unwind(val: ValueRef, can_unwind: bool) {
7676
unsafe {
7777
llvm::LLVMRemoveFunctionAttr(
7878
val,
79-
llvm::Attribute::NoUnwindAttribute.bits() as c_ulonglong,
79+
llvm::Attribute::NoUnwind.bits() as c_ulonglong,
8080
);
8181
}
8282
} else {
83-
llvm::SetFunctionAttribute(val, llvm::Attribute::NoUnwindAttribute);
83+
llvm::SetFunctionAttribute(val, llvm::Attribute::NoUnwind);
8484
}
8585
}
8686

@@ -89,12 +89,12 @@ pub fn unwind(val: ValueRef, can_unwind: bool) {
8989
#[allow(dead_code)] // possibly useful function
9090
pub fn set_optimize_for_size(val: ValueRef, optimize: bool) {
9191
if optimize {
92-
llvm::SetFunctionAttribute(val, llvm::Attribute::OptimizeForSizeAttribute);
92+
llvm::SetFunctionAttribute(val, llvm::Attribute::OptimizeForSize);
9393
} else {
9494
unsafe {
9595
llvm::LLVMRemoveFunctionAttr(
9696
val,
97-
llvm::Attribute::OptimizeForSizeAttribute.bits() as c_ulonglong,
97+
llvm::Attribute::OptimizeForSize.bits() as c_ulonglong,
9898
);
9999
}
100100
}
@@ -116,7 +116,7 @@ pub fn from_fn_attrs(ccx: &CrateContext, attrs: &[ast::Attribute], llfn: ValueRe
116116
llvm::ColdAttribute as u64)
117117
}
118118
} else if attr.check_name("allocator") {
119-
llvm::Attribute::NoAliasAttribute.apply_llfn(llvm::ReturnIndex as c_uint, llfn);
119+
llvm::Attribute::NoAlias.apply_llfn(llvm::ReturnIndex as c_uint, llfn);
120120
}
121121
}
122122
}
@@ -185,9 +185,9 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
185185
// The outptr can be noalias and nocapture because it's entirely
186186
// invisible to the program. We also know it's nonnull as well
187187
// as how many bytes we can dereference
188-
attrs.arg(1, llvm::Attribute::StructRetAttribute)
189-
.arg(1, llvm::Attribute::NoAliasAttribute)
190-
.arg(1, llvm::Attribute::NoCaptureAttribute)
188+
attrs.arg(1, llvm::Attribute::StructRet)
189+
.arg(1, llvm::Attribute::NoAlias)
190+
.arg(1, llvm::Attribute::NoCapture)
191191
.arg(1, llvm::DereferenceableAttribute(llret_sz));
192192

193193
// 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
199199
// `~` pointer return values never alias because ownership
200200
// is transferred
201201
ty::ty_uniq(it) if common::type_is_sized(ccx.tcx(), it) => {
202-
attrs.ret(llvm::Attribute::NoAliasAttribute);
202+
attrs.ret(llvm::Attribute::NoAlias);
203203
}
204204
_ => {}
205205
}
@@ -216,7 +216,7 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
216216
}
217217

218218
if let ty::ty_bool = ret_ty.sty {
219-
attrs.ret(llvm::Attribute::ZExtAttribute);
219+
attrs.ret(llvm::Attribute::ZExt);
220220
}
221221
}
222222
}
@@ -230,20 +230,20 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
230230
// For non-immediate arguments the callee gets its own copy of
231231
// the value on the stack, so there are no aliases. It's also
232232
// program-invisible so can't possibly capture
233-
attrs.arg(idx, llvm::Attribute::NoAliasAttribute)
234-
.arg(idx, llvm::Attribute::NoCaptureAttribute)
233+
attrs.arg(idx, llvm::Attribute::NoAlias)
234+
.arg(idx, llvm::Attribute::NoCapture)
235235
.arg(idx, llvm::DereferenceableAttribute(llarg_sz));
236236
}
237237

238238
ty::ty_bool => {
239-
attrs.arg(idx, llvm::Attribute::ZExtAttribute);
239+
attrs.arg(idx, llvm::Attribute::ZExt);
240240
}
241241

242242
// `~` pointer parameters never alias because ownership is transferred
243243
ty::ty_uniq(inner) => {
244244
let llsz = machine::llsize_of_real(ccx, type_of::type_of(ccx, inner));
245245

246-
attrs.arg(idx, llvm::Attribute::NoAliasAttribute)
246+
attrs.arg(idx, llvm::Attribute::NoAlias)
247247
.arg(idx, llvm::DereferenceableAttribute(llsz));
248248
}
249249

@@ -256,23 +256,23 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
256256
!ty::type_contents(ccx.tcx(), mt.ty).interior_unsafe() => {
257257

258258
let llsz = machine::llsize_of_real(ccx, type_of::type_of(ccx, mt.ty));
259-
attrs.arg(idx, llvm::Attribute::NoAliasAttribute)
259+
attrs.arg(idx, llvm::Attribute::NoAlias)
260260
.arg(idx, llvm::DereferenceableAttribute(llsz));
261261

262262
if mt.mutbl == ast::MutImmutable {
263-
attrs.arg(idx, llvm::Attribute::ReadOnlyAttribute);
263+
attrs.arg(idx, llvm::Attribute::ReadOnly);
264264
}
265265

266266
if let ReLateBound(_, BrAnon(_)) = *b {
267-
attrs.arg(idx, llvm::Attribute::NoCaptureAttribute);
267+
attrs.arg(idx, llvm::Attribute::NoCapture);
268268
}
269269
}
270270

271271
// When a reference in an argument has no named lifetime, it's impossible for that
272272
// reference to escape this function (returned or stored beyond the call by a closure).
273273
ty::ty_rptr(&ReLateBound(_, BrAnon(_)), mt) => {
274274
let llsz = machine::llsize_of_real(ccx, type_of::type_of(ccx, mt.ty));
275-
attrs.arg(idx, llvm::Attribute::NoCaptureAttribute)
275+
attrs.arg(idx, llvm::Attribute::NoCapture)
276276
.arg(idx, llvm::DereferenceableAttribute(llsz));
277277
}
278278

src/librustc_trans/trans/cabi_aarch64.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ fn is_homogenous_aggregate_ty(ty: Type) -> Option<(Type, u64)> {
163163

164164
fn classify_ret_ty(ccx: &CrateContext, ty: Type) -> ArgType {
165165
if is_reg_ty(ty) {
166-
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
166+
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
167167
return ArgType::direct(ty, None, None, attr);
168168
}
169169
if let Some((base_ty, members)) = is_homogenous_aggregate_ty(ty) {
@@ -185,12 +185,12 @@ fn classify_ret_ty(ccx: &CrateContext, ty: Type) -> ArgType {
185185
};
186186
return ArgType::direct(ty, Some(llty), None, None);
187187
}
188-
ArgType::indirect(ty, Some(Attribute::StructRetAttribute))
188+
ArgType::indirect(ty, Some(Attribute::StructRet))
189189
}
190190

191191
fn classify_arg_ty(ccx: &CrateContext, ty: Type) -> ArgType {
192192
if is_reg_ty(ty) {
193-
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
193+
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
194194
return ArgType::direct(ty, None, None, attr);
195195
}
196196
if let Some((base_ty, members)) = is_homogenous_aggregate_ty(ty) {

src/librustc_trans/trans/cabi_arm.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn ty_size(ty: Type, align_fn: TyAlignFn) -> usize {
131131

132132
fn classify_ret_ty(ccx: &CrateContext, ty: Type, align_fn: TyAlignFn) -> ArgType {
133133
if is_reg_ty(ty) {
134-
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
134+
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
135135
return ArgType::direct(ty, None, None, attr);
136136
}
137137
let size = ty_size(ty, align_fn);
@@ -145,12 +145,12 @@ fn classify_ret_ty(ccx: &CrateContext, ty: Type, align_fn: TyAlignFn) -> ArgType
145145
};
146146
return ArgType::direct(ty, Some(llty), None, None);
147147
}
148-
ArgType::indirect(ty, Some(Attribute::StructRetAttribute))
148+
ArgType::indirect(ty, Some(Attribute::StructRet))
149149
}
150150

151151
fn classify_arg_ty(ccx: &CrateContext, ty: Type, align_fn: TyAlignFn) -> ArgType {
152152
if is_reg_ty(ty) {
153-
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
153+
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
154154
return ArgType::direct(ty, None, None, attr);
155155
}
156156
let align = align_fn(ty);

src/librustc_trans/trans/cabi_mips.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ fn ty_size(ty: Type) -> usize {
8888

8989
fn classify_ret_ty(ccx: &CrateContext, ty: Type) -> ArgType {
9090
if is_reg_ty(ty) {
91-
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
91+
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
9292
ArgType::direct(ty, None, None, attr)
9393
} else {
94-
ArgType::indirect(ty, Some(Attribute::StructRetAttribute))
94+
ArgType::indirect(ty, Some(Attribute::StructRet))
9595
}
9696
}
9797

@@ -105,7 +105,7 @@ fn classify_arg_ty(ccx: &CrateContext, ty: Type, offset: &mut usize) -> ArgType
105105
*offset += align_up_to(size, align * 8) / 8;
106106

107107
if is_reg_ty(ty) {
108-
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
108+
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
109109
ArgType::direct(ty, None, None, attr)
110110
} else {
111111
ArgType::direct(

src/librustc_trans/trans/cabi_powerpc.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ fn ty_size(ty: Type) -> usize {
8484

8585
fn classify_ret_ty(ccx: &CrateContext, ty: Type) -> ArgType {
8686
if is_reg_ty(ty) {
87-
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
87+
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
8888
ArgType::direct(ty, None, None, attr)
8989
} else {
90-
ArgType::indirect(ty, Some(Attribute::StructRetAttribute))
90+
ArgType::indirect(ty, Some(Attribute::StructRet))
9191
}
9292
}
9393

@@ -101,7 +101,7 @@ fn classify_arg_ty(ccx: &CrateContext, ty: Type, offset: &mut usize) -> ArgType
101101
*offset += align_up_to(size, align * 8) / 8;
102102

103103
if is_reg_ty(ty) {
104-
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
104+
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
105105
ArgType::direct(ty, None, None, attr)
106106
} else {
107107
ArgType::direct(

src/librustc_trans/trans/cabi_x86.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ pub fn compute_abi_info(ccx: &CrateContext,
5252
ret_ty = ArgType::direct(rty, Some(t), None, None);
5353
}
5454
RetPointer => {
55-
ret_ty = ArgType::indirect(rty, Some(Attribute::StructRetAttribute));
55+
ret_ty = ArgType::indirect(rty, Some(Attribute::StructRet));
5656
}
5757
}
5858
} else {
59-
let attr = if rty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
59+
let attr = if rty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
6060
ret_ty = ArgType::direct(rty, None, None, attr);
6161
}
6262

@@ -67,11 +67,11 @@ pub fn compute_abi_info(ccx: &CrateContext,
6767
if size == 0 {
6868
ArgType::ignore(t)
6969
} else {
70-
ArgType::indirect(t, Some(Attribute::ByValAttribute))
70+
ArgType::indirect(t, Some(Attribute::ByVal))
7171
}
7272
}
7373
_ => {
74-
let attr = if t == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
74+
let attr = if t == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
7575
ArgType::direct(t, None, None, attr)
7676
}
7777
};

src/librustc_trans/trans/cabi_x86_64.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -406,19 +406,19 @@ pub fn compute_abi_info(ccx: &CrateContext,
406406
None)
407407
}
408408
} else {
409-
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
409+
let attr = if ty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
410410
ArgType::direct(ty, None, None, attr)
411411
}
412412
}
413413

414414
let mut arg_tys = Vec::new();
415415
for t in atys {
416-
let ty = x86_64_ty(ccx, *t, |cls| cls.is_pass_byval(), Attribute::ByValAttribute);
416+
let ty = x86_64_ty(ccx, *t, |cls| cls.is_pass_byval(), Attribute::ByVal);
417417
arg_tys.push(ty);
418418
}
419419

420420
let ret_ty = if ret_def {
421-
x86_64_ty(ccx, rty, |cls| cls.is_ret_bysret(), Attribute::StructRetAttribute)
421+
x86_64_ty(ccx, rty, |cls| cls.is_ret_bysret(), Attribute::StructRet)
422422
} else {
423423
ArgType::direct(Type::void(ccx), None, None, None)
424424
};

src/librustc_trans/trans/cabi_x86_win64.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ pub fn compute_abi_info(ccx: &CrateContext,
3131
2 => ArgType::direct(rty, Some(Type::i16(ccx)), None, None),
3232
4 => ArgType::direct(rty, Some(Type::i32(ccx)), None, None),
3333
8 => ArgType::direct(rty, Some(Type::i64(ccx)), None, None),
34-
_ => ArgType::indirect(rty, Some(Attribute::StructRetAttribute))
34+
_ => ArgType::indirect(rty, Some(Attribute::StructRet))
3535
};
3636
} else {
37-
let attr = if rty == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
37+
let attr = if rty == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
3838
ret_ty = ArgType::direct(rty, None, None, attr);
3939
}
4040

@@ -46,11 +46,11 @@ pub fn compute_abi_info(ccx: &CrateContext,
4646
2 => ArgType::direct(rty, Some(Type::i16(ccx)), None, None),
4747
4 => ArgType::direct(rty, Some(Type::i32(ccx)), None, None),
4848
8 => ArgType::direct(rty, Some(Type::i64(ccx)), None, None),
49-
_ => ArgType::indirect(t, Some(Attribute::ByValAttribute))
49+
_ => ArgType::indirect(t, Some(Attribute::ByVal))
5050
}
5151
}
5252
_ => {
53-
let attr = if t == Type::i1(ccx) { Some(Attribute::ZExtAttribute) } else { None };
53+
let attr = if t == Type::i1(ccx) { Some(Attribute::ZExt) } else { None };
5454
ArgType::direct(t, None, None, attr)
5555
}
5656
};

0 commit comments

Comments
 (0)