Starting to move backend-agnostic code into codegen_utils

IntPredicate moved
This commit is contained in:
Denis Merigoux 2018-09-28 11:40:59 +02:00 committed by Eduard-Mihai Burtescu
parent 4ba09ab8d2
commit 39fd4d9274
11 changed files with 45 additions and 29 deletions
src
librustc_codegen_llvm
librustc_codegen_utils

@ -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;

@ -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;

@ -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,

@ -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};

@ -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;

@ -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,
}
}
}

@ -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;

@ -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;

@ -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;

@ -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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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
}

@ -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