Skip to content

Commit ebec156

Browse files
committed
rustc_codegen_llvm: remove more unused functions.
1 parent f224441 commit ebec156

File tree

4 files changed

+21
-401
lines changed

4 files changed

+21
-401
lines changed

src/librustc_codegen_llvm/builder.rs

Lines changed: 2 additions & 192 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![allow(dead_code)] // FFI wrappers
12-
1311
use llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect};
14-
use llvm::{Opcode, IntPredicate, RealPredicate, False, OperandBundleDef};
12+
use llvm::{IntPredicate, RealPredicate, False, OperandBundleDef};
1513
use llvm::{self, BasicBlock};
1614
use common::*;
1715
use type_::Type;
@@ -26,7 +24,6 @@ use std::ffi::CString;
2624
use std::ops::Range;
2725
use std::ptr;
2826
use std::ptr::NonNull;
29-
use syntax_pos::Span;
3027

3128
// All Builders must have an llfn associated with them
3229
#[must_use]
@@ -128,12 +125,6 @@ impl Builder<'a, 'll, 'tcx> {
128125
}
129126
}
130127

131-
pub fn position_before(&self, insn: &'ll Value) {
132-
unsafe {
133-
llvm::LLVMPositionBuilderBefore(self.llbuilder, insn);
134-
}
135-
}
136-
137128
pub fn position_at_end(&self, llbb: &'ll BasicBlock) {
138129
unsafe {
139130
llvm::LLVMPositionBuilderAtEnd(self.llbuilder, llbb);
@@ -160,14 +151,6 @@ impl Builder<'a, 'll, 'tcx> {
160151
}
161152
}
162153

163-
pub fn aggregate_ret(&self, ret_vals: &[&'ll Value]) {
164-
unsafe {
165-
llvm::LLVMBuildAggregateRet(self.llbuilder,
166-
ret_vals.as_ptr(),
167-
ret_vals.len() as c_uint);
168-
}
169-
}
170-
171154
pub fn br(&self, dest: &'ll BasicBlock) {
172155
self.count_insn("br");
173156
unsafe {
@@ -188,13 +171,6 @@ impl Builder<'a, 'll, 'tcx> {
188171
}
189172
}
190173

191-
pub fn indirect_br(&self, addr: &'ll Value, num_dests: usize) {
192-
self.count_insn("indirectbr");
193-
unsafe {
194-
llvm::LLVMBuildIndirectBr(self.llbuilder, addr, num_dests as c_uint);
195-
}
196-
}
197-
198174
pub fn invoke(&self,
199175
llfn: &'ll Value,
200176
args: &[&'ll Value],
@@ -237,20 +213,6 @@ impl Builder<'a, 'll, 'tcx> {
237213
}
238214
}
239215

240-
pub fn nswadd(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
241-
self.count_insn("nswadd");
242-
unsafe {
243-
llvm::LLVMBuildNSWAdd(self.llbuilder, lhs, rhs, noname())
244-
}
245-
}
246-
247-
pub fn nuwadd(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
248-
self.count_insn("nuwadd");
249-
unsafe {
250-
llvm::LLVMBuildNUWAdd(self.llbuilder, lhs, rhs, noname())
251-
}
252-
}
253-
254216
pub fn fadd(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
255217
self.count_insn("fadd");
256218
unsafe {
@@ -274,20 +236,6 @@ impl Builder<'a, 'll, 'tcx> {
274236
}
275237
}
276238

277-
pub fn nswsub(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
278-
self.count_insn("nswsub");
279-
unsafe {
280-
llvm::LLVMBuildNSWSub(self.llbuilder, lhs, rhs, noname())
281-
}
282-
}
283-
284-
pub fn nuwsub(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
285-
self.count_insn("nuwsub");
286-
unsafe {
287-
llvm::LLVMBuildNUWSub(self.llbuilder, lhs, rhs, noname())
288-
}
289-
}
290-
291239
pub fn fsub(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
292240
self.count_insn("fsub");
293241
unsafe {
@@ -311,20 +259,6 @@ impl Builder<'a, 'll, 'tcx> {
311259
}
312260
}
313261

314-
pub fn nswmul(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
315-
self.count_insn("nswmul");
316-
unsafe {
317-
llvm::LLVMBuildNSWMul(self.llbuilder, lhs, rhs, noname())
318-
}
319-
}
320-
321-
pub fn nuwmul(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
322-
self.count_insn("nuwmul");
323-
unsafe {
324-
llvm::LLVMBuildNUWMul(self.llbuilder, lhs, rhs, noname())
325-
}
326-
}
327-
328262
pub fn fmul(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
329263
self.count_insn("fmul");
330264
unsafe {
@@ -458,34 +392,13 @@ impl Builder<'a, 'll, 'tcx> {
458392
}
459393
}
460394

461-
pub fn binop(&self, op: Opcode, lhs: &'ll Value, rhs: &'ll Value)
462-
-> &'ll Value {
463-
self.count_insn("binop");
464-
unsafe {
465-
llvm::LLVMBuildBinOp(self.llbuilder, op, lhs, rhs, noname())
466-
}
467-
}
468-
469395
pub fn neg(&self, v: &'ll Value) -> &'ll Value {
470396
self.count_insn("neg");
471397
unsafe {
472398
llvm::LLVMBuildNeg(self.llbuilder, v, noname())
473399
}
474400
}
475401

476-
pub fn nswneg(&self, v: &'ll Value) -> &'ll Value {
477-
self.count_insn("nswneg");
478-
unsafe {
479-
llvm::LLVMBuildNSWNeg(self.llbuilder, v, noname())
480-
}
481-
}
482-
483-
pub fn nuwneg(&self, v: &'ll Value) -> &'ll Value {
484-
self.count_insn("nuwneg");
485-
unsafe {
486-
llvm::LLVMBuildNUWNeg(self.llbuilder, v, noname())
487-
}
488-
}
489402
pub fn fneg(&self, v: &'ll Value) -> &'ll Value {
490403
self.count_insn("fneg");
491404
unsafe {
@@ -523,13 +436,6 @@ impl Builder<'a, 'll, 'tcx> {
523436
}
524437
}
525438

526-
pub fn free(&self, ptr: &'ll Value) {
527-
self.count_insn("free");
528-
unsafe {
529-
llvm::LLVMBuildFree(self.llbuilder, ptr);
530-
}
531-
}
532-
533439
pub fn load(&self, ptr: &'ll Value, align: Align) -> &'ll Value {
534440
self.count_insn("load");
535441
unsafe {
@@ -658,20 +564,6 @@ impl Builder<'a, 'll, 'tcx> {
658564
}
659565
}
660566

661-
pub fn global_string(&self, _str: *const c_char) -> &'ll Value {
662-
self.count_insn("globalstring");
663-
unsafe {
664-
llvm::LLVMBuildGlobalString(self.llbuilder, _str, noname())
665-
}
666-
}
667-
668-
pub fn global_string_ptr(&self, _str: *const c_char) -> &'ll Value {
669-
self.count_insn("globalstringptr");
670-
unsafe {
671-
llvm::LLVMBuildGlobalStringPtr(self.llbuilder, _str, noname())
672-
}
673-
}
674-
675567
/* Casts */
676568
pub fn trunc(&self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
677569
self.count_insn("trunc");
@@ -757,34 +649,6 @@ impl Builder<'a, 'll, 'tcx> {
757649
}
758650
}
759651

760-
pub fn zext_or_bitcast(&self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
761-
self.count_insn("zextorbitcast");
762-
unsafe {
763-
llvm::LLVMBuildZExtOrBitCast(self.llbuilder, val, dest_ty, noname())
764-
}
765-
}
766-
767-
pub fn sext_or_bitcast(&self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
768-
self.count_insn("sextorbitcast");
769-
unsafe {
770-
llvm::LLVMBuildSExtOrBitCast(self.llbuilder, val, dest_ty, noname())
771-
}
772-
}
773-
774-
pub fn trunc_or_bitcast(&self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
775-
self.count_insn("truncorbitcast");
776-
unsafe {
777-
llvm::LLVMBuildTruncOrBitCast(self.llbuilder, val, dest_ty, noname())
778-
}
779-
}
780-
781-
pub fn cast(&self, op: Opcode, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
782-
self.count_insn("cast");
783-
unsafe {
784-
llvm::LLVMBuildCast(self.llbuilder, op, val, dest_ty, noname())
785-
}
786-
}
787-
788652
pub fn pointercast(&self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
789653
self.count_insn("pointercast");
790654
unsafe {
@@ -799,14 +663,6 @@ impl Builder<'a, 'll, 'tcx> {
799663
}
800664
}
801665

802-
pub fn fpcast(&self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
803-
self.count_insn("fpcast");
804-
unsafe {
805-
llvm::LLVMBuildFPCast(self.llbuilder, val, dest_ty, noname())
806-
}
807-
}
808-
809-
810666
/* Comparisons */
811667
pub fn icmp(&self, op: IntPredicate, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
812668
self.count_insn("icmp");
@@ -842,32 +698,6 @@ impl Builder<'a, 'll, 'tcx> {
842698
}
843699
}
844700

845-
pub fn add_span_comment(&self, sp: Span, text: &str) {
846-
if self.cx.sess().asm_comments() {
847-
let s = format!("{} ({})",
848-
text,
849-
self.cx.sess().codemap().span_to_string(sp));
850-
debug!("{}", s);
851-
self.add_comment(&s);
852-
}
853-
}
854-
855-
pub fn add_comment(&self, text: &str) {
856-
if self.cx.sess().asm_comments() {
857-
let sanitized = text.replace("$", "");
858-
let comment_text = format!("{} {}", "#",
859-
sanitized.replace("\n", "\n\t# "));
860-
self.count_insn("inlineasm");
861-
let comment_text = CString::new(comment_text).unwrap();
862-
let asm = unsafe {
863-
llvm::LLVMConstInlineAsm(Type::func(&[], Type::void(self.cx)),
864-
comment_text.as_ptr(), noname(), False,
865-
False)
866-
};
867-
self.call(asm, &[], None);
868-
}
869-
}
870-
871701
pub fn inline_asm_call(&self, asm: *const c_char, cons: *const c_char,
872702
inputs: &[&'ll Value], output: &'ll Type,
873703
volatile: bool, alignstack: bool,
@@ -936,6 +766,7 @@ impl Builder<'a, 'll, 'tcx> {
936766
}
937767
}
938768

769+
#[allow(dead_code)]
939770
pub fn va_arg(&self, list: &'ll Value, ty: &'ll Type) -> &'ll Value {
940771
self.count_insn("vaarg");
941772
unsafe {
@@ -1102,27 +933,6 @@ impl Builder<'a, 'll, 'tcx> {
1102933
}
1103934
}
1104935

1105-
pub fn is_null(&self, val: &'ll Value) -> &'ll Value {
1106-
self.count_insn("isnull");
1107-
unsafe {
1108-
llvm::LLVMBuildIsNull(self.llbuilder, val, noname())
1109-
}
1110-
}
1111-
1112-
pub fn is_not_null(&self, val: &'ll Value) -> &'ll Value {
1113-
self.count_insn("isnotnull");
1114-
unsafe {
1115-
llvm::LLVMBuildIsNotNull(self.llbuilder, val, noname())
1116-
}
1117-
}
1118-
1119-
pub fn ptrdiff(&self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value {
1120-
self.count_insn("ptrdiff");
1121-
unsafe {
1122-
llvm::LLVMBuildPtrDiff(self.llbuilder, lhs, rhs, noname())
1123-
}
1124-
}
1125-
1126936
pub fn landing_pad(&self, ty: &'ll Type, pers_fn: &'ll Value,
1127937
num_clauses: usize) -> &'ll Value {
1128938
self.count_insn("landingpad");

0 commit comments

Comments
 (0)