Generalized BasicBlocks in BuilderMethods trait

This commit is contained in:
Denis Merigoux 2018-08-20 17:44:18 +02:00 committed by Eduard-Mihai Burtescu
parent 34c5dc045f
commit 14798d6937
4 changed files with 16 additions and 8 deletions

View File

@ -76,6 +76,7 @@ use rustc_data_structures::sync::Lrc;
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,

View File

@ -55,7 +55,8 @@ bitflags! {
}
}
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,

View File

@ -22,6 +22,7 @@ use type_::Type;
use glue;
use traits::BuilderMethods;
use llvm::BasicBlock;
use std::fmt;
@ -281,7 +282,8 @@ impl OperandValue<&'ll Value> {
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 @@ impl<'a, 'll: 'a, 'tcx: 'll, Value : ?Sized> OperandValue<&'ll Value> where
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>,

View File

@ -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::borrow::Cow;
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,