// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect};
-use llvm::{IntPredicate, RealPredicate, OperandBundleDef};
-use llvm;
+use llvm::AsmDialect;
use common::*;
use type_::Type;
use libc::c_char;
use rustc::ty::layout::{Align, Size};
use rustc::session::Session;
use builder::MemFlags;
+use value::Value;
use std::borrow::Cow;
use std::ops::Range;
+pub struct OperandBundleDef<'a, Value : 'a> {
+ pub name: &'a str,
+ pub val: Value
+}
+
+impl OperandBundleDef<'ll, &'ll Value> {
+ pub fn new(name: &'ll str, val: &'ll Value) -> Self {
+ OperandBundleDef {
+ name,
+ val
+ }
+ }
+}
+
+pub enum IntPredicate {
+ IntEQ,
+ IntNE,
+ IntUGT,
+ IntUGE,
+ IntULT,
+ IntULE,
+ IntSGT,
+ IntSGE,
+ IntSLT,
+ IntSLE
+}
+
+#[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,
+}
+
pub trait BuilderMethods<'a, 'll :'a, 'tcx: 'll,
Value : ?Sized,
args: &[&'ll Value],
then: &'ll BasicBlock,
catch: &'ll BasicBlock,
- bundle: Option<&OperandBundleDef<'ll>>
+ bundle: Option<&OperandBundleDef<'ll, &'ll Value>>
) -> &'ll Value;
fn unreachable(&self);
fn add(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value;
src: &'ll Value,
order: AtomicOrdering,
failure_order: AtomicOrdering,
- weak: llvm::Bool,
+ weak: bool,
) -> &'ll Value;
fn atomic_rmw(
&self,
fn call_lifetime_intrinsic(&self, intrinsic: &str, ptr: &'ll Value, size: Size);
fn call(&self, llfn: &'ll Value, args: &[&'ll Value],
- bundle: Option<&OperandBundleDef<'ll>>) -> &'ll Value;
+ bundle: Option<&OperandBundleDef<'ll, &'ll Value>>) -> &'ll Value;
fn zext(&self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value;
}