{"id":15060239,"url":"https://github.com/dipa09/dcc","last_synced_at":"2026-02-08T08:03:13.412Z","repository":{"id":238538131,"uuid":"796357377","full_name":"dipa09/dcc","owner":"dipa09","description":"C Optimizing Compiler","archived":false,"fork":false,"pushed_at":"2025-02-23T15:28:14.000Z","size":75,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-23T16:26:41.263Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dipa09.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-05T17:47:12.000Z","updated_at":"2025-02-23T15:28:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"720c5a5b-4d0e-431e-bb0e-d2fe7c2c7352","html_url":"https://github.com/dipa09/dcc","commit_stats":null,"previous_names":["dipa09/dcc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipa09%2Fdcc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipa09%2Fdcc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipa09%2Fdcc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipa09%2Fdcc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dipa09","download_url":"https://codeload.github.com/dipa09/dcc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243685583,"owners_count":20330982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aarch64","arm64","assembler","c","c-compiler","compiler","dwarf","elf64","preprocessor","self-hosting","x86-64"],"created_at":"2024-09-24T22:54:52.299Z","updated_at":"2026-02-08T08:03:13.204Z","avatar_url":"https://github.com/dipa09.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"dcc is an optimizing compiler for the C language.\n\nIt currently runs on x86_64 Linux and it can cross-compile to aarch64 (arm64).\n\n\n## Features\n- Built-in C preprocessor.\n- C11 and partial C23 support.\n- Good diagnostic messages.\n- Mostly compatible with gcc.\n- Several common GCC extensions, plus some new one.\n- Intel intrinsics up to AVX2.\n- Backends: aarch64, x86-64.\n- Integrated assembler.\n- Debug info in DWARF4 format.\n- ~12 times faster than gcc.\n- Plugin API for accessing the AST and extending the compiler.\n- UB Sanitizer\n\n\n## [Status](./backends_status.md)\n| Target              | Status         |\n|---------------------|----------------|\n| `x86_64-linux-gnu`  | alpha-stable   |\n| `aarch64-linux-gnu` | alpha-unstable |\n| `riscv64-linux-gnu` | incomplete     |\n\n\n[Demo (06/05/2024)](https://www.youtube.com/watch?v=TPWxtAFwiks)\n\nIn the demo I show:\n- self-compilation,\n- debug info,\n- good error messages and warnings,\n- preprocessor oddities,\n- emulating gcc vector extension by using the operator overloading attribute,\n- custom reflection system through the plugin API.\n\n\n[Changelog](./CHANGELOG.md)\n\n\nSuccessful builds:\n[8080](https://github.com/superzazu/8080),\n[BearSSL](https://github.com/OUIsolutions/BearSslSingle-Unit),\n[Meow hash](https://github.com/cmuratori/meow_hash),\n[Nuklear](https://github.com/Immediate-Mode-UI/Nuklear),\n[TermGL](https://github.com/wojciech-graj/TermGL),\n[Verstable](https://github.com/JacksonAllan/Verstable),\n[bf-x86](https://github.com/skeeto/bf-x86),\n[brainc](https://github.com/detectivekaktus/brainc),\n[catimg](https://github.com/posva/catimg),\n[cccc](https://github.com/skeeto/cccc),\n[chasm](https://github.com/aqilc/chasm),\n[chess](https://github.com/weirddan455/chess),\n[chibicc](https://github.com/rui314/chibicc),\n[clex](https://github.com/h2337/clex?),\n[cproc](https://sr.ht/~mcf/cproc),\n[fcpp](https://github.com/bagder/fcpp),\n[gc](https://github.com/mkirchner/gc),\n[genann](https://github.com/codeplea/genann),\n[klib](https://github.com/attractivechaos/klib),\n[lemon](https://compiler-dept.github.io/lemon),\n[libaca](https://github.com/dongyx/libaca),\n[libcox](https://github.com/symisc/libcox),\n[luigi](https://github.com/nakst/luigi),\n[mandel-simd](https://github.com/skeeto/mandel-simd),\n[mg](https://github.com/ibara/mg),\n[minilua](https://github.com/edubart/minilua),\n[minivorbis](https://github.com/edubart/minivorbis),\n[miniz-3.0.2](https://github.com/richgel999/miniz),\n[oed](https://github.com/ibara/oed),\n[optparse](https://github.com/skeeto/optparse),\n[parson](https://github.com/kgabis/parson),\n[pdjson](https://github.com/skeeto/pdjson),\n[pl0c](https://github.com/ibara/pl0c),\n[psh](https://github.com/proh14/psh),\n[q3vm](https://github.com/jnz/q3vm),\n[qbe](https://c9x.me/compile/),\n[qoi](https://github.com/phoboslab/qoi),\n[quad-tree](https://github.com/leonmavr/quad-tree),\n[quadsort](https://github.com/scandum/quadsort),\n[race64](https://github.com/skeeto/race64),\n[renderer](https://github.com/zauonlok/renderer),\n[rpng](https://github.com/raysan5/rpng),\n[siod](https://github.com/deriito/siod-v3.0),\n[space-shooter.c](https://github.com/tsherif/space-shooter.c),\n[sqlite](https://github.com/sqlite/sqlite),\n[stb](https://github.com/nothings/stb/),\n[tinn](https://github.com/glouw/tinn),\n[treecc](https://github.com/rweather/treecc),\n[trie](https://github.com/skeeto/trie),\n[utf8.h](https://github.com/sheredom/utf8.h),\n[vce](https://github.com/ibara/vce),\n[z80](https://github.com/superzazu/z80).\n\n## Performance and code quality (06/2025)\nMeasurements done like the previous (07/2024).\n\n- `dcc-0.9` built with `dcc-0.8`\n- `dcc.0` built with `dcc-0.9 -O0`\n- `dcc.1` built with `dcc-0.9 -O1`\n- `dcc.2` built with `gcc-14.2.0 -O1 -fwrapv -fno-strict-aliasing -fno-delete-null-pointer-checks -fno-omit-frame-pointer`\n- `dcc.3` built with `gcc-14.2.0 -O3`\n\n| Compiler   |        Cycles |   Instructions | Time [s] |  Obj Size | Comp. Size | Comp. Speed [LOC/s] |\n|------------|--------------:|---------------:|----------|----------:|-----------:|--------------------:|\n| dcc.3      |   763,229,738 |  1,125,805,566 | 0.23312  | 1,062,456 |  1,361,600 |          340,558.51 |\n| dcc.2      |   893,227,651 |  1,368,185,657 | 0.27089  | 1,062,456 |  1,060,400 |          293,074.68 |\n| dcc.1      | 1,163,188,777 |  1,869,201,132 | 0.35186  | 1,062,456 |  1,050,760 |          225,632.35 |\n| dcc.0      | 1,353,239,375 |  2,090,584,075 | 0.40085  | 1,062,456 |  1,078,616 |          198,056.63 |\n| gcc-14.2.0 | 9,715,713,419 | 15,387,243,449 | 2.8505   | 1,372,304 |  1,186,944 |           27,851.60 |\n\n\n## Performance and code quality (02/2025)\nMeasurements done like the previous (07/2024).\n\n- `dcc-0.8` built with `dcc-0.7`\n- `dcc.0` built with `dcc-0.8 -O0`\n- `dcc.1` built with `dcc-0.8 -O1 -fno-inline`\n- `dcc.2` built with `gcc-13.3.0 -O1 -fwrapv -fno-strict-aliasing -fno-delete-null-pointer-checks -fno-omit-frame-pointer`\n- `dcc.3` built with `gcc-13.3.0 -O3`\n\n| Compiler |        Cycles |   Instructions | Time [s] |  Obj Size | Comp. Size | Comp. Speed [LOC/s] |\n|----------|--------------:|---------------:|----------|----------:|-----------:|--------------------:|\n| dcc.3    |   772,378,385 |  1,108,315,903 | 0.23823  | 1,074,184 |  1,276,768 |          333,253.58 |\n| dcc.2    |   875,339,855 |  1,333,849,871 | 0.26986  | 1,074,184 |    949,728 |          294,193.29 |\n| dcc.1    | 1,170,765,841 |  1,832,543,712 | 0.36062  | 1,074,184 |  1,002,304 |          220,151.41 |\n| dcc.0    | 1,382,189,150 |  2,105,052,535 | 0.41259  | 1,074,184 |  1,035,072 |          192,421.05 |\n| gcc-13.3 | 9,541,270,463 | 15,113,325,935 | 2.8327   | 1,372,344 |  1,023,032 |           28,026.62 |\n\n\n## Performance and code quality (11/2024)\nMeasurements done like the previous (07/2024).\n\n- `dcc-0.7` built with `dcc-0.6`\n- `dcc.0` built with `dcc-0.7 -O0`\n- `dcc.1` built with `dcc-0.7 -O1`\n- `dcc.2` built with `gcc-13.2.0 -O1 -fwrapv -fno-strict-aliasing -fno-delete-null-pointer-checks -fno-omit-frame-pointer`\n\n| Compiler |         Cycles |   Instructions | Time [s] |  Obj Size | Comp. Size | Comp. Speed [LOC/s] |\n|----------|---------------:|---------------:|----------|----------:|-----------:|--------------------:|\n| dcc.2    |    879,359,441 |  1,320,932,448 | 0.27442  | 1,074,906 |    878,472 |          289,304.72 |\n| dcc.1    |  1,168,743,273 |  1,763,527,317 | 0.36039  | 1,074,906 |    988,456 |          220,291.91 |\n| dcc.0    |  1,394,913,162 |  2,120,576,066 | 0.42145  | 1,074,906 |  1,007,832 |          188,375.85 |\n| gcc-13.2 | 10,586,317,041 | 16,270,923,387 | 3.19950  | 1,372,336 |  1,756,536 |           24,813.56 |\n\n`dcc.1` is 14.49% faster than `dcc.0`, but 31.33% slower than `dcc.2`.\n\n\n## Performance and code quality (07/2024)\nMeasurements done like the one below, except that this time the compilation\ntarget is dcc-0.3 (a single TU of 79391 LOC).\n\n- `dcc-0.6` built with `gcc-13` (this is not tested for performance)\n- `dcc.0` built with `dcc-0.6`\n- `dcc.1` built with `dcc.0 -O1`\n- `dcc.2` built with `gcc -O1 -fwrapv -fno-strict-aliasing -fno-delete-null-pointer-checks -fno-omit-frame-pointer`\n\n| Compiler |        Cycles |   Instructions | Time [s] |  Obj Size | Comp. Size | Comp. Speed [LOC/s] |\n|----------|--------------:|---------------:|----------|----------:|-----------:|--------------------:|\n| dcc.2    |   852,200,238 |  1,133,624,785 | 0.25804  | 1,078,796 |    765,360 |          307,717.05 |\n| dcc.1    | 1,079,790,236 |  1,689,984,564 | 0.33383  | 1,078,796 |    859,560 |          237,697.60 |\n| dcc.0    | 1,288,103,423 |  1,894,033,640 | 0.40143  | 1,078,796 |    932,336 |          197,770.47 |\n| gcc-13   | 9,282,984,281 | 14,526,056,365 | 2.72147  | 1,372,336 |  1,018,768 |           29,172.10 |\n\n\n## Performance and code quality (05/2024)\nMeasurements done on a 10 year-old laptop with an i7-6700HQ CPU compiling the\ncurrent version of the compiler (a single translation unit of 83865 LOC) to\nobject and by disabling all warnings.\n\nBasically the command `cc -w -c dcc.c` has been run by `perf stat` for each compiler.\n\nThe compilers that have been considered are:\n- `dcc.0` built with `gcc -O0`,\n- `dcc.1` built with `dcc.0 -O0`,\n- `dcc.2` built with `gcc -O1 -fwrapv -fno-strict-aliasing -fno-delete-null-pointer-checks -fno-omit-frame-pointer`,\n- `dcc.3` built with `gcc -O3`,\n- `gcc-9.5.0` and `gcc-13.2.0`.\n\n| Compiler |         Cycles |   Instructions | Time [s] | Obj Size | Comp. Size |\n|----------|---------------:|---------------:|----------|---------:|-----------:|\n| dcc.3    |    847,050,051 |  1,186,707,162 | 0.26324  |  1103536 |    1076664 |\n| dcc.2    |    944,942,698 |  1,448,801,591 | 0.28084  |  1103536 |     796408 |\n| dcc.1    |  1,552,032,670 |  2,353,993,382 | 0.46962  |  1103536 |     896896 |\n| dcc.0    |  1,646,074,155 |  2,499,780,895 | 0.49690  |  1103536 |    1155096 |\n| gcc-9    |  8,973,659,906 | 12,843,867,566 | 2,63070  |  1424976 |            |\n| gcc-13   | 10,350,651,622 | 16,458,362,668 | 3.01226  |  1425296 |            |\n\nCompilation speed for `dcc.2`: 298621.99 LOC/s\n\n`dcc.2` is 10.95 times faster than `gcc-13.2.0`,\n\n`dcc.1` is 1.06 times faster than `dcc.0` with a size reduction of 258200 bytes.\n\n\n## Testing\nThe compiler is tested against an internal testsuite currently composed by ~800 tests (~63K SLOC) and\nby building open source projects.\n\n[csmith](https://github.com/csmith-project/csmith) is also used, however at some\npoint the compiler becomes immune to it.\n\n\n## Does compilation time matter? (11/10/2024)\nApproximately a year ago I started measuring the time spent waiting for the compiler\nfor the debug build, so no optimizations enabled, and these are the results:\n\n|                                    | gcc         | dcc         |\n|------------------------------------|------------:|------------:|\n| Total complete timings             | 14271       | 1855        |\n| Total incomplete timings           | 8416        | 697         |\n| Days between first and last timing | 561         | 74          |\n| Slowest build time                 | 11.599s     | 1.423s      |\n| Fastest build time                 | 1.679s      | 0.483s      |\n| Average build time                 | 2.958s      | 0.546s      |\n| Total time spent waiting           | 11h:43m:34s | 00h:16m:53s |\n\nI've been using dcc (unoptimized, with assertions on) for building the next\nversion of dcc just for a couple of months, in the mean time I haven't used gcc\nat all except for double checking, so I am no longer collecting data about gcc\nperformance. The average build time of dcc can be used to take a guess about the\npotential time save.\n\n\t(14271*0.546s)/3600 = 2.16h =\u003e ~9 hours saved\n\nAssuming that dcc becomes 2x slower\n\n\t(2*14271*0.546s)/3600 = 4.33h =\u003e ~6 hours saved\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdipa09%2Fdcc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdipa09%2Fdcc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdipa09%2Fdcc/lists"}