Skip to content

Commit 39fd4d9

Browse files
denismerigouxeddyb
authored andcommitted
Starting to move backend-agnostic code into codegen_utils
IntPredicate moved
1 parent 4ba09ab commit 39fd4d9

File tree

11 files changed

+45
-29
lines changed

11 files changed

+45
-29
lines changed

src/librustc_codegen_llvm/base.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ use mir::place::PlaceRef;
5353
use builder::{Builder, MemFlags};
5454
use callee;
5555
use rustc_mir::monomorphize::item::DefPathBasedNames;
56-
use common::{self, IntPredicate, RealPredicate, TypeKind};
56+
use common::{self, RealPredicate, TypeKind};
57+
use rustc_codegen_utils::common::IntPredicate;
5758
use meth;
5859
use mir;
5960
use context::CodegenCx;

src/librustc_codegen_llvm/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect};
1212
use llvm::{self, False, OperandBundleDef, BasicBlock};
1313
use common::{self, *};
14+
use rustc_codegen_utils::common::IntPredicate;
1415
use context::CodegenCx;
1516
use type_::Type;
1617
use type_of::LayoutLlvmExt;

src/librustc_codegen_llvm/common.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,6 @@ impl<'a, V> OperandBundleDef<'a, V> {
6464
}
6565
}
6666

67-
pub enum IntPredicate {
68-
IntEQ,
69-
IntNE,
70-
IntUGT,
71-
IntUGE,
72-
IntULT,
73-
IntULE,
74-
IntSGT,
75-
IntSGE,
76-
IntSLT,
77-
IntSLE
78-
}
79-
8067
#[allow(dead_code)]
8168
pub enum RealPredicate {
8269
RealPredicateFalse,

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 common::*;
17+
use rustc_codegen_utils::common::IntPredicate;
1818
use meth;
1919
use rustc::ty::layout::LayoutOf;
2020
use rustc::ty::{self, Ty};

src/librustc_codegen_llvm/interfaces/builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use libc::c_char;
2020
use mir::operand::OperandRef;
2121
use mir::place::PlaceRef;
2222
use rustc::ty::layout::{Align, Size};
23+
use rustc_codegen_utils::common::IntPredicate;
2324

2425
use std::borrow::Cow;
2526
use std::ops::Range;

src/librustc_codegen_llvm/llvm/ffi.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use libc::{c_ulonglong, c_void};
2020

2121
use std::marker::PhantomData;
2222
use common;
23+
use rustc_codegen_utils;
2324
use syntax;
2425

2526
use super::RustString;
@@ -144,18 +145,18 @@ pub enum IntPredicate {
144145
}
145146

146147
impl IntPredicate {
147-
pub fn from_generic(intpre: common::IntPredicate) -> Self {
148+
pub fn from_generic(intpre: rustc_codegen_utils::common::IntPredicate) -> Self {
148149
match intpre {
149-
common::IntPredicate::IntEQ => IntPredicate::IntEQ,
150-
common::IntPredicate::IntNE => IntPredicate::IntNE,
151-
common::IntPredicate::IntUGT => IntPredicate::IntUGT,
152-
common::IntPredicate::IntUGE => IntPredicate::IntUGE,
153-
common::IntPredicate::IntULT => IntPredicate::IntULT,
154-
common::IntPredicate::IntULE => IntPredicate::IntULE,
155-
common::IntPredicate::IntSGT => IntPredicate::IntSGT,
156-
common::IntPredicate::IntSGE => IntPredicate::IntSGE,
157-
common::IntPredicate::IntSLT => IntPredicate::IntSLT,
158-
common::IntPredicate::IntSLE => IntPredicate::IntSLE,
150+
rustc_codegen_utils::common::IntPredicate::IntEQ => IntPredicate::IntEQ,
151+
rustc_codegen_utils::common::IntPredicate::IntNE => IntPredicate::IntNE,
152+
rustc_codegen_utils::common::IntPredicate::IntUGT => IntPredicate::IntUGT,
153+
rustc_codegen_utils::common::IntPredicate::IntUGE => IntPredicate::IntUGE,
154+
rustc_codegen_utils::common::IntPredicate::IntULT => IntPredicate::IntULT,
155+
rustc_codegen_utils::common::IntPredicate::IntULE => IntPredicate::IntULE,
156+
rustc_codegen_utils::common::IntPredicate::IntSGT => IntPredicate::IntSGT,
157+
rustc_codegen_utils::common::IntPredicate::IntSGE => IntPredicate::IntSGE,
158+
rustc_codegen_utils::common::IntPredicate::IntSLT => IntPredicate::IntSLT,
159+
rustc_codegen_utils::common::IntPredicate::IntSLE => IntPredicate::IntSLE,
159160
}
160161
}
161162
}

src/librustc_codegen_llvm/mir/block.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ use abi::{Abi, FnType, PassMode};
1717
use rustc_target::abi::call::ArgType;
1818
use base;
1919
use builder::MemFlags;
20-
use common::{self, Funclet, IntPredicate};
20+
use common::{self, Funclet};
21+
use rustc_codegen_utils::common::IntPredicate;
2122
use meth;
2223
use monomorphize;
2324

src/librustc_codegen_llvm/mir/place.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc::ty::layout::{self, Align, TyLayout, LayoutOf, VariantIdx, HasTyCtxt};
1313
use rustc::mir;
1414
use rustc::mir::tcx::PlaceTy;
1515
use builder::MemFlags;
16-
use common::IntPredicate;
16+
use rustc_codegen_utils::common::IntPredicate;
1717
use type_of::LayoutLlvmExt;
1818
use glue;
1919

src/librustc_codegen_llvm/mir/rvalue.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ use std::{u128, i128};
1919
use base;
2020
use builder::MemFlags;
2121
use callee;
22-
use common::{self, IntPredicate, RealPredicate};
22+
use common::{self, RealPredicate};
23+
use rustc_codegen_utils::common::IntPredicate;
2324
use monomorphize;
2425
use type_of::LayoutLlvmExt;
2526

src/librustc_codegen_utils/common.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub enum IntPredicate {
12+
IntEQ,
13+
IntNE,
14+
IntUGT,
15+
IntUGE,
16+
IntULT,
17+
IntULE,
18+
IntSGT,
19+
IntSGE,
20+
IntSLT,
21+
IntSLE
22+
}

src/librustc_codegen_utils/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pub mod codegen_backend;
5454
pub mod symbol_export;
5555
pub mod symbol_names;
5656
pub mod symbol_names_test;
57+
pub mod common;
5758

5859
/// check for the #[rustc_error] annotation, which forces an
5960
/// error in codegen. This is used to write compile-fail tests

0 commit comments

Comments
 (0)