提交 14798d69 编写于 作者: D Denis Merigoux 提交者: Eduard-Mihai Burtescu

Generalized BasicBlocks in BuilderMethods trait

上级 34c5dc04
......@@ -76,6 +76,7 @@
use rustc_data_structures::indexed_vec::Idx;
use traits::BuilderMethods;
use llvm::BasicBlock;
use std::any::Any;
use std::cmp;
......@@ -391,7 +392,7 @@ pub fn call_assume(bx: &Builder<'_, 'll, '_>, val: &'ll Value) {
pub fn from_immediate<'a, 'll: 'a, 'tcx: 'll,
Value : ?Sized,
Builder: BuilderMethods<'a, 'll, 'tcx, Value>>(
Builder: BuilderMethods<'a, 'll, 'tcx, Value, BasicBlock>>(
bx: &Builder,
val: &'ll Value
) -> &'ll Value where Value : ValueTrait {
......@@ -426,7 +427,7 @@ pub fn to_immediate_scalar(
pub fn call_memcpy<'a, 'll: 'a, 'tcx: 'll,
Value : ?Sized,
Builder: BuilderMethods<'a, 'll, 'tcx, Value>>(
Builder: BuilderMethods<'a, 'll, 'tcx, Value, BasicBlock>>(
bx: &Builder,
dst: &'ll Value,
dst_align: Align,
......@@ -452,7 +453,7 @@ pub fn call_memcpy<'a, 'll: 'a, 'tcx: 'll,
pub fn memcpy_ty<'a, 'll: 'a, 'tcx: 'll,
Value : ?Sized,
Builder: BuilderMethods<'a, 'll, 'tcx, Value>>(
Builder: BuilderMethods<'a, 'll, 'tcx, Value, BasicBlock>>(
bx: &Builder,
dst: &'ll Value,
dst_align: Align,
......
......@@ -55,7 +55,8 @@ pub struct MemFlags: u8 {
}
}
impl BuilderMethods<'a, 'll, 'tcx, Value> for Builder<'a, 'll, 'tcx> {
impl BuilderMethods<'a, 'll, 'tcx, Value, BasicBlock>
for Builder<'a, 'll, 'tcx> {
fn new_block<'b>(
cx: &'a CodegenCx<'ll, 'tcx>,
llfn: &'ll Value,
......
......@@ -22,6 +22,7 @@
use glue;
use traits::BuilderMethods;
use llvm::BasicBlock;
use std::fmt;
......@@ -281,7 +282,8 @@ pub fn unaligned_volatile_store(
impl<'a, 'll: 'a, 'tcx: 'll, Value : ?Sized> OperandValue<&'ll Value> where
Value : ValueTrait,
Builder<'a, 'll, 'tcx, &'ll Value>: BuilderMethods<'a, 'll, 'tcx, Value>
Builder<'a, 'll, 'tcx, &'ll Value>:
BuilderMethods<'a, 'll, 'tcx, Value, BasicBlock>
{
pub fn nontemporal_store(
self,
......@@ -291,7 +293,7 @@ pub fn nontemporal_store(
self.store_with_flags(bx, dest, MemFlags::NONTEMPORAL);
}
fn store_with_flags<Builder: BuilderMethods<'a, 'll, 'tcx, Value>>(
fn store_with_flags<Builder: BuilderMethods<'a, 'll, 'tcx, Value, BasicBlock>>(
self,
bx: &Builder,
dest: PlaceRef<'tcx, &'ll Value>,
......
......@@ -10,7 +10,7 @@
use llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect};
use llvm::{IntPredicate, RealPredicate, OperandBundleDef};
use llvm::{self, BasicBlock};
use llvm;
use common::*;
use type_::Type;
use libc::c_char;
......@@ -23,7 +23,11 @@
use std::ops::Range;
pub trait BuilderMethods<'a, 'll :'a, 'tcx: 'll, Value : ?Sized> {
pub trait BuilderMethods<'a, 'll :'a, 'tcx: 'll,
Value : ?Sized,
BasicBlock: ?Sized
> {
fn new_block<'b>(
cx: &'a CodegenCx<'ll, 'tcx, &'ll Value>,
llfn: &'ll Value,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册