Skip to content

Commit c245d27

Browse files
committed
Beginning of moving all backend-agnostic code to rustc_codegen_ssa
1 parent 1dcb0da commit c245d27

File tree

28 files changed

+263
-200
lines changed

28 files changed

+263
-200
lines changed

src/librustc_codegen_llvm/back/lto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use rustc_data_structures::fx::FxHashMap;
2525
use rustc_codegen_utils::symbol_export;
2626
use time_graph::Timeline;
2727
use ModuleLlvm;
28-
use rustc_codegen_utils::{ModuleCodegen, ModuleKind};
28+
use rustc_codegen_ssa::{ModuleCodegen, ModuleKind};
2929

3030
use libc;
3131

src/librustc_codegen_llvm/back/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use time_graph::{self, TimeGraph, Timeline};
2727
use llvm::{self, DiagnosticInfo, PassManager, SMDiagnostic};
2828
use llvm_util;
2929
use {CodegenResults, ModuleLlvm};
30-
use rustc_codegen_utils::{ModuleCodegen, ModuleKind, CachedModuleCodegen, CompiledModule};
30+
use rustc_codegen_ssa::{ModuleCodegen, ModuleKind, CachedModuleCodegen, CompiledModule};
3131
use CrateInfo;
3232
use rustc::hir::def_id::{CrateNum, LOCAL_CRATE};
3333
use rustc::ty::TyCtxt;

src/librustc_codegen_llvm/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
//! int) and rec(x=int, y=int, z=int) will have the same llvm::Type.
2525
2626
use super::ModuleLlvm;
27-
use rustc_codegen_utils::{ModuleCodegen, ModuleKind, CachedModuleCodegen};
27+
use rustc_codegen_ssa::{ModuleCodegen, ModuleKind, CachedModuleCodegen};
2828
use super::LlvmCodegenBackend;
2929

3030
use abi;
@@ -53,7 +53,7 @@ use callee;
5353
use rustc_mir::monomorphize::collector::{self, MonoItemCollectionMode};
5454
use rustc_mir::monomorphize::item::DefPathBasedNames;
5555
use common;
56-
use rustc_codegen_utils::common::{RealPredicate, TypeKind, IntPredicate};
56+
use rustc_codegen_ssa::common::{RealPredicate, TypeKind, IntPredicate};
5757
use meth;
5858
use mir;
5959
use context::CodegenCx;

src/librustc_codegen_llvm/builder.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
use llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect};
1212
use llvm::{self, False, OperandBundleDef, BasicBlock};
13-
use rustc_codegen_utils::common::{IntPredicate, TypeKind, RealPredicate};
14-
use rustc_codegen_utils;
13+
use rustc_codegen_ssa::common::{IntPredicate, TypeKind, RealPredicate};
14+
use rustc_codegen_ssa;
1515
use context::CodegenCx;
1616
use type_::Type;
1717
use type_of::LayoutLlvmExt;
@@ -198,7 +198,7 @@ impl BuilderMethods<'a, 'll, 'tcx>
198198
args: &[&'ll Value],
199199
then: &'ll BasicBlock,
200200
catch: &'ll BasicBlock,
201-
bundle: Option<&rustc_codegen_utils::common::OperandBundleDef<'ll, &'ll Value>>
201+
bundle: Option<&rustc_codegen_ssa::common::OperandBundleDef<'ll, &'ll Value>>
202202
) -> &'ll Value {
203203
self.count_insn("invoke");
204204

@@ -516,7 +516,7 @@ impl BuilderMethods<'a, 'll, 'tcx>
516516
fn atomic_load(
517517
&self,
518518
ptr: &'ll Value,
519-
order: rustc_codegen_utils::common::AtomicOrdering,
519+
order: rustc_codegen_ssa::common::AtomicOrdering,
520520
align: Align
521521
) -> &'ll Value {
522522
self.count_insn("load.atomic");
@@ -636,7 +636,7 @@ impl BuilderMethods<'a, 'll, 'tcx>
636636
}
637637

638638
fn atomic_store(&self, val: &'ll Value, ptr: &'ll Value,
639-
order: rustc_codegen_utils::common::AtomicOrdering, align: Align) {
639+
order: rustc_codegen_ssa::common::AtomicOrdering, align: Align) {
640640
debug!("Store {:?} -> {:?}", val, ptr);
641641
self.count_insn("store.atomic");
642642
let ptr = self.check_store(val, ptr);
@@ -1167,8 +1167,8 @@ impl BuilderMethods<'a, 'll, 'tcx>
11671167
dst: &'ll Value,
11681168
cmp: &'ll Value,
11691169
src: &'ll Value,
1170-
order: rustc_codegen_utils::common::AtomicOrdering,
1171-
failure_order: rustc_codegen_utils::common::AtomicOrdering,
1170+
order: rustc_codegen_ssa::common::AtomicOrdering,
1171+
failure_order: rustc_codegen_ssa::common::AtomicOrdering,
11721172
weak: bool,
11731173
) -> &'ll Value {
11741174
let weak = if weak { llvm::True } else { llvm::False };
@@ -1186,10 +1186,10 @@ impl BuilderMethods<'a, 'll, 'tcx>
11861186
}
11871187
fn atomic_rmw(
11881188
&self,
1189-
op: rustc_codegen_utils::common::AtomicRmwBinOp,
1189+
op: rustc_codegen_ssa::common::AtomicRmwBinOp,
11901190
dst: &'ll Value,
11911191
src: &'ll Value,
1192-
order: rustc_codegen_utils::common::AtomicOrdering,
1192+
order: rustc_codegen_ssa::common::AtomicOrdering,
11931193
) -> &'ll Value {
11941194
unsafe {
11951195
llvm::LLVMBuildAtomicRMW(
@@ -1204,8 +1204,8 @@ impl BuilderMethods<'a, 'll, 'tcx>
12041204

12051205
fn atomic_fence(
12061206
&self,
1207-
order: rustc_codegen_utils::common::AtomicOrdering,
1208-
scope: rustc_codegen_utils::common::SynchronizationScope
1207+
order: rustc_codegen_ssa::common::AtomicOrdering,
1208+
scope: rustc_codegen_ssa::common::SynchronizationScope
12091209
) {
12101210
unsafe {
12111211
llvm::LLVMRustBuildAtomicFence(
@@ -1325,7 +1325,7 @@ impl BuilderMethods<'a, 'll, 'tcx>
13251325
&self,
13261326
llfn: &'ll Value,
13271327
args: &[&'ll Value],
1328-
bundle: Option<&rustc_codegen_utils::common::OperandBundleDef<'ll, &'ll Value>>
1328+
bundle: Option<&rustc_codegen_ssa::common::OperandBundleDef<'ll, &'ll Value>>
13291329
) -> &'ll Value {
13301330
self.count_insn("call");
13311331

src/librustc_codegen_llvm/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ 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_ssa::common::TypeKind;
3434

3535
use libc::{c_uint, c_char};
3636

src/librustc_codegen_llvm/declare.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl DeclareMethods<'ll, 'tcx> for CodegenCx<'ll, 'tcx, &'ll Value> {
128128
let fty = FnType::new(self, sig, &[]);
129129
let llfn = declare_raw_fn(self, name, fty.llvm_cconv(), fty.llvm_type(self));
130130

131-
if self.layout_of(sig.output()).abi == layout::Abi::Uninhabited {
131+
if self.layout_of(sig.output()).abi.is_uninhabited() {
132132
llvm::Attribute::NoReturn.apply_llfn(Function, llfn);
133133
}
134134

src/librustc_codegen_llvm/glue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
use std;
1616

17-
use rustc_codegen_utils::common::IntPredicate;
17+
use rustc_codegen_ssa::common::IntPredicate;
1818
use meth;
1919
use rustc::ty::layout::{LayoutOf, TyLayout, HasTyCtxt};
2020
use rustc::ty::{self, Ty};

src/librustc_codegen_llvm/interfaces/builder.rs

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

11-
use rustc_codegen_utils::common::{IntPredicate, RealPredicate, AtomicOrdering,
11+
use rustc_codegen_ssa::common::{IntPredicate, RealPredicate, AtomicOrdering,
1212
SynchronizationScope, AtomicRmwBinOp, OperandBundleDef};
1313
use libc::c_char;
1414
use rustc::ty::TyCtxt;

src/librustc_codegen_llvm/interfaces/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ mod declare;
2020
mod asm;
2121

2222
pub use self::builder::{BuilderMethods, HasCodegen};
23-
pub use rustc_codegen_utils::interfaces::{Backend, BackendMethods};
23+
pub use rustc_codegen_ssa::interfaces::{Backend, BackendMethods, CodegenObject};
2424
pub use self::consts::ConstMethods;
2525
pub use self::type_::{TypeMethods, BaseTypeMethods, DerivedTypeMethods,
2626
LayoutTypeMethods, ArgTypeMethods};
@@ -31,7 +31,6 @@ pub use self::debuginfo::{DebugInfoMethods, DebugInfoBuilderMethods};
3131
pub use self::abi::{AbiMethods, AbiBuilderMethods};
3232
pub use self::declare::{DeclareMethods, PreDefineMethods};
3333
pub use self::asm::{AsmMethods, AsmBuilderMethods};
34-
pub use rustc_codegen_utils::interfaces::CodegenObject;
3534

3635
pub trait CodegenMethods<'ll, 'tcx: 'll> :
3736
Backend<'ll> + TypeMethods<'ll, 'tcx> + MiscMethods<'ll, 'tcx> + ConstMethods<'ll, 'tcx> +

src/librustc_codegen_llvm/interfaces/type_.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use super::Backend;
1212
use super::builder::HasCodegen;
13-
use rustc_codegen_utils::common::TypeKind;
13+
use rustc_codegen_ssa::common::TypeKind;
1414
use syntax::ast;
1515
use rustc::ty::layout::{self, Align, Size};
1616
use std::cell::RefCell;

0 commit comments

Comments
 (0)