Skip to content

Commit e69dacb

Browse files
committed
rustc_trans: rename ccx to cx.
1 parent fb7de6a commit e69dacb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1193
-1193
lines changed

src/librustc_trans/abi.rs

+91-91
Large diffs are not rendered by default.

src/librustc_trans/asm.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub fn trans_inline_asm<'a, 'tcx>(
4545
if out.is_indirect {
4646
indirect_outputs.push(place.load(bcx).immediate());
4747
} else {
48-
output_types.push(place.layout.llvm_type(bcx.ccx));
48+
output_types.push(place.layout.llvm_type(bcx.cx));
4949
}
5050
}
5151
if !indirect_outputs.is_empty() {
@@ -76,9 +76,9 @@ pub fn trans_inline_asm<'a, 'tcx>(
7676
// Depending on how many outputs we have, the return type is different
7777
let num_outputs = output_types.len();
7878
let output_type = match num_outputs {
79-
0 => Type::void(bcx.ccx),
79+
0 => Type::void(bcx.cx),
8080
1 => output_types[0],
81-
_ => Type::struct_(bcx.ccx, &output_types, false)
81+
_ => Type::struct_(bcx.cx, &output_types, false)
8282
};
8383

8484
let dialect = match ia.dialect {
@@ -109,20 +109,20 @@ pub fn trans_inline_asm<'a, 'tcx>(
109109
// back to source locations. See #17552.
110110
unsafe {
111111
let key = "srcloc";
112-
let kind = llvm::LLVMGetMDKindIDInContext(bcx.ccx.llcx,
112+
let kind = llvm::LLVMGetMDKindIDInContext(bcx.cx.llcx,
113113
key.as_ptr() as *const c_char, key.len() as c_uint);
114114

115-
let val: llvm::ValueRef = C_i32(bcx.ccx, ia.ctxt.outer().as_u32() as i32);
115+
let val: llvm::ValueRef = C_i32(bcx.cx, ia.ctxt.outer().as_u32() as i32);
116116

117117
llvm::LLVMSetMetadata(r, kind,
118-
llvm::LLVMMDNodeInContext(bcx.ccx.llcx, &val, 1));
118+
llvm::LLVMMDNodeInContext(bcx.cx.llcx, &val, 1));
119119
}
120120
}
121121

122-
pub fn trans_global_asm<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
122+
pub fn trans_global_asm<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
123123
ga: &hir::GlobalAsm) {
124124
let asm = CString::new(ga.asm.as_str().as_bytes()).unwrap();
125125
unsafe {
126-
llvm::LLVMRustAppendModuleInlineAsm(ccx.llmod, asm.as_ptr());
126+
llvm::LLVMRustAppendModuleInlineAsm(cx.llmod, asm.as_ptr());
127127
}
128128
}

src/librustc_trans/attributes.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -67,27 +67,27 @@ pub fn naked(val: ValueRef, is_naked: bool) {
6767
Attribute::Naked.toggle_llfn(Function, val, is_naked);
6868
}
6969

70-
pub fn set_frame_pointer_elimination(ccx: &CodegenCx, llfn: ValueRef) {
70+
pub fn set_frame_pointer_elimination(cx: &CodegenCx, llfn: ValueRef) {
7171
// FIXME: #11906: Omitting frame pointers breaks retrieving the value of a
7272
// parameter.
73-
if ccx.sess().must_not_eliminate_frame_pointers() {
73+
if cx.sess().must_not_eliminate_frame_pointers() {
7474
llvm::AddFunctionAttrStringValue(
7575
llfn, llvm::AttributePlace::Function,
7676
cstr("no-frame-pointer-elim\0"), cstr("true\0"));
7777
}
7878
}
7979

80-
pub fn set_probestack(ccx: &CodegenCx, llfn: ValueRef) {
80+
pub fn set_probestack(cx: &CodegenCx, llfn: ValueRef) {
8181
// Only use stack probes if the target specification indicates that we
8282
// should be using stack probes
83-
if !ccx.sess().target.target.options.stack_probes {
83+
if !cx.sess().target.target.options.stack_probes {
8484
return
8585
}
8686

8787
// Currently stack probes seem somewhat incompatible with the address
8888
// sanitizer. With asan we're already protected from stack overflow anyway
8989
// so we don't really need stack probes regardless.
90-
match ccx.sess().opts.debugging_opts.sanitizer {
90+
match cx.sess().opts.debugging_opts.sanitizer {
9191
Some(Sanitizer::Address) => return,
9292
_ => {}
9393
}
@@ -101,13 +101,13 @@ pub fn set_probestack(ccx: &CodegenCx, llfn: ValueRef) {
101101

102102
/// Composite function which sets LLVM attributes for function depending on its AST (#[attribute])
103103
/// attributes.
104-
pub fn from_fn_attrs(ccx: &CodegenCx, llfn: ValueRef, id: DefId) {
104+
pub fn from_fn_attrs(cx: &CodegenCx, llfn: ValueRef, id: DefId) {
105105
use syntax::attr::*;
106-
let attrs = ccx.tcx.get_attrs(id);
107-
inline(llfn, find_inline_attr(Some(ccx.sess().diagnostic()), &attrs));
106+
let attrs = cx.tcx.get_attrs(id);
107+
inline(llfn, find_inline_attr(Some(cx.sess().diagnostic()), &attrs));
108108

109-
set_frame_pointer_elimination(ccx, llfn);
110-
set_probestack(ccx, llfn);
109+
set_frame_pointer_elimination(cx, llfn);
110+
set_probestack(cx, llfn);
111111

112112
for attr in attrs.iter() {
113113
if attr.check_name("cold") {
@@ -124,7 +124,7 @@ pub fn from_fn_attrs(ccx: &CodegenCx, llfn: ValueRef, id: DefId) {
124124
}
125125
}
126126

127-
let target_features = ccx.tcx.target_features_enabled(id);
127+
let target_features = cx.tcx.target_features_enabled(id);
128128
if !target_features.is_empty() {
129129
let val = CString::new(target_features.join(",")).unwrap();
130130
llvm::AddFunctionAttrStringValue(

0 commit comments

Comments
 (0)