8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- #![ allow( dead_code) ] // FFI wrappers
12
-
13
11
use llvm:: { AtomicRmwBinOp , AtomicOrdering , SynchronizationScope , AsmDialect } ;
14
- use llvm:: { Opcode , IntPredicate , RealPredicate , False , OperandBundleDef } ;
12
+ use llvm:: { IntPredicate , RealPredicate , False , OperandBundleDef } ;
15
13
use llvm:: { self , BasicBlock } ;
16
14
use common:: * ;
17
15
use type_:: Type ;
@@ -26,7 +24,6 @@ use std::ffi::CString;
26
24
use std:: ops:: Range ;
27
25
use std:: ptr;
28
26
use std:: ptr:: NonNull ;
29
- use syntax_pos:: Span ;
30
27
31
28
// All Builders must have an llfn associated with them
32
29
#[ must_use]
@@ -128,12 +125,6 @@ impl Builder<'a, 'll, 'tcx> {
128
125
}
129
126
}
130
127
131
- pub fn position_before ( & self , insn : & ' ll Value ) {
132
- unsafe {
133
- llvm:: LLVMPositionBuilderBefore ( self . llbuilder , insn) ;
134
- }
135
- }
136
-
137
128
pub fn position_at_end ( & self , llbb : & ' ll BasicBlock ) {
138
129
unsafe {
139
130
llvm:: LLVMPositionBuilderAtEnd ( self . llbuilder , llbb) ;
@@ -160,14 +151,6 @@ impl Builder<'a, 'll, 'tcx> {
160
151
}
161
152
}
162
153
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
-
171
154
pub fn br ( & self , dest : & ' ll BasicBlock ) {
172
155
self . count_insn ( "br" ) ;
173
156
unsafe {
@@ -188,13 +171,6 @@ impl Builder<'a, 'll, 'tcx> {
188
171
}
189
172
}
190
173
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
-
198
174
pub fn invoke ( & self ,
199
175
llfn : & ' ll Value ,
200
176
args : & [ & ' ll Value ] ,
@@ -237,20 +213,6 @@ impl Builder<'a, 'll, 'tcx> {
237
213
}
238
214
}
239
215
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
-
254
216
pub fn fadd ( & self , lhs : & ' ll Value , rhs : & ' ll Value ) -> & ' ll Value {
255
217
self . count_insn ( "fadd" ) ;
256
218
unsafe {
@@ -274,20 +236,6 @@ impl Builder<'a, 'll, 'tcx> {
274
236
}
275
237
}
276
238
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
-
291
239
pub fn fsub ( & self , lhs : & ' ll Value , rhs : & ' ll Value ) -> & ' ll Value {
292
240
self . count_insn ( "fsub" ) ;
293
241
unsafe {
@@ -311,20 +259,6 @@ impl Builder<'a, 'll, 'tcx> {
311
259
}
312
260
}
313
261
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
-
328
262
pub fn fmul ( & self , lhs : & ' ll Value , rhs : & ' ll Value ) -> & ' ll Value {
329
263
self . count_insn ( "fmul" ) ;
330
264
unsafe {
@@ -458,34 +392,13 @@ impl Builder<'a, 'll, 'tcx> {
458
392
}
459
393
}
460
394
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
-
469
395
pub fn neg ( & self , v : & ' ll Value ) -> & ' ll Value {
470
396
self . count_insn ( "neg" ) ;
471
397
unsafe {
472
398
llvm:: LLVMBuildNeg ( self . llbuilder , v, noname ( ) )
473
399
}
474
400
}
475
401
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
- }
489
402
pub fn fneg ( & self , v : & ' ll Value ) -> & ' ll Value {
490
403
self . count_insn ( "fneg" ) ;
491
404
unsafe {
@@ -523,13 +436,6 @@ impl Builder<'a, 'll, 'tcx> {
523
436
}
524
437
}
525
438
526
- pub fn free ( & self , ptr : & ' ll Value ) {
527
- self . count_insn ( "free" ) ;
528
- unsafe {
529
- llvm:: LLVMBuildFree ( self . llbuilder , ptr) ;
530
- }
531
- }
532
-
533
439
pub fn load ( & self , ptr : & ' ll Value , align : Align ) -> & ' ll Value {
534
440
self . count_insn ( "load" ) ;
535
441
unsafe {
@@ -658,20 +564,6 @@ impl Builder<'a, 'll, 'tcx> {
658
564
}
659
565
}
660
566
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
-
675
567
/* Casts */
676
568
pub fn trunc ( & self , val : & ' ll Value , dest_ty : & ' ll Type ) -> & ' ll Value {
677
569
self . count_insn ( "trunc" ) ;
@@ -757,34 +649,6 @@ impl Builder<'a, 'll, 'tcx> {
757
649
}
758
650
}
759
651
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
-
788
652
pub fn pointercast ( & self , val : & ' ll Value , dest_ty : & ' ll Type ) -> & ' ll Value {
789
653
self . count_insn ( "pointercast" ) ;
790
654
unsafe {
@@ -799,14 +663,6 @@ impl Builder<'a, 'll, 'tcx> {
799
663
}
800
664
}
801
665
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
-
810
666
/* Comparisons */
811
667
pub fn icmp ( & self , op : IntPredicate , lhs : & ' ll Value , rhs : & ' ll Value ) -> & ' ll Value {
812
668
self . count_insn ( "icmp" ) ;
@@ -842,32 +698,6 @@ impl Builder<'a, 'll, 'tcx> {
842
698
}
843
699
}
844
700
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
-
871
701
pub fn inline_asm_call ( & self , asm : * const c_char , cons : * const c_char ,
872
702
inputs : & [ & ' ll Value ] , output : & ' ll Type ,
873
703
volatile : bool , alignstack : bool ,
@@ -936,6 +766,7 @@ impl Builder<'a, 'll, 'tcx> {
936
766
}
937
767
}
938
768
769
+ #[ allow( dead_code) ]
939
770
pub fn va_arg ( & self , list : & ' ll Value , ty : & ' ll Type ) -> & ' ll Value {
940
771
self . count_insn ( "vaarg" ) ;
941
772
unsafe {
@@ -1102,27 +933,6 @@ impl Builder<'a, 'll, 'tcx> {
1102
933
}
1103
934
}
1104
935
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
-
1126
936
pub fn landing_pad ( & self , ty : & ' ll Type , pers_fn : & ' ll Value ,
1127
937
num_clauses : usize ) -> & ' ll Value {
1128
938
self . count_insn ( "landingpad" ) ;
0 commit comments