rustc_codegen_llvm: remove more unused functions.

This commit is contained in:
Irina Popa 2018-07-10 18:00:02 +03:00
parent f224441ed5
commit ebec156abf
4 changed files with 21 additions and 401 deletions

View file

@ -8,10 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(dead_code)] // FFI wrappers
use llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect};
use llvm::{Opcode, IntPredicate, RealPredicate, False, OperandBundleDef};
use llvm::{IntPredicate, RealPredicate, False, OperandBundleDef};
use llvm::{self, BasicBlock};
use common::*;
use type_::Type;
@ -26,7 +24,6 @@ use std::ffi::CString;
use std::ops::Range;
use std::ptr;
use std::ptr::NonNull;
use syntax_pos::Span;
// All Builders must have an llfn associated with them
#[must_use]
@ -128,12 +125,6 @@ impl Builder<'a, 'll, 'tcx> {
}
}
pub fn position_before(&self, insn: &'ll Value) {
unsafe {
llvm::LLVMPositionBuilderBefore(self.llbuilder, insn);
}
}
pub fn position_at_end(&self, llbb: &'ll BasicBlock) {
unsafe {
llvm::LLVMPositionBuilderAtEnd(self.llbuilder, llbb);
@ -160,14 +151,6 @@ impl Builder<'a, 'll, 'tcx> {
}
}
pub fn aggregate_ret(&self, ret_vals: &[&'ll Value]) {
unsafe {
llvm::LLVMBuildAggregateRet(self.llbuilder,
ret_vals.as_ptr(),
ret_vals.len() as c_uint);
}
}
pub fn br(&self, dest: &'ll BasicBlock) {
self.count_insn("br");
unsafe {
@ -188,13 +171,6 @@ impl Builder<'a, 'll, 'tcx> {
}
}
pub fn indirect_br(&self, addr: &'ll Value, num_dests: usize) {
self.count_insn("indirectbr");
unsafe {
llvm::LLVMBuildIndirectBr(self.llbuilder, addr, num_dests as c_uint);
}
}
pub fn invoke(&self,
llfn: &'ll Value,
args: &[&'ll Value],
@ -237,20 +213,6 @@ impl Builder<'a, 'll, 'tcx> {
}
}
pub fn nswadd(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
self.count_insn("nswadd");
unsafe {
llvm::LLVMBuildNSWAdd(self.llbuilder, lhs, rhs, noname())
}
}
pub fn nuwadd(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
self.count_insn("nuwadd");
unsafe {
llvm::LLVMBuildNUWAdd(self.llbuilder, lhs, rhs, noname())
}
}
pub fn fadd(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
self.count_insn("fadd");
unsafe {
@ -274,20 +236,6 @@ impl Builder<'a, 'll, 'tcx> {
}
}
pub fn nswsub(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
self.count_insn("nswsub");
unsafe {
llvm::LLVMBuildNSWSub(self.llbuilder, lhs, rhs, noname())
}
}
pub fn nuwsub(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
self.count_insn("nuwsub");
unsafe {
llvm::LLVMBuildNUWSub(self.llbuilder, lhs, rhs, noname())
}
}
pub fn fsub(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
self.count_insn("fsub");
unsafe {
@ -311,20 +259,6 @@ impl Builder<'a, 'll, 'tcx> {
}
}
pub fn nswmul(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
self.count_insn("nswmul");
unsafe {
llvm::LLVMBuildNSWMul(self.llbuilder, lhs, rhs, noname())
}
}
pub fn nuwmul(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
self.count_insn("nuwmul");
unsafe {
llvm::LLVMBuildNUWMul(self.llbuilder, lhs, rhs, noname())
}
}
pub fn fmul(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
self.count_insn("fmul");
unsafe {
@ -458,14 +392,6 @@ impl Builder<'a, 'll, 'tcx> {
}
}
pub fn binop(&self, op: Opcode, lhs: &'ll Value, rhs: &'ll Value)
-> &'ll Value {
self.count_insn("binop");
unsafe {
llvm::LLVMBuildBinOp(self.llbuilder, op, lhs, rhs, noname())
}
}
pub fn neg(&self, v: &'ll Value) -> &'ll Value {
self.count_insn("neg");
unsafe {
@ -473,19 +399,6 @@ impl Builder<'a, 'll, 'tcx> {
}
}
pub fn nswneg(&self, v: &'ll Value) -> &'ll Value {
self.count_insn("nswneg");
unsafe {
llvm::LLVMBuildNSWNeg(self.llbuilder, v, noname())
}
}
pub fn nuwneg(&self, v: &'ll Value) -> &'ll Value {
self.count_insn("nuwneg");
unsafe {
llvm::LLVMBuildNUWNeg(self.llbuilder, v, noname())
}
}
pub fn fneg(&self, v: &'ll Value) -> &'ll Value {
self.count_insn("fneg");
unsafe {
@ -523,13 +436,6 @@ impl Builder<'a, 'll, 'tcx> {
}
}
pub fn free(&self, ptr: &'ll Value) {
self.count_insn("free");
unsafe {
llvm::LLVMBuildFree(self.llbuilder, ptr);
}
}
pub fn load(&self, ptr: &'ll Value, align: Align) -> &'ll Value {
self.count_insn("load");
unsafe {
@ -658,20 +564,6 @@ impl Builder<'a, 'll, 'tcx> {
}
}
pub fn global_string(&self, _str: *const c_char) -> &'ll Value {
self.count_insn("globalstring");
unsafe {
llvm::LLVMBuildGlobalString(self.llbuilder, _str, noname())
}
}
pub fn global_string_ptr(&self, _str: *const c_char) -> &'ll Value {
self.count_insn("globalstringptr");
unsafe {
llvm::LLVMBuildGlobalStringPtr(self.llbuilder, _str, noname())
}
}
/* Casts */
pub fn trunc(&self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
self.count_insn("trunc");
@ -757,34 +649,6 @@ impl Builder<'a, 'll, 'tcx> {
}
}
pub fn zext_or_bitcast(&self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
self.count_insn("zextorbitcast");
unsafe {
llvm::LLVMBuildZExtOrBitCast(self.llbuilder, val, dest_ty, noname())
}
}
pub fn sext_or_bitcast(&self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
self.count_insn("sextorbitcast");
unsafe {
llvm::LLVMBuildSExtOrBitCast(self.llbuilder, val, dest_ty, noname())
}
}
pub fn trunc_or_bitcast(&self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
self.count_insn("truncorbitcast");
unsafe {
llvm::LLVMBuildTruncOrBitCast(self.llbuilder, val, dest_ty, noname())
}
}
pub fn cast(&self, op: Opcode, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
self.count_insn("cast");
unsafe {
llvm::LLVMBuildCast(self.llbuilder, op, val, dest_ty, noname())
}
}
pub fn pointercast(&self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
self.count_insn("pointercast");
unsafe {
@ -799,14 +663,6 @@ impl Builder<'a, 'll, 'tcx> {
}
}
pub fn fpcast(&self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
self.count_insn("fpcast");
unsafe {
llvm::LLVMBuildFPCast(self.llbuilder, val, dest_ty, noname())
}
}
/* Comparisons */
pub fn icmp(&self, op: IntPredicate, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
self.count_insn("icmp");
@ -842,32 +698,6 @@ impl Builder<'a, 'll, 'tcx> {
}
}
pub fn add_span_comment(&self, sp: Span, text: &str) {
if self.cx.sess().asm_comments() {
let s = format!("{} ({})",
text,
self.cx.sess().codemap().span_to_string(sp));
debug!("{}", s);
self.add_comment(&s);
}
}
pub fn add_comment(&self, text: &str) {
if self.cx.sess().asm_comments() {
let sanitized = text.replace("$", "");
let comment_text = format!("{} {}", "#",
sanitized.replace("\n", "\n\t# "));
self.count_insn("inlineasm");
let comment_text = CString::new(comment_text).unwrap();
let asm = unsafe {
llvm::LLVMConstInlineAsm(Type::func(&[], Type::void(self.cx)),
comment_text.as_ptr(), noname(), False,
False)
};
self.call(asm, &[], None);
}
}
pub fn inline_asm_call(&self, asm: *const c_char, cons: *const c_char,
inputs: &[&'ll Value], output: &'ll Type,
volatile: bool, alignstack: bool,
@ -936,6 +766,7 @@ impl Builder<'a, 'll, 'tcx> {
}
}
#[allow(dead_code)]
pub fn va_arg(&self, list: &'ll Value, ty: &'ll Type) -> &'ll Value {
self.count_insn("vaarg");
unsafe {
@ -1102,27 +933,6 @@ impl Builder<'a, 'll, 'tcx> {
}
}
pub fn is_null(&self, val: &'ll Value) -> &'ll Value {
self.count_insn("isnull");
unsafe {
llvm::LLVMBuildIsNull(self.llbuilder, val, noname())
}
}
pub fn is_not_null(&self, val: &'ll Value) -> &'ll Value {
self.count_insn("isnotnull");
unsafe {
llvm::LLVMBuildIsNotNull(self.llbuilder, val, noname())
}
}
pub fn ptrdiff(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
self.count_insn("ptrdiff");
unsafe {
llvm::LLVMBuildPtrDiff(self.llbuilder, lhs, rhs, noname())
}
}
pub fn landing_pad(&self, ty: &'ll Type, pers_fn: &'ll Value,
num_clauses: usize) -> &'ll Value {
self.count_insn("landingpad");