Skip to content

Commit a03673c

Browse files
committed
Moved OperandBundleDef
1 parent 0da5170 commit a03673c

File tree

6 files changed

+55
-45
lines changed

6 files changed

+55
-45
lines changed

src/librustc_codegen_llvm/builder.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
use llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect};
1212
use llvm::{self, False, OperandBundleDef, BasicBlock};
13-
use common;
1413
use rustc_codegen_utils::common::{IntPredicate, TypeKind, RealPredicate};
1514
use rustc_codegen_utils;
1615
use context::CodegenCx;
@@ -193,12 +192,14 @@ impl BuilderMethods<'a, 'll, 'tcx>
193192
}
194193
}
195194

196-
fn invoke(&self,
197-
llfn: &'ll Value,
198-
args: &[&'ll Value],
199-
then: &'ll BasicBlock,
200-
catch: &'ll BasicBlock,
201-
bundle: Option<&common::OperandBundleDef<'ll, &'ll Value>>) -> &'ll Value {
195+
fn invoke(
196+
&self,
197+
llfn: &'ll Value,
198+
args: &[&'ll Value],
199+
then: &'ll BasicBlock,
200+
catch: &'ll BasicBlock,
201+
bundle: Option<&rustc_codegen_utils::common::OperandBundleDef<'ll, &'ll Value>>
202+
) -> &'ll Value {
202203
self.count_insn("invoke");
203204

204205
debug!("Invoke {:?} with args ({:?})",
@@ -1323,8 +1324,12 @@ impl BuilderMethods<'a, 'll, 'tcx>
13231324
self.call(lifetime_intrinsic, &[self.cx.const_u64(size), ptr], None);
13241325
}
13251326

1326-
fn call(&self, llfn: &'ll Value, args: &[&'ll Value],
1327-
bundle: Option<&common::OperandBundleDef<'ll, &'ll Value>>) -> &'ll Value {
1327+
fn call(
1328+
&self,
1329+
llfn: &'ll Value,
1330+
args: &[&'ll Value],
1331+
bundle: Option<&rustc_codegen_utils::common::OperandBundleDef<'ll, &'ll Value>>
1332+
) -> &'ll Value {
13281333
self.count_insn("call");
13291334

13301335
debug!("Call {:?} with args ({:?})",

src/librustc_codegen_llvm/common.rs

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,44 +30,18 @@ use rustc::hir;
3030
use interfaces::BuilderMethods;
3131
use mir::constant::const_alloc_to_llvm;
3232
use mir::place::PlaceRef;
33-
use rustc_codegen_utils::common::TypeKind;
33+
use rustc_codegen_utils::common::{OperandBundleDef, TypeKind};
3434

3535
use libc::{c_uint, c_char};
3636
use std::iter;
3737

3838
use rustc_target::spec::abi::Abi;
3939
use syntax::symbol::LocalInternedString;
4040
use syntax::ast::Mutability;
41-
use syntax_pos::{Span, DUMMY_SP};
41+
use syntax_pos::Span;
4242

4343
pub use context::CodegenCx;
4444

45-
pub fn type_needs_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
46-
ty.needs_drop(tcx, ty::ParamEnv::reveal_all())
47-
}
48-
49-
pub fn type_is_sized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
50-
ty.is_sized(tcx.at(DUMMY_SP), ty::ParamEnv::reveal_all())
51-
}
52-
53-
pub fn type_is_freeze<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
54-
ty.is_freeze(tcx, ty::ParamEnv::reveal_all(), DUMMY_SP)
55-
}
56-
57-
pub struct OperandBundleDef<'a, V> {
58-
pub name: &'a str,
59-
pub val: V
60-
}
61-
62-
impl<V> OperandBundleDef<'ll, V> {
63-
pub fn new(name: &'ll str, val: V) -> Self {
64-
OperandBundleDef {
65-
name,
66-
val
67-
}
68-
}
69-
}
70-
7145
/*
7246
* A note on nomenclature of linking: "extern", "foreign", and "upcall".
7347
*

src/librustc_codegen_llvm/interfaces/builder.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use common::*;
12-
use rustc_codegen_utils::common::{IntPredicate, RealPredicate, AtomicOrdering, SynchronizationScope, AtomicRmwBinOp};
11+
use rustc_codegen_utils::common::{IntPredicate, RealPredicate, AtomicOrdering, SynchronizationScope, AtomicRmwBinOp, OperandBundleDef};
1312
use libc::c_char;
1413
use rustc::ty::TyCtxt;
1514
use rustc::ty::layout::{Align, Size};

src/librustc_codegen_llvm/llvm/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use std::ffi::CStr;
2828
use std::cell::RefCell;
2929
use libc::{self, c_uint, c_char, size_t};
3030
use rustc_data_structures::small_c_str::SmallCStr;
31-
use common;
31+
use rustc_codegen_utils;
3232

3333
pub mod archive_ro;
3434
pub mod diagnostic;
@@ -273,7 +273,9 @@ impl OperandBundleDef<'a> {
273273
OperandBundleDef { raw: def }
274274
}
275275

276-
pub fn from_generic(bundle : &common::OperandBundleDef<'a, &'a Value>) -> Self {
276+
pub fn from_generic(
277+
bundle : &rustc_codegen_utils::common::OperandBundleDef<'a, &'a Value>
278+
) -> Self {
277279
Self::new(bundle.name, &[bundle.val])
278280
}
279281
}

src/librustc_codegen_llvm/type_.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use rustc::ty::layout::TyLayout;
2727
use rustc_target::abi::call::{CastTarget, FnType, Reg};
2828
use rustc_data_structures::small_c_str::SmallCStr;
2929
use common;
30+
use rustc_codegen_utils;
3031
use rustc_codegen_utils::common::TypeKind;
3132
use type_of::LayoutLlvmExt;
3233
use abi::{LlvmType, FnTypeExt};
@@ -373,15 +374,15 @@ impl DerivedTypeMethods<'ll, 'tcx> for CodegenCx<'ll, 'tcx, &'ll Value> {
373374
}
374375

375376
fn type_needs_drop(&self, ty: Ty<'tcx>) -> bool {
376-
common::type_needs_drop(*self.tcx(), ty)
377+
rustc_codegen_utils::common::type_needs_drop(*self.tcx(), ty)
377378
}
378379

379380
fn type_is_sized(&self, ty: Ty<'tcx>) -> bool {
380-
common::type_is_sized(*self.tcx(), ty)
381+
rustc_codegen_utils::common::type_is_sized(*self.tcx(), ty)
381382
}
382383

383384
fn type_is_freeze(&self, ty: Ty<'tcx>) -> bool {
384-
common::type_is_freeze(*self.tcx(), ty)
385+
rustc_codegen_utils::common::type_is_freeze(*self.tcx(), ty)
385386
}
386387

387388
fn type_has_metadata(&self, ty: Ty<'tcx>) -> bool {

src/librustc_codegen_utils/common.rs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,38 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
1110
#![allow(non_camel_case_types, non_snake_case)]
1211

12+
use rustc::ty::{self, Ty, TyCtxt};
13+
use syntax_pos::DUMMY_SP;
14+
15+
16+
pub fn type_needs_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
17+
ty.needs_drop(tcx, ty::ParamEnv::reveal_all())
18+
}
19+
20+
pub fn type_is_sized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
21+
ty.is_sized(tcx.at(DUMMY_SP), ty::ParamEnv::reveal_all())
22+
}
23+
24+
pub fn type_is_freeze<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
25+
ty.is_freeze(tcx, ty::ParamEnv::reveal_all(), DUMMY_SP)
26+
}
27+
28+
pub struct OperandBundleDef<'a, V> {
29+
pub name: &'a str,
30+
pub val: V
31+
}
32+
33+
impl<'a, V> OperandBundleDef<'a, V> {
34+
pub fn new(name: &'a str, val: V) -> Self {
35+
OperandBundleDef {
36+
name,
37+
val
38+
}
39+
}
40+
}
41+
1342
pub enum IntPredicate {
1443
IntEQ,
1544
IntNE,

0 commit comments

Comments
 (0)