diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs index 7f45e1e675b..7d1b3a4c6e5 100644 --- a/src/librustc_codegen_llvm/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -53,7 +53,8 @@ use mir::place::PlaceRef; use builder::{Builder, MemFlags}; use callee; use rustc_mir::monomorphize::item::DefPathBasedNames; -use common::{self, IntPredicate, RealPredicate, TypeKind}; +use common::{self, RealPredicate, TypeKind}; +use rustc_codegen_utils::common::IntPredicate; use meth; use mir; use context::CodegenCx; diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index 642c36e886e..94b308421eb 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -11,6 +11,7 @@ use llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect}; use llvm::{self, False, OperandBundleDef, BasicBlock}; use common::{self, *}; +use rustc_codegen_utils::common::IntPredicate; use context::CodegenCx; use type_::Type; use type_of::LayoutLlvmExt; diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs index 51c8ab9308b..67fae48e2e5 100644 --- a/src/librustc_codegen_llvm/common.rs +++ b/src/librustc_codegen_llvm/common.rs @@ -64,19 +64,6 @@ impl<'a, V> OperandBundleDef<'a, V> { } } -pub enum IntPredicate { - IntEQ, - IntNE, - IntUGT, - IntUGE, - IntULT, - IntULE, - IntSGT, - IntSGE, - IntSLT, - IntSLE -} - #[allow(dead_code)] pub enum RealPredicate { RealPredicateFalse, diff --git a/src/librustc_codegen_llvm/glue.rs b/src/librustc_codegen_llvm/glue.rs index 7268c2c1aac..e641c153023 100644 --- a/src/librustc_codegen_llvm/glue.rs +++ b/src/librustc_codegen_llvm/glue.rs @@ -14,7 +14,7 @@ use std; -use common::*; +use rustc_codegen_utils::common::IntPredicate; use meth; use rustc::ty::layout::LayoutOf; use rustc::ty::{self, Ty}; diff --git a/src/librustc_codegen_llvm/interfaces/builder.rs b/src/librustc_codegen_llvm/interfaces/builder.rs index 139ad4d3d69..7874a4496e9 100644 --- a/src/librustc_codegen_llvm/interfaces/builder.rs +++ b/src/librustc_codegen_llvm/interfaces/builder.rs @@ -20,6 +20,7 @@ use libc::c_char; use mir::operand::OperandRef; use mir::place::PlaceRef; use rustc::ty::layout::{Align, Size}; +use rustc_codegen_utils::common::IntPredicate; use std::borrow::Cow; use std::ops::Range; diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs index ea446f4b544..e3aac40c081 100644 --- a/src/librustc_codegen_llvm/llvm/ffi.rs +++ b/src/librustc_codegen_llvm/llvm/ffi.rs @@ -20,6 +20,7 @@ use libc::{c_ulonglong, c_void}; use std::marker::PhantomData; use common; +use rustc_codegen_utils; use syntax; use super::RustString; @@ -144,18 +145,18 @@ pub enum IntPredicate { } impl IntPredicate { - pub fn from_generic(intpre: common::IntPredicate) -> Self { + pub fn from_generic(intpre: rustc_codegen_utils::common::IntPredicate) -> Self { match intpre { - common::IntPredicate::IntEQ => IntPredicate::IntEQ, - common::IntPredicate::IntNE => IntPredicate::IntNE, - common::IntPredicate::IntUGT => IntPredicate::IntUGT, - common::IntPredicate::IntUGE => IntPredicate::IntUGE, - common::IntPredicate::IntULT => IntPredicate::IntULT, - common::IntPredicate::IntULE => IntPredicate::IntULE, - common::IntPredicate::IntSGT => IntPredicate::IntSGT, - common::IntPredicate::IntSGE => IntPredicate::IntSGE, - common::IntPredicate::IntSLT => IntPredicate::IntSLT, - common::IntPredicate::IntSLE => IntPredicate::IntSLE, + rustc_codegen_utils::common::IntPredicate::IntEQ => IntPredicate::IntEQ, + rustc_codegen_utils::common::IntPredicate::IntNE => IntPredicate::IntNE, + rustc_codegen_utils::common::IntPredicate::IntUGT => IntPredicate::IntUGT, + rustc_codegen_utils::common::IntPredicate::IntUGE => IntPredicate::IntUGE, + rustc_codegen_utils::common::IntPredicate::IntULT => IntPredicate::IntULT, + rustc_codegen_utils::common::IntPredicate::IntULE => IntPredicate::IntULE, + rustc_codegen_utils::common::IntPredicate::IntSGT => IntPredicate::IntSGT, + rustc_codegen_utils::common::IntPredicate::IntSGE => IntPredicate::IntSGE, + rustc_codegen_utils::common::IntPredicate::IntSLT => IntPredicate::IntSLT, + rustc_codegen_utils::common::IntPredicate::IntSLE => IntPredicate::IntSLE, } } } diff --git a/src/librustc_codegen_llvm/mir/block.rs b/src/librustc_codegen_llvm/mir/block.rs index cdde24a0755..1d3ebebd997 100644 --- a/src/librustc_codegen_llvm/mir/block.rs +++ b/src/librustc_codegen_llvm/mir/block.rs @@ -17,7 +17,8 @@ use abi::{Abi, FnType, PassMode}; use rustc_target::abi::call::ArgType; use base; use builder::MemFlags; -use common::{self, Funclet, IntPredicate}; +use common::{self, Funclet}; +use rustc_codegen_utils::common::IntPredicate; use meth; use monomorphize; diff --git a/src/librustc_codegen_llvm/mir/place.rs b/src/librustc_codegen_llvm/mir/place.rs index 549dc31612c..22ba0fda83b 100644 --- a/src/librustc_codegen_llvm/mir/place.rs +++ b/src/librustc_codegen_llvm/mir/place.rs @@ -13,7 +13,7 @@ use rustc::ty::layout::{self, Align, TyLayout, LayoutOf, VariantIdx, HasTyCtxt}; use rustc::mir; use rustc::mir::tcx::PlaceTy; use builder::MemFlags; -use common::IntPredicate; +use rustc_codegen_utils::common::IntPredicate; use type_of::LayoutLlvmExt; use glue; diff --git a/src/librustc_codegen_llvm/mir/rvalue.rs b/src/librustc_codegen_llvm/mir/rvalue.rs index 4f57a1dfd60..15a225e4e24 100644 --- a/src/librustc_codegen_llvm/mir/rvalue.rs +++ b/src/librustc_codegen_llvm/mir/rvalue.rs @@ -19,7 +19,8 @@ use std::{u128, i128}; use base; use builder::MemFlags; use callee; -use common::{self, IntPredicate, RealPredicate}; +use common::{self, RealPredicate}; +use rustc_codegen_utils::common::IntPredicate; use monomorphize; use type_of::LayoutLlvmExt; diff --git a/src/librustc_codegen_utils/common.rs b/src/librustc_codegen_utils/common.rs new file mode 100644 index 00000000000..b5640cfab38 --- /dev/null +++ b/src/librustc_codegen_utils/common.rs @@ -0,0 +1,22 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub enum IntPredicate { + IntEQ, + IntNE, + IntUGT, + IntUGE, + IntULT, + IntULE, + IntSGT, + IntSGE, + IntSLT, + IntSLE +} diff --git a/src/librustc_codegen_utils/lib.rs b/src/librustc_codegen_utils/lib.rs index f0ce1e9b0ef..2141a763d16 100644 --- a/src/librustc_codegen_utils/lib.rs +++ b/src/librustc_codegen_utils/lib.rs @@ -54,6 +54,7 @@ pub mod codegen_backend; pub mod symbol_export; pub mod symbol_names; pub mod symbol_names_test; +pub mod common; /// check for the #[rustc_error] annotation, which forces an /// error in codegen. This is used to write compile-fail tests