Dream of my own C compiler
This commit is contained in:
65
packages/tcc/src/Sym.zig
Normal file
65
packages/tcc/src/Sym.zig
Normal file
@@ -0,0 +1,65 @@
|
||||
const std = @import("std");
|
||||
const Self = @This();
|
||||
|
||||
const CType = @import("CType.zig");
|
||||
const SValue = @import("SValue.zig");
|
||||
|
||||
v: u32,
|
||||
r: SValue.Register,
|
||||
a: SymAttr,
|
||||
u: extern union {
|
||||
s: extern struct {
|
||||
c: u32,
|
||||
u: extern union {
|
||||
sym_scope: u32,
|
||||
jnext: u32,
|
||||
f: FuncAttr,
|
||||
auxtype: u32,
|
||||
},
|
||||
},
|
||||
enum_val: u64,
|
||||
d: ?*u32,
|
||||
},
|
||||
type: CType,
|
||||
w: extern union {
|
||||
next: ?*Self,
|
||||
asm_label: u32,
|
||||
},
|
||||
prev: ?*Self,
|
||||
prev_tok: ?*Self,
|
||||
|
||||
pub const SymAttr = packed struct(u16) {
|
||||
/// log2(align) + 1 (0 means unspecified)
|
||||
aligned: u5 = 0,
|
||||
@"packed": bool = false,
|
||||
weak: bool = 0,
|
||||
visibility: Visibility = .default,
|
||||
dllexport: bool = false,
|
||||
dllimport: bool = false,
|
||||
_unused: u5 = 0,
|
||||
};
|
||||
|
||||
pub const Visibility = enum(u2) {
|
||||
default = 0,
|
||||
internal = 1,
|
||||
hidden = 2,
|
||||
protected = 3,
|
||||
};
|
||||
|
||||
pub const FuncAttr = packed struct(u32) {
|
||||
func_call: enum(u3) {
|
||||
cdecl = 0,
|
||||
stdcall = 1,
|
||||
fastcall1 = 2,
|
||||
fastcall2 = 3,
|
||||
fastcall3 = 4,
|
||||
fastcallw = 5,
|
||||
},
|
||||
func_type: enum(u2) {
|
||||
new = 1,
|
||||
old = 2,
|
||||
ellipsis = 3,
|
||||
},
|
||||
func_args: u8,
|
||||
_unused: u19,
|
||||
};
|
||||
Reference in New Issue
Block a user