2018-09-28 09:40:59 +00:00
|
|
|
// 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.
|
2018-09-28 10:18:03 +00:00
|
|
|
#![allow(non_camel_case_types, non_snake_case)]
|
|
|
|
|
2018-11-13 10:53:29 +00:00
|
|
|
use rustc::ty::{self, Ty, TyCtxt};
|
|
|
|
use syntax_pos::DUMMY_SP;
|
|
|
|
|
|
|
|
|
|
|
|
pub fn type_needs_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
|
|
|
|
ty.needs_drop(tcx, ty::ParamEnv::reveal_all())
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn type_is_sized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
|
|
|
|
ty.is_sized(tcx.at(DUMMY_SP), ty::ParamEnv::reveal_all())
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn type_is_freeze<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
|
|
|
|
ty.is_freeze(tcx, ty::ParamEnv::reveal_all(), DUMMY_SP)
|
|
|
|
}
|
|
|
|
|
2018-09-28 09:40:59 +00:00
|
|
|
pub enum IntPredicate {
|
|
|
|
IntEQ,
|
|
|
|
IntNE,
|
|
|
|
IntUGT,
|
|
|
|
IntUGE,
|
|
|
|
IntULT,
|
|
|
|
IntULE,
|
|
|
|
IntSGT,
|
|
|
|
IntSGE,
|
|
|
|
IntSLT,
|
|
|
|
IntSLE
|
|
|
|
}
|
2018-09-28 10:18:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
pub enum RealPredicate {
|
|
|
|
RealPredicateFalse,
|
|
|
|
RealOEQ,
|
|
|
|
RealOGT,
|
|
|
|
RealOGE,
|
|
|
|
RealOLT,
|
|
|
|
RealOLE,
|
|
|
|
RealONE,
|
|
|
|
RealORD,
|
|
|
|
RealUNO,
|
|
|
|
RealUEQ,
|
|
|
|
RealUGT,
|
|
|
|
RealUGE,
|
|
|
|
RealULT,
|
|
|
|
RealULE,
|
|
|
|
RealUNE,
|
|
|
|
RealPredicateTrue
|
|
|
|
}
|
|
|
|
|
|
|
|
pub enum AtomicRmwBinOp {
|
|
|
|
AtomicXchg,
|
|
|
|
AtomicAdd,
|
|
|
|
AtomicSub,
|
|
|
|
AtomicAnd,
|
|
|
|
AtomicNand,
|
|
|
|
AtomicOr,
|
|
|
|
AtomicXor,
|
|
|
|
AtomicMax,
|
|
|
|
AtomicMin,
|
|
|
|
AtomicUMax,
|
|
|
|
AtomicUMin
|
|
|
|
}
|
|
|
|
|
|
|
|
pub enum AtomicOrdering {
|
|
|
|
#[allow(dead_code)]
|
|
|
|
NotAtomic,
|
|
|
|
Unordered,
|
|
|
|
Monotonic,
|
|
|
|
// Consume, // Not specified yet.
|
|
|
|
Acquire,
|
|
|
|
Release,
|
|
|
|
AcquireRelease,
|
|
|
|
SequentiallyConsistent,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub enum SynchronizationScope {
|
|
|
|
// FIXME: figure out if this variant is needed at all.
|
|
|
|
#[allow(dead_code)]
|
|
|
|
Other,
|
|
|
|
SingleThread,
|
|
|
|
CrossThread,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, PartialEq, Debug)]
|
|
|
|
pub enum TypeKind {
|
|
|
|
Void,
|
|
|
|
Half,
|
|
|
|
Float,
|
|
|
|
Double,
|
|
|
|
X86_FP80,
|
|
|
|
FP128,
|
|
|
|
PPC_FP128,
|
|
|
|
Label,
|
|
|
|
Integer,
|
|
|
|
Function,
|
|
|
|
Struct,
|
|
|
|
Array,
|
|
|
|
Pointer,
|
|
|
|
Vector,
|
|
|
|
Metadata,
|
|
|
|
X86_MMX,
|
|
|
|
Token,
|
|
|
|
}
|