@@ -93,6 +93,34 @@ impl BackendTypes for CodegenCx<'ll, 'tcx> {
93
93
type DIScope = & ' ll llvm:: debuginfo:: DIScope ;
94
94
}
95
95
96
+ impl CodegenCx < ' ll , ' tcx > {
97
+ pub fn const_fat_ptr (
98
+ & self ,
99
+ ptr : & ' ll Value ,
100
+ meta : & ' ll Value
101
+ ) -> & ' ll Value {
102
+ assert_eq ! ( abi:: FAT_PTR_ADDR , 0 ) ;
103
+ assert_eq ! ( abi:: FAT_PTR_EXTRA , 1 ) ;
104
+ self . const_struct ( & [ ptr, meta] , false )
105
+ }
106
+
107
+ pub fn const_array ( & self , ty : & ' ll Type , elts : & [ & ' ll Value ] ) -> & ' ll Value {
108
+ unsafe {
109
+ return llvm:: LLVMConstArray ( ty, elts. as_ptr ( ) , elts. len ( ) as c_uint ) ;
110
+ }
111
+ }
112
+
113
+ pub fn const_vector ( & self , elts : & [ & ' ll Value ] ) -> & ' ll Value {
114
+ unsafe {
115
+ return llvm:: LLVMConstVector ( elts. as_ptr ( ) , elts. len ( ) as c_uint ) ;
116
+ }
117
+ }
118
+
119
+ pub fn const_bytes ( & self , bytes : & [ u8 ] ) -> & ' ll Value {
120
+ bytes_in_context ( self . llcx , bytes)
121
+ }
122
+ }
123
+
96
124
impl ConstMethods < ' tcx > for CodegenCx < ' ll , ' tcx > {
97
125
fn const_null ( & self , t : & ' ll Type ) -> & ' ll Value {
98
126
unsafe {
@@ -189,16 +217,6 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
189
217
self . const_fat_ptr ( cs, self . const_usize ( len as u64 ) )
190
218
}
191
219
192
- fn const_fat_ptr (
193
- & self ,
194
- ptr : & ' ll Value ,
195
- meta : & ' ll Value
196
- ) -> & ' ll Value {
197
- assert_eq ! ( abi:: FAT_PTR_ADDR , 0 ) ;
198
- assert_eq ! ( abi:: FAT_PTR_EXTRA , 1 ) ;
199
- self . const_struct ( & [ ptr, meta] , false )
200
- }
201
-
202
220
fn const_struct (
203
221
& self ,
204
222
elts : & [ & ' ll Value ] ,
@@ -207,22 +225,6 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
207
225
struct_in_context ( self . llcx , elts, packed)
208
226
}
209
227
210
- fn const_array ( & self , ty : & ' ll Type , elts : & [ & ' ll Value ] ) -> & ' ll Value {
211
- unsafe {
212
- return llvm:: LLVMConstArray ( ty, elts. as_ptr ( ) , elts. len ( ) as c_uint ) ;
213
- }
214
- }
215
-
216
- fn const_vector ( & self , elts : & [ & ' ll Value ] ) -> & ' ll Value {
217
- unsafe {
218
- return llvm:: LLVMConstVector ( elts. as_ptr ( ) , elts. len ( ) as c_uint ) ;
219
- }
220
- }
221
-
222
- fn const_bytes ( & self , bytes : & [ u8 ] ) -> & ' ll Value {
223
- bytes_in_context ( self . llcx , bytes)
224
- }
225
-
226
228
fn const_get_elt ( & self , v : & ' ll Value , idx : u64 ) -> & ' ll Value {
227
229
unsafe {
228
230
assert_eq ! ( idx as c_uint as u64 , idx) ;
0 commit comments