@@ -137,10 +137,10 @@ pub async fn renderToLlvm(comp: *Compilation, fn_val: *Value.Fn, code: *ir.Code)
137
137
138
138
pub const ObjectFile = struct {
139
139
comp : * Compilation ,
140
- module : llvm.ModuleRef ,
141
- builder : llvm.BuilderRef ,
140
+ module : * llvm.Module ,
141
+ builder : * llvm.Builder ,
142
142
dibuilder : * llvm.DIBuilder ,
143
- context : llvm.ContextRef ,
143
+ context : * llvm.Context ,
144
144
lock : event.Lock ,
145
145
arena : * std.mem.Allocator ,
146
146
@@ -323,7 +323,7 @@ pub fn renderToLlvmModule(ofile: *ObjectFile, fn_val: *Value.Fn, code: *ir.Code)
323
323
324
324
fn addLLVMAttr (
325
325
ofile : * ObjectFile ,
326
- val : llvm.ValueRef ,
326
+ val : * llvm.Value ,
327
327
attr_index : llvm.AttributeIndex ,
328
328
attr_name : []const u8 ,
329
329
) ! void {
@@ -335,7 +335,7 @@ fn addLLVMAttr(
335
335
336
336
fn addLLVMAttrStr (
337
337
ofile : * ObjectFile ,
338
- val : llvm.ValueRef ,
338
+ val : * llvm.Value ,
339
339
attr_index : llvm.AttributeIndex ,
340
340
attr_name : []const u8 ,
341
341
attr_val : []const u8 ,
@@ -351,7 +351,7 @@ fn addLLVMAttrStr(
351
351
}
352
352
353
353
fn addLLVMAttrInt (
354
- val : llvm.ValueRef ,
354
+ val : * llvm.Value ,
355
355
attr_index : llvm.AttributeIndex ,
356
356
attr_name : []const u8 ,
357
357
attr_val : u64 ,
@@ -362,25 +362,25 @@ fn addLLVMAttrInt(
362
362
llvm .AddAttributeAtIndex (val , attr_index , llvm_attr );
363
363
}
364
364
365
- fn addLLVMFnAttr (ofile : * ObjectFile , fn_val : llvm.ValueRef , attr_name : []const u8 ) ! void {
365
+ fn addLLVMFnAttr (ofile : * ObjectFile , fn_val : * llvm.Value , attr_name : []const u8 ) ! void {
366
366
return addLLVMAttr (ofile , fn_val , maxInt (llvm .AttributeIndex ), attr_name );
367
367
}
368
368
369
- fn addLLVMFnAttrStr (ofile : * ObjectFile , fn_val : llvm.ValueRef , attr_name : []const u8 , attr_val : []const u8 ) ! void {
369
+ fn addLLVMFnAttrStr (ofile : * ObjectFile , fn_val : * llvm.Value , attr_name : []const u8 , attr_val : []const u8 ) ! void {
370
370
return addLLVMAttrStr (ofile , fn_val , maxInt (llvm .AttributeIndex ), attr_name , attr_val );
371
371
}
372
372
373
- fn addLLVMFnAttrInt (ofile : * ObjectFile , fn_val : llvm.ValueRef , attr_name : []const u8 , attr_val : u64 ) ! void {
373
+ fn addLLVMFnAttrInt (ofile : * ObjectFile , fn_val : * llvm.Value , attr_name : []const u8 , attr_val : u64 ) ! void {
374
374
return addLLVMAttrInt (ofile , fn_val , maxInt (llvm .AttributeIndex ), attr_name , attr_val );
375
375
}
376
376
377
377
fn renderLoadUntyped (
378
378
ofile : * ObjectFile ,
379
- ptr : llvm.ValueRef ,
379
+ ptr : * llvm.Value ,
380
380
alignment : Type.Pointer.Align ,
381
381
vol : Type.Pointer.Vol ,
382
382
name : [* ]const u8 ,
383
- ) ! llvm.ValueRef {
383
+ ) ! * llvm.Value {
384
384
const result = llvm .BuildLoad (ofile .builder , ptr , name ) orelse return error .OutOfMemory ;
385
385
switch (vol ) {
386
386
Type .Pointer .Vol .Non = > {},
@@ -390,11 +390,11 @@ fn renderLoadUntyped(
390
390
return result ;
391
391
}
392
392
393
- fn renderLoad (ofile : * ObjectFile , ptr : llvm.ValueRef , ptr_type : * Type.Pointer , name : [* ]const u8 ) ! llvm.ValueRef {
393
+ fn renderLoad (ofile : * ObjectFile , ptr : * llvm.Value , ptr_type : * Type.Pointer , name : [* ]const u8 ) ! * llvm.Value {
394
394
return renderLoadUntyped (ofile , ptr , ptr_type .key .alignment , ptr_type .key .vol , name );
395
395
}
396
396
397
- pub fn getHandleValue (ofile : * ObjectFile , ptr : llvm.ValueRef , ptr_type : * Type.Pointer ) ! ? llvm.ValueRef {
397
+ pub fn getHandleValue (ofile : * ObjectFile , ptr : * llvm.Value , ptr_type : * Type.Pointer ) ! ? * llvm.Value {
398
398
const child_type = ptr_type .key .child_type ;
399
399
if (! child_type .hasBits ()) {
400
400
return null ;
@@ -407,11 +407,11 @@ pub fn getHandleValue(ofile: *ObjectFile, ptr: llvm.ValueRef, ptr_type: *Type.Po
407
407
408
408
pub fn renderStoreUntyped (
409
409
ofile : * ObjectFile ,
410
- value : llvm.ValueRef ,
411
- ptr : llvm.ValueRef ,
410
+ value : * llvm.Value ,
411
+ ptr : * llvm.Value ,
412
412
alignment : Type.Pointer.Align ,
413
413
vol : Type.Pointer.Vol ,
414
- ) ! llvm.ValueRef {
414
+ ) ! * llvm.Value {
415
415
const result = llvm .BuildStore (ofile .builder , value , ptr ) orelse return error .OutOfMemory ;
416
416
switch (vol ) {
417
417
Type .Pointer .Vol .Non = > {},
@@ -423,10 +423,10 @@ pub fn renderStoreUntyped(
423
423
424
424
pub fn renderStore (
425
425
ofile : * ObjectFile ,
426
- value : llvm.ValueRef ,
427
- ptr : llvm.ValueRef ,
426
+ value : * llvm.Value ,
427
+ ptr : * llvm.Value ,
428
428
ptr_type : * Type.Pointer ,
429
- ) ! llvm.ValueRef {
429
+ ) ! * llvm.Value {
430
430
return renderStoreUntyped (ofile , value , ptr , ptr_type .key .alignment , ptr_type .key .vol );
431
431
}
432
432
@@ -435,15 +435,15 @@ pub fn renderAlloca(
435
435
var_type : * Type ,
436
436
name : []const u8 ,
437
437
alignment : Type.Pointer.Align ,
438
- ) ! llvm.ValueRef {
438
+ ) ! * llvm.Value {
439
439
const llvm_var_type = try var_type .getLlvmType (ofile .arena , ofile .context );
440
440
const name_with_null = try std .cstr .addNullByte (ofile .arena , name );
441
441
const result = llvm .BuildAlloca (ofile .builder , llvm_var_type , name_with_null .ptr ) orelse return error .OutOfMemory ;
442
442
llvm .SetAlignment (result , resolveAlign (ofile , alignment , llvm_var_type ));
443
443
return result ;
444
444
}
445
445
446
- pub fn resolveAlign (ofile : * ObjectFile , alignment : Type.Pointer.Align , llvm_type : llvm.TypeRef ) u32 {
446
+ pub fn resolveAlign (ofile : * ObjectFile , alignment : Type.Pointer.Align , llvm_type : * llvm.Type ) u32 {
447
447
return switch (alignment ) {
448
448
Type .Pointer .Align .Abi = > return llvm .ABIAlignmentOfType (ofile .comp .target_data_ref , llvm_type ),
449
449
Type .Pointer .Align .Override = > | a | a ,
0 commit comments