Starting to move backend-agnostic code into codegen_utils
IntPredicate moved
This commit is contained in:
parent
4ba09ab8d2
commit
39fd4d9274
11 changed files with 45 additions and 29 deletions
|
@ -53,7 +53,8 @@ use mir::place::PlaceRef;
|
||||||
use builder::{Builder, MemFlags};
|
use builder::{Builder, MemFlags};
|
||||||
use callee;
|
use callee;
|
||||||
use rustc_mir::monomorphize::item::DefPathBasedNames;
|
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 meth;
|
||||||
use mir;
|
use mir;
|
||||||
use context::CodegenCx;
|
use context::CodegenCx;
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
use llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect};
|
use llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect};
|
||||||
use llvm::{self, False, OperandBundleDef, BasicBlock};
|
use llvm::{self, False, OperandBundleDef, BasicBlock};
|
||||||
use common::{self, *};
|
use common::{self, *};
|
||||||
|
use rustc_codegen_utils::common::IntPredicate;
|
||||||
use context::CodegenCx;
|
use context::CodegenCx;
|
||||||
use type_::Type;
|
use type_::Type;
|
||||||
use type_of::LayoutLlvmExt;
|
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)]
|
#[allow(dead_code)]
|
||||||
pub enum RealPredicate {
|
pub enum RealPredicate {
|
||||||
RealPredicateFalse,
|
RealPredicateFalse,
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
use std;
|
use std;
|
||||||
|
|
||||||
use common::*;
|
use rustc_codegen_utils::common::IntPredicate;
|
||||||
use meth;
|
use meth;
|
||||||
use rustc::ty::layout::LayoutOf;
|
use rustc::ty::layout::LayoutOf;
|
||||||
use rustc::ty::{self, Ty};
|
use rustc::ty::{self, Ty};
|
||||||
|
|
|
@ -20,6 +20,7 @@ use libc::c_char;
|
||||||
use mir::operand::OperandRef;
|
use mir::operand::OperandRef;
|
||||||
use mir::place::PlaceRef;
|
use mir::place::PlaceRef;
|
||||||
use rustc::ty::layout::{Align, Size};
|
use rustc::ty::layout::{Align, Size};
|
||||||
|
use rustc_codegen_utils::common::IntPredicate;
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
|
|
|
@ -20,6 +20,7 @@ use libc::{c_ulonglong, c_void};
|
||||||
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use common;
|
use common;
|
||||||
|
use rustc_codegen_utils;
|
||||||
use syntax;
|
use syntax;
|
||||||
|
|
||||||
use super::RustString;
|
use super::RustString;
|
||||||
|
@ -144,18 +145,18 @@ pub enum IntPredicate {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IntPredicate {
|
impl IntPredicate {
|
||||||
pub fn from_generic(intpre: common::IntPredicate) -> Self {
|
pub fn from_generic(intpre: rustc_codegen_utils::common::IntPredicate) -> Self {
|
||||||
match intpre {
|
match intpre {
|
||||||
common::IntPredicate::IntEQ => IntPredicate::IntEQ,
|
rustc_codegen_utils::common::IntPredicate::IntEQ => IntPredicate::IntEQ,
|
||||||
common::IntPredicate::IntNE => IntPredicate::IntNE,
|
rustc_codegen_utils::common::IntPredicate::IntNE => IntPredicate::IntNE,
|
||||||
common::IntPredicate::IntUGT => IntPredicate::IntUGT,
|
rustc_codegen_utils::common::IntPredicate::IntUGT => IntPredicate::IntUGT,
|
||||||
common::IntPredicate::IntUGE => IntPredicate::IntUGE,
|
rustc_codegen_utils::common::IntPredicate::IntUGE => IntPredicate::IntUGE,
|
||||||
common::IntPredicate::IntULT => IntPredicate::IntULT,
|
rustc_codegen_utils::common::IntPredicate::IntULT => IntPredicate::IntULT,
|
||||||
common::IntPredicate::IntULE => IntPredicate::IntULE,
|
rustc_codegen_utils::common::IntPredicate::IntULE => IntPredicate::IntULE,
|
||||||
common::IntPredicate::IntSGT => IntPredicate::IntSGT,
|
rustc_codegen_utils::common::IntPredicate::IntSGT => IntPredicate::IntSGT,
|
||||||
common::IntPredicate::IntSGE => IntPredicate::IntSGE,
|
rustc_codegen_utils::common::IntPredicate::IntSGE => IntPredicate::IntSGE,
|
||||||
common::IntPredicate::IntSLT => IntPredicate::IntSLT,
|
rustc_codegen_utils::common::IntPredicate::IntSLT => IntPredicate::IntSLT,
|
||||||
common::IntPredicate::IntSLE => IntPredicate::IntSLE,
|
rustc_codegen_utils::common::IntPredicate::IntSLE => IntPredicate::IntSLE,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,8 @@ use abi::{Abi, FnType, PassMode};
|
||||||
use rustc_target::abi::call::ArgType;
|
use rustc_target::abi::call::ArgType;
|
||||||
use base;
|
use base;
|
||||||
use builder::MemFlags;
|
use builder::MemFlags;
|
||||||
use common::{self, Funclet, IntPredicate};
|
use common::{self, Funclet};
|
||||||
|
use rustc_codegen_utils::common::IntPredicate;
|
||||||
use meth;
|
use meth;
|
||||||
use monomorphize;
|
use monomorphize;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ use rustc::ty::layout::{self, Align, TyLayout, LayoutOf, VariantIdx, HasTyCtxt};
|
||||||
use rustc::mir;
|
use rustc::mir;
|
||||||
use rustc::mir::tcx::PlaceTy;
|
use rustc::mir::tcx::PlaceTy;
|
||||||
use builder::MemFlags;
|
use builder::MemFlags;
|
||||||
use common::IntPredicate;
|
use rustc_codegen_utils::common::IntPredicate;
|
||||||
use type_of::LayoutLlvmExt;
|
use type_of::LayoutLlvmExt;
|
||||||
use glue;
|
use glue;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,8 @@ use std::{u128, i128};
|
||||||
use base;
|
use base;
|
||||||
use builder::MemFlags;
|
use builder::MemFlags;
|
||||||
use callee;
|
use callee;
|
||||||
use common::{self, IntPredicate, RealPredicate};
|
use common::{self, RealPredicate};
|
||||||
|
use rustc_codegen_utils::common::IntPredicate;
|
||||||
use monomorphize;
|
use monomorphize;
|
||||||
use type_of::LayoutLlvmExt;
|
use type_of::LayoutLlvmExt;
|
||||||
|
|
||||||
|
|
22
src/librustc_codegen_utils/common.rs
Normal file
22
src/librustc_codegen_utils/common.rs
Normal file
|
@ -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_export;
|
||||||
pub mod symbol_names;
|
pub mod symbol_names;
|
||||||
pub mod symbol_names_test;
|
pub mod symbol_names_test;
|
||||||
|
pub mod common;
|
||||||
|
|
||||||
/// check for the #[rustc_error] annotation, which forces an
|
/// check for the #[rustc_error] annotation, which forces an
|
||||||
/// error in codegen. This is used to write compile-fail tests
|
/// error in codegen. This is used to write compile-fail tests
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue