diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/a_embedfilesdir.c (renamed from src/c_embedfilesdir.c) | 0 | ||||
| -rw-r--r-- | src/a_main.c | 4 | ||||
| -rw-r--r-- | src/a_targ.c | 4 | ||||
| -rw-r--r-- | src/antcc.h (renamed from src/a_common.h) | 0 | ||||
| -rw-r--r-- | src/c.c | 8 | ||||
| -rw-r--r-- | src/c.h | 4 | ||||
| -rw-r--r-- | src/c_builtin.c | 2 | ||||
| -rw-r--r-- | src/c_eval.c | 2 | ||||
| -rw-r--r-- | src/c_lex.c | 6 | ||||
| -rw-r--r-- | src/c_lex.h | 6 | ||||
| -rw-r--r-- | src/c_type.c | 2 | ||||
| -rw-r--r-- | src/c_type.h | 2 | ||||
| -rw-r--r-- | src/ir.c | 6 | ||||
| -rw-r--r-- | src/ir.h | 8 | ||||
| -rw-r--r-- | src/ir_dump.c | 6 | ||||
| -rw-r--r-- | src/ir_fold.c | 2 | ||||
| -rw-r--r-- | src/o_elf.c | 6 | ||||
| -rw-r--r-- | src/o_elf.h | 131 | ||||
| -rw-r--r-- | src/obj.c | 2 | ||||
| -rw-r--r-- | src/obj.h | 2 | ||||
| -rw-r--r-- | src/t_aarch64.h | 2 | ||||
| -rw-r--r-- | src/t_aarch64_aapcs.c | 2 | ||||
| -rw-r--r-- | src/t_aarch64_emit.c | 6 | ||||
| -rw-r--r-- | src/t_aarch64_isel.c | 2 | ||||
| -rw-r--r-- | src/t_x86-64.h | 2 | ||||
| -rw-r--r-- | src/t_x86-64_emit.c | 6 | ||||
| -rw-r--r-- | src/t_x86-64_isel.c | 4 | ||||
| -rw-r--r-- | src/t_x86-64_sysv.c | 2 | ||||
| -rw-r--r-- | src/u_endian.h | 2 | ||||
| -rw-r--r-- | src/u_io.c (renamed from src/io.c) | 4 | ||||
| -rw-r--r-- | src/u_mem.c | 2 |
31 files changed, 121 insertions, 116 deletions
diff --git a/src/c_embedfilesdir.c b/src/a_embedfilesdir.c index d1c8dd4..d1c8dd4 100644 --- a/src/c_embedfilesdir.c +++ b/src/a_embedfilesdir.c diff --git a/src/a_main.c b/src/a_main.c index 9710814..303d513 100644 --- a/src/a_main.c +++ b/src/a_main.c @@ -1,7 +1,7 @@ -#include "common.h" +#include "antcc.h" #include "version.h" #include "hostconfig.h" /* run ./configure */ -#include "obj/obj.h" +#include "obj.h" #include <errno.h> #include <stdlib.h> #include <sys/types.h> diff --git a/src/a_targ.c b/src/a_targ.c index fdc11f8..0a14554 100644 --- a/src/a_targ.c +++ b/src/a_targ.c @@ -1,5 +1,5 @@ -#include "common.h" -#include "type.h" +#include "antcc.h" +#include "c_type.h" extern const struct mctarg t_x86_64_sysv, t_aarch64_aapcs; static const struct targ { diff --git a/src/a_common.h b/src/antcc.h index a24aa3d..a24aa3d 100644 --- a/src/a_common.h +++ b/src/antcc.h @@ -1,8 +1,8 @@ #include "c.h" -#include "lex.h" -#include "../endian.h" -#include "../ir/ir.h" -#include "../obj/obj.h" +#include "c_lex.h" +#include "u_endian.h" +#include "ir.h" +#include "obj.h" /** Parsing helper functions **/ #define peek(Cm,Tk) lexpeek((Cm)->lx,Tk) @@ -1,5 +1,5 @@ -#include "../common.h" -#include "../type.h" +#include "antcc.h" +#include "c_type.h" /*************/ /* EXPR TREE */ diff --git a/src/c_builtin.c b/src/c_builtin.c index 5c59857..ddcfa82 100644 --- a/src/c_builtin.c +++ b/src/c_builtin.c @@ -1,5 +1,5 @@ #include "c.h" -#include "../ir/ir.h" +#include "ir.h" static bool callcheck(const struct span *span, int nparam, const union type *param, int narg, struct expr *args) diff --git a/src/c_eval.c b/src/c_eval.c index 3dfbbfb..ad5cf40 100644 --- a/src/c_eval.c +++ b/src/c_eval.c @@ -1,5 +1,5 @@ #include "c.h" -#include "../ir/ir.h" +#include "ir.h" #include <limits.h> static int diff --git a/src/c_lex.c b/src/c_lex.c index c196a21..d3529c0 100644 --- a/src/c_lex.c +++ b/src/c_lex.c @@ -1,5 +1,5 @@ -#include "lex.h" -#include "../version.h" +#include "c_lex.h" +#include "version.h" #include <string.h> #include <stdlib.h> @@ -2040,7 +2040,7 @@ identkeyword(struct token *tk) const char *alias[2]; } kwtab[] = { #define _(kw, cstd, ...) { #kw, {TKW##kw, cstd}, __VA_ARGS__ }, -#include "keywords.def" +#include "c_keywords.def" #undef _ }; #ifdef __GNUC__ diff --git a/src/c_lex.h b/src/c_lex.h index e70bc78..8797ded 100644 --- a/src/c_lex.h +++ b/src/c_lex.h @@ -1,5 +1,5 @@ -#include "../common.h" -#include "../type.h" +#include "antcc.h" +#include "c_type.h" static inline bool joinspan(struct span0 *dst, struct span0 snd) @@ -45,7 +45,7 @@ enum toktag { /* single-character tokens' tag value is the character itself */ TKSETSHR, /* >>= */ TKIDENT = 0x80, #define _(kw, stdc, ...) TKW##kw, -#include "keywords.def" +#include "c_keywords.def" #undef _ NTOKTAG, }; diff --git a/src/c_type.c b/src/c_type.c index e8a5b1e..59d890b 100644 --- a/src/c_type.c +++ b/src/c_type.c @@ -1,4 +1,4 @@ -#include "type.h" +#include "c_type.h" struct typedata typedata[1<<13]; internstr ttypenames[1<<10]; diff --git a/src/c_type.h b/src/c_type.h index ad8e1b1..12f24b2 100644 --- a/src/c_type.h +++ b/src/c_type.h @@ -1,6 +1,6 @@ #ifndef TYPE_H_ #define TYPE_H_ -#include "common.h" +#include "antcc.h" enum qualifier { QCONST = 1<<0, @@ -1,5 +1,5 @@ #include "ir.h" -#include "../obj/obj.h" +#include "obj.h" uchar type2cls[NTYPETAG]; uchar cls2siz[] = { [KI32] = 4, [KI64] = 8, [KF32] = 4, [KF64] = 8 }; @@ -15,14 +15,14 @@ const uchar siz2intcls[] = { [1] = KI32, [2] = KI32, [4] = KI32, [8] = KI64 }; const char *opnames[] = { "?\??", #define _(o,...) #o, -#include "op.def" +#include "ir_op.def" #undef _ }; const uchar opnarg[] = { 0, #define _(o,n) n, -#include "op.def" +#include "ir_op.def" #undef _ }; @@ -1,5 +1,5 @@ -#include "../common.h" -#include "../type.h" +#include "antcc.h" +#include "c_type.h" enum irclass { KXXX, @@ -93,7 +93,7 @@ struct addr { enum op { Oxxx, #define _(o,...) O##o, -#include "op.def" +#include "ir_op.def" #undef _ NOPER, }; @@ -109,7 +109,7 @@ extern const uchar opnarg[]; enum intrin { INxxx, #define _(b,...) IN##b, -#include "intrin.def" +#include "ir_intrin.def" #undef _ }; diff --git a/src/ir_dump.c b/src/ir_dump.c index b0ce603..1036135 100644 --- a/src/ir_dump.c +++ b/src/ir_dump.c @@ -1,6 +1,6 @@ #include "ir.h" -#include "../obj/obj.h" -#include "../endian.h" +#include "obj.h" +#include "u_endian.h" static int nextdat; @@ -91,7 +91,7 @@ prityp(union irtype typ) static const char *intrinname[] = { "?\??", #define _(b,...) #b, -#include "intrin.def" +#include "ir_intrin.def" #undef _ }; diff --git a/src/ir_fold.c b/src/ir_fold.c index 4c9861e..a7b5c6e 100644 --- a/src/ir_fold.c +++ b/src/ir_fold.c @@ -1,5 +1,5 @@ #include "ir.h" -#include "../endian.h" +#include "u_endian.h" #include <limits.h> #ifdef __clang__ diff --git a/src/o_elf.c b/src/o_elf.c index 5044e56..f652657 100644 --- a/src/o_elf.c +++ b/src/o_elf.c @@ -1,7 +1,7 @@ -#include "elf.h" +#include "o_elf.h" #include "obj.h" -#include "../ir/ir.h" /* mctarg */ -#include "../endian.h" +#include "ir.h" /* mctarg */ +#include "u_endian.h" #include <unistd.h> #include <stdlib.h> /* qsort */ diff --git a/src/o_elf.h b/src/o_elf.h index c96ae8b..c63a2be 100644 --- a/src/o_elf.h +++ b/src/o_elf.h @@ -1,4 +1,9 @@ -#include "../common.h" +typedef unsigned char u8int; +typedef unsigned short u16int; +typedef unsigned int u32int; +typedef signed int s32int; +typedef signed long long s64int; +typedef unsigned long long u64int; #define ELFMAG "\177ELF" enum { @@ -27,55 +32,55 @@ enum { EM_ARM64 = 0xB7, }; -#define ELF_HDRIDENT \ - union { \ - uchar ident[16]; \ - struct { \ - uchar i_mag[4], \ - i_class, \ - i_data, \ - i_version, \ - i_osabi, \ - i_abiversion, \ - i_pad[7]; \ - }; \ +#define ELF_HDRIDENT \ + union { \ + char ident[16]; \ + struct { \ + u8int i_mag[4], \ + i_class, \ + i_data, \ + i_version, \ + i_osabi, \ + i_abiversion, \ + i_pad[7]; \ + }; \ } struct elf64hdr { ELF_HDRIDENT; - ushort type, + u16int type, machine; - uint version; - uvlong entry, + u32int version; + u64int entry, phoff, shoff; - uint flags; - ushort ehsize, + u32int flags; + u16int ehsize, phentsize, phnum, shentsize, shnum, shstrndx; }; -static_assert(sizeof(struct elf64hdr) == 64); +_Static_assert(sizeof(struct elf64hdr) == 64, ""); struct elf32hdr { ELF_HDRIDENT; - ushort type, + u16int type, machine; - uint version; - uint entry, + u32int version; + u32int entry, phoff, shoff; - uint flags; - ushort ehsize, + u32int flags; + u16int ehsize, phentsize, phnum, shentsize, shnum, shstrndx; }; -static_assert(sizeof(struct elf32hdr) == 52); +_Static_assert(sizeof(struct elf32hdr) == 52, ""); enum { SHT_NULL = 0x0, @@ -111,32 +116,32 @@ enum { }; struct elf64shdr { - uint name, + u32int name, type; - uvlong flags, + u64int flags, addr, offset, size; - uint link, + u32int link, info; - uvlong addralign, + u64int addralign, entsize; }; -static_assert(sizeof(struct elf64shdr) == 64); +_Static_assert(sizeof(struct elf64shdr) == 64, ""); struct elf32shdr { - uint name, - type, - flags, - addr, - offset, - size, - link, - info, - addralign, - entsize; -}; -static_assert(sizeof(struct elf32shdr) == 40); + u32int name, + type, + flags, + addr, + offset, + size, + link, + info, + addralign, + entsize; +}; +_Static_assert(sizeof(struct elf32shdr) == 40, ""); enum { STB_LOCAL, @@ -160,47 +165,47 @@ enum { #define ELF_S_INFO(b,t) ((b) << 4 | (t)) struct elf64sym { - uint name; - uchar info, + u32int name; + u8int info, other; - ushort shndx; - uvlong value, + u16int shndx; + u64int value, size; }; -static_assert(sizeof(struct elf64sym) == 24); +_Static_assert(sizeof(struct elf64sym) == 24, ""); struct elf32sym { - uint name, + u32int name, value, size; - uchar info, + u8int info, other; - ushort shndx; + u16int shndx; }; -static_assert(sizeof(struct elf32sym) == 16); +_Static_assert(sizeof(struct elf32sym) == 16, ""); -#define ELF64_R_INFO(s,t) ((uvlong) (s) << 32 | (uint)(t)) +#define ELF64_R_INFO(s,t) ((u64int) (s) << 32 | (u32int)(t)) struct elf64rel { - uvlong offset, info; + u64int offset, info; }; -static_assert(sizeof(struct elf64rel) == 16); +_Static_assert(sizeof(struct elf64rel) == 16, ""); -#define ELF32_R_INFO(s,t) ((s) << 8 | (uchar)(t)) +#define ELF32_R_INFO(s,t) ((s) << 8 | (u8int)(t)) struct elf32rel { - uint offset, info; + u32int offset, info; }; -static_assert(sizeof(struct elf32rel) == 8); +_Static_assert(sizeof(struct elf32rel) == 8, ""); struct elf64rela { - uvlong offset, info; - vlong addend; + u64int offset, info; + s64int addend; }; -static_assert(sizeof(struct elf64rela) == 24); +_Static_assert(sizeof(struct elf64rela) == 24, ""); struct elf32rela { - uint offset, info; - int addend; + u32int offset, info; + s32int addend; }; -static_assert(sizeof(struct elf32rela) == 12); +_Static_assert(sizeof(struct elf32rela) == 12, ""); /* vim:set ts=3 sw=3 expandtab: */ @@ -1,5 +1,5 @@ #include "obj.h" -#include "../ir/ir.h" +#include "ir.h" #include <errno.h> #include <fcntl.h> #include <unistd.h> @@ -1,4 +1,4 @@ -#include "../common.h" +#include "antcc.h" extern struct objfile { const char *infile, *outfile; diff --git a/src/t_aarch64.h b/src/t_aarch64.h index 828909e..ad017c1 100644 --- a/src/t_aarch64.h +++ b/src/t_aarch64.h @@ -1,4 +1,4 @@ -#include "../ir/ir.h" +#include "ir.h" enum reg { R0 = 0, diff --git a/src/t_aarch64_aapcs.c b/src/t_aarch64_aapcs.c index fc08da1..8b90ff2 100644 --- a/src/t_aarch64_aapcs.c +++ b/src/t_aarch64_aapcs.c @@ -1,4 +1,4 @@ -#include "all.h" +#include "t_aarch64.h" static int abiarg(short r[2], uchar cls[2], uchar *r2off, int *ni, int *nf, int *ns, union irtype typ) diff --git a/src/t_aarch64_emit.c b/src/t_aarch64_emit.c index 9fdcd83..ac7004b 100644 --- a/src/t_aarch64_emit.c +++ b/src/t_aarch64_emit.c @@ -1,6 +1,6 @@ -#include "all.h" -#include "../obj/obj.h" -#include "../endian.h" +#include "t_aarch64.h" +#include "obj.h" +#include "u_endian.h" /* References: * ARM ARM https://developer.arm.com/documentation/ddi0628/aa/?lang=en diff --git a/src/t_aarch64_isel.c b/src/t_aarch64_isel.c index 398ea28..7e5057c 100644 --- a/src/t_aarch64_isel.c +++ b/src/t_aarch64_isel.c @@ -1,4 +1,4 @@ -#include "all.h" +#include "t_aarch64.h" #define isimm32(r) (iscon(r) && concls(r) == KI32) diff --git a/src/t_x86-64.h b/src/t_x86-64.h index c0c38ff..91021ed 100644 --- a/src/t_x86-64.h +++ b/src/t_x86-64.h @@ -1,4 +1,4 @@ -#include "../ir/ir.h" +#include "ir.h" #define LIST_REGS(_) \ _(RAX) _(RCX) _(RDX) _(RBX) _(RSP) _(RBP) _(RSI) _(RDI) \ diff --git a/src/t_x86-64_emit.c b/src/t_x86-64_emit.c index d3a466b..37a3f9c 100644 --- a/src/t_x86-64_emit.c +++ b/src/t_x86-64_emit.c @@ -1,6 +1,6 @@ -#include "all.h" -#include "../obj/obj.h" -#include "../endian.h" +#include "t_x86-64.h" +#include "obj.h" +#include "u_endian.h" /** Instruction operands ** * diff --git a/src/t_x86-64_isel.c b/src/t_x86-64_isel.c index 4b4a099..a2c41be 100644 --- a/src/t_x86-64_isel.c +++ b/src/t_x86-64_isel.c @@ -1,5 +1,5 @@ -#include "all.h" -#include "../endian.h" +#include "t_x86-64.h" +#include "u_endian.h" enum flag { ZF = 1 << 0, diff --git a/src/t_x86-64_sysv.c b/src/t_x86-64_sysv.c index 317f40f..b0cf204 100644 --- a/src/t_x86-64_sysv.c +++ b/src/t_x86-64_sysv.c @@ -1,4 +1,4 @@ -#include "all.h" +#include "t_x86-64.h" static int classify(uchar cls[2], const struct typedata *td, uint off); diff --git a/src/u_endian.h b/src/u_endian.h index 34b7721..bf4b008 100644 --- a/src/u_endian.h +++ b/src/u_endian.h @@ -1,7 +1,7 @@ #ifndef ENDIAN_H_ #define ENDIAN_H_ -#include "common.h" +#include "antcc.h" extern bool targ_bigendian; /*** Macros and functions for endian specific memory access ***/ @@ -1,4 +1,4 @@ -#include "c/lex.h" +#include "c_lex.h" #include <errno.h> #include <fcntl.h> #include <limits.h> @@ -600,7 +600,7 @@ vbfmt(struct wbuf *out, const char *fmt, va_list ap) if (tok->t >= TKWBEGIN_ && tok->t <= TKWEND_) { static const char *tab[] = { #define _(kw, c, ...) #kw, - #include "c/keywords.def" + #include "c_keywords.def" #undef _ }; tok->s = tab[tok->t - TKWBEGIN_]; diff --git a/src/u_mem.c b/src/u_mem.c index 9ee8864..9495a5f 100644 --- a/src/u_mem.c +++ b/src/u_mem.c @@ -1,4 +1,4 @@ -#include "common.h" +#include "antcc.h" #include <stdlib.h> #include <errno.h> #include <stdint.h> |