mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
llvm: finish converting lowerValue
This commit is contained in:
parent
2cb52235b9
commit
ff8a49448c
@ -835,10 +835,6 @@ pub const Decl = struct {
|
||||
assert(decl.has_tv);
|
||||
return @as(u32, @intCast(decl.alignment.toByteUnitsOptional() orelse decl.ty.abiAlignment(mod)));
|
||||
}
|
||||
|
||||
pub fn intern(decl: *Decl, mod: *Module) Allocator.Error!void {
|
||||
decl.val = (try decl.val.intern(decl.ty, mod)).toValue();
|
||||
}
|
||||
};
|
||||
|
||||
/// This state is attached to every Decl when Module emit_h is non-null.
|
||||
@ -4204,7 +4200,7 @@ pub fn semaFile(mod: *Module, file: *File) SemaError!void {
|
||||
try wip_captures.finalize();
|
||||
for (comptime_mutable_decls.items) |decl_index| {
|
||||
const decl = mod.declPtr(decl_index);
|
||||
try decl.intern(mod);
|
||||
_ = try decl.internValue(mod);
|
||||
}
|
||||
new_decl.analysis = .complete;
|
||||
} else |err| switch (err) {
|
||||
@ -4315,7 +4311,7 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool {
|
||||
try wip_captures.finalize();
|
||||
for (comptime_mutable_decls.items) |ct_decl_index| {
|
||||
const ct_decl = mod.declPtr(ct_decl_index);
|
||||
try ct_decl.intern(mod);
|
||||
_ = try ct_decl.internValue(mod);
|
||||
}
|
||||
const align_src: LazySrcLoc = .{ .node_offset_var_decl_align = 0 };
|
||||
const section_src: LazySrcLoc = .{ .node_offset_var_decl_section = 0 };
|
||||
@ -5362,7 +5358,7 @@ pub fn analyzeFnBody(mod: *Module, func_index: InternPool.Index, arena: Allocato
|
||||
try wip_captures.finalize();
|
||||
for (comptime_mutable_decls.items) |ct_decl_index| {
|
||||
const ct_decl = mod.declPtr(ct_decl_index);
|
||||
try ct_decl.intern(mod);
|
||||
_ = try ct_decl.internValue(mod);
|
||||
}
|
||||
|
||||
// Copy the block into place and mark that as the main block.
|
||||
@ -6369,7 +6365,7 @@ pub fn markDeclAlive(mod: *Module, decl: *Decl) Allocator.Error!void {
|
||||
if (decl.alive) return;
|
||||
decl.alive = true;
|
||||
|
||||
try decl.intern(mod);
|
||||
_ = try decl.internValue(mod);
|
||||
|
||||
// This is the first time we are marking this Decl alive. We must
|
||||
// therefore recurse into its value and mark any Decl it references
|
||||
|
||||
@ -3899,7 +3899,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com
|
||||
try mod.declareDeclDependency(sema.owner_decl_index, decl_index);
|
||||
|
||||
const decl = mod.declPtr(decl_index);
|
||||
if (iac.is_const) try decl.intern(mod);
|
||||
if (iac.is_const) _ = try decl.internValue(mod);
|
||||
const final_elem_ty = decl.ty;
|
||||
const final_ptr_ty = try mod.ptrType(.{
|
||||
.child = final_elem_ty.toIntern(),
|
||||
@ -33577,7 +33577,7 @@ fn semaBackingIntType(mod: *Module, struct_obj: *Module.Struct) CompileError!voi
|
||||
try wip_captures.finalize();
|
||||
for (comptime_mutable_decls.items) |ct_decl_index| {
|
||||
const ct_decl = mod.declPtr(ct_decl_index);
|
||||
try ct_decl.intern(mod);
|
||||
_ = try ct_decl.internValue(mod);
|
||||
}
|
||||
} else {
|
||||
if (fields_bit_sum > std.math.maxInt(u16)) {
|
||||
@ -34645,7 +34645,7 @@ fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void
|
||||
try wip_captures.finalize();
|
||||
for (comptime_mutable_decls.items) |ct_decl_index| {
|
||||
const ct_decl = mod.declPtr(ct_decl_index);
|
||||
try ct_decl.intern(mod);
|
||||
_ = try ct_decl.internValue(mod);
|
||||
}
|
||||
|
||||
struct_obj.have_field_inits = true;
|
||||
@ -34744,7 +34744,7 @@ fn semaUnionFields(mod: *Module, union_obj: *Module.Union) CompileError!void {
|
||||
try wip_captures.finalize();
|
||||
for (comptime_mutable_decls.items) |ct_decl_index| {
|
||||
const ct_decl = mod.declPtr(ct_decl_index);
|
||||
try ct_decl.intern(mod);
|
||||
_ = try ct_decl.internValue(mod);
|
||||
}
|
||||
|
||||
try union_obj.fields.ensureTotalCapacity(mod.tmp_hack_arena.allocator(), fields_len);
|
||||
|
||||
1517
src/codegen/llvm.zig
1517
src/codegen/llvm.zig
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -168,23 +168,41 @@ pub const Value = opaque {
|
||||
pub const setAliasee = LLVMAliasSetAliasee;
|
||||
extern fn LLVMAliasSetAliasee(Alias: *Value, Aliasee: *Value) void;
|
||||
|
||||
pub const constBitCast = LLVMConstBitCast;
|
||||
extern fn LLVMConstBitCast(ConstantVal: *Value, ToType: *Type) *Value;
|
||||
pub const constTrunc = LLVMConstTrunc;
|
||||
extern fn LLVMConstTrunc(ConstantVal: *Value, ToType: *Type) *Value;
|
||||
|
||||
pub const constIntToPtr = LLVMConstIntToPtr;
|
||||
extern fn LLVMConstIntToPtr(ConstantVal: *Value, ToType: *Type) *Value;
|
||||
pub const constSExt = LLVMConstSExt;
|
||||
extern fn LLVMConstSExt(ConstantVal: *Value, ToType: *Type) *Value;
|
||||
|
||||
pub const constZExt = LLVMConstZExt;
|
||||
extern fn LLVMConstZExt(ConstantVal: *Value, ToType: *Type) *Value;
|
||||
|
||||
pub const constFPTrunc = LLVMConstFPTrunc;
|
||||
extern fn LLVMConstFPTrunc(ConstantVal: *Value, ToType: *Type) *Value;
|
||||
|
||||
pub const constFPExt = LLVMConstFPExt;
|
||||
extern fn LLVMConstFPExt(ConstantVal: *Value, ToType: *Type) *Value;
|
||||
|
||||
pub const constUIToFP = LLVMConstUIToFP;
|
||||
extern fn LLVMConstUIToFP(ConstantVal: *Value, ToType: *Type) *Value;
|
||||
|
||||
pub const constSIToFP = LLVMConstSIToFP;
|
||||
extern fn LLVMConstSIToFP(ConstantVal: *Value, ToType: *Type) *Value;
|
||||
|
||||
pub const constFPToUI = LLVMConstFPToUI;
|
||||
extern fn LLVMConstFPToUI(ConstantVal: *Value, ToType: *Type) *Value;
|
||||
|
||||
pub const constFPToSI = LLVMConstFPToSI;
|
||||
extern fn LLVMConstFPToSI(ConstantVal: *Value, ToType: *Type) *Value;
|
||||
|
||||
pub const constPtrToInt = LLVMConstPtrToInt;
|
||||
extern fn LLVMConstPtrToInt(ConstantVal: *Value, ToType: *Type) *Value;
|
||||
|
||||
pub const constShl = LLVMConstShl;
|
||||
extern fn LLVMConstShl(LHSConstant: *Value, RHSConstant: *Value) *Value;
|
||||
pub const constIntToPtr = LLVMConstIntToPtr;
|
||||
extern fn LLVMConstIntToPtr(ConstantVal: *Value, ToType: *Type) *Value;
|
||||
|
||||
pub const constOr = LLVMConstOr;
|
||||
extern fn LLVMConstOr(LHSConstant: *Value, RHSConstant: *Value) *Value;
|
||||
|
||||
pub const constZExt = LLVMConstZExt;
|
||||
extern fn LLVMConstZExt(ConstantVal: *Value, ToType: *Type) *Value;
|
||||
pub const constBitCast = LLVMConstBitCast;
|
||||
extern fn LLVMConstBitCast(ConstantVal: *Value, ToType: *Type) *Value;
|
||||
|
||||
pub const constZExtOrBitCast = LLVMConstZExtOrBitCast;
|
||||
extern fn LLVMConstZExtOrBitCast(ConstantVal: *Value, ToType: *Type) *Value;
|
||||
@ -195,6 +213,30 @@ pub const Value = opaque {
|
||||
pub const constAdd = LLVMConstAdd;
|
||||
extern fn LLVMConstAdd(LHSConstant: *Value, RHSConstant: *Value) *Value;
|
||||
|
||||
pub const constSub = LLVMConstSub;
|
||||
extern fn LLVMConstSub(LHSConstant: *Value, RHSConstant: *Value) *Value;
|
||||
|
||||
pub const constMul = LLVMConstMul;
|
||||
extern fn LLVMConstMul(LHSConstant: *Value, RHSConstant: *Value) *Value;
|
||||
|
||||
pub const constAnd = LLVMConstAnd;
|
||||
extern fn LLVMConstAnd(LHSConstant: *Value, RHSConstant: *Value) *Value;
|
||||
|
||||
pub const constOr = LLVMConstOr;
|
||||
extern fn LLVMConstOr(LHSConstant: *Value, RHSConstant: *Value) *Value;
|
||||
|
||||
pub const constXor = LLVMConstXor;
|
||||
extern fn LLVMConstXor(LHSConstant: *Value, RHSConstant: *Value) *Value;
|
||||
|
||||
pub const constShl = LLVMConstShl;
|
||||
extern fn LLVMConstShl(LHSConstant: *Value, RHSConstant: *Value) *Value;
|
||||
|
||||
pub const constLShr = LLVMConstLShr;
|
||||
extern fn LLVMConstLShr(LHSConstant: *Value, RHSConstant: *Value) *Value;
|
||||
|
||||
pub const constAShr = LLVMConstAShr;
|
||||
extern fn LLVMConstAShr(LHSConstant: *Value, RHSConstant: *Value) *Value;
|
||||
|
||||
pub const constAddrSpaceCast = LLVMConstAddrSpaceCast;
|
||||
extern fn LLVMConstAddrSpaceCast(ConstantVal: *Value, ToType: *Type) *Value;
|
||||
|
||||
@ -281,6 +323,9 @@ pub const Value = opaque {
|
||||
pub const attachMetaData = ZigLLVMAttachMetaData;
|
||||
extern fn ZigLLVMAttachMetaData(GlobalVar: *Value, DIG: *DIGlobalVariableExpression) void;
|
||||
|
||||
pub const blockAddress = LLVMBlockAddress;
|
||||
extern fn LLVMBlockAddress(F: *Value, BB: *BasicBlock) *Value;
|
||||
|
||||
pub const dump = LLVMDumpValue;
|
||||
extern fn LLVMDumpValue(Val: *Value) void;
|
||||
};
|
||||
@ -349,6 +394,14 @@ pub const Type = opaque {
|
||||
pub const isSized = LLVMTypeIsSized;
|
||||
extern fn LLVMTypeIsSized(Ty: *Type) Bool;
|
||||
|
||||
pub const constGEP = LLVMConstGEP2;
|
||||
extern fn LLVMConstGEP2(
|
||||
Ty: *Type,
|
||||
ConstantVal: *Value,
|
||||
ConstantIndices: [*]const *Value,
|
||||
NumIndices: c_uint,
|
||||
) *Value;
|
||||
|
||||
pub const constInBoundsGEP = LLVMConstInBoundsGEP2;
|
||||
extern fn LLVMConstInBoundsGEP2(
|
||||
Ty: *Type,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user