{"id":17040891,"url":"https://github.com/m4gnv5/gsoc2018","last_synced_at":"2025-03-23T00:46:13.870Z","repository":{"id":80537302,"uuid":"144148021","full_name":"M4GNV5/GSoC2018","owner":"M4GNV5","description":"My Google Summer of Code 2018 Work product submission","archived":false,"fork":false,"pushed_at":"2018-10-03T12:44:49.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-28T04:19:39.852Z","etag":null,"topics":["gnu","gsoc","gsoc-2018","jit","libjit","register-allocators"],"latest_commit_sha":null,"homepage":"","language":"C","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/M4GNV5.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-08-09T12:13:15.000Z","updated_at":"2020-07-26T12:42:04.000Z","dependencies_parsed_at":"2023-03-09T07:45:28.574Z","dependency_job_id":null,"html_url":"https://github.com/M4GNV5/GSoC2018","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M4GNV5%2FGSoC2018","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M4GNV5%2FGSoC2018/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M4GNV5%2FGSoC2018/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M4GNV5%2FGSoC2018/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/M4GNV5","download_url":"https://codeload.github.com/M4GNV5/GSoC2018/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245040189,"owners_count":20551301,"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":["gnu","gsoc","gsoc-2018","jit","libjit","register-allocators"],"created_at":"2024-10-14T09:10:48.708Z","updated_at":"2025-03-23T00:46:13.848Z","avatar_url":"https://github.com/M4GNV5.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GSoC 2018\n\nThis repository acts as the \"Work Product Submission\" for my [Google Summer of Code](https://summerofcode.withgoogle.com/) 2018 project.\n[My project](https://summerofcode.withgoogle.com/projects/#4596557656096768) was implementing a register allocator for [libjit](https://www.gnu.org/software/libjit/). Register allocation is the process of determining which variables of a function reside in registers and which in memory. While working on my GSoC project I also wrote [a paper](https://i.m4gnus.de/registerallocation.pdf) which explains the theory behind writing a graph coloring based register allocator.\n\n**All my commits done during GSoC as well as the code changed can be [viewed here](https://github.com/M4GNV5/libjit/compare/pre-gsoc...M4GNV5:gsoc)**\n\n## Work summary\n- Implement computation of the liveness sets `UEVar`, `VarKill` and `LiveOut`.\n- Make function prologs and epilogs on x86-64 only store the base pointer when required and only move the stack pointer when required.\n- Implement computing live ranges for each value using the computed liveness sets.\n- Extend the the rules parser to include a section with register usage information for each instruction.\n- Add internal live ranges when instructions use or clobber registers\n- Implement a graph coloring based register allocator as described by Chaitin/Briggs:\n\t- Build the interference graph\n\t- Remove nodes from the graph and pushing them on a stack\n\t- Pop live ranges from the stack and color them.\n\t- If a live range was left uncoloured in the previous step spill it and restart the process.\n- Add a flag to instructions which support a value to be in memory, so there is no need for creating a spill range for that value\n- Add a diagnostic function which dumps all live ranges of a function\n- Correctly move values into destination registers before instructions\n\n#### Unimplemented\n- The orginal Chaitin Briggs allocator has an additional step which coalesces live ranges. This is currently missing in libjit.\n- In libjit there are special \"manual\" instructions which manually perform register operations. Currently only ARM has manual instructions. The new register allocator is untested with them.\n\n## Comparasion\nThis repository contains various programs and scripts for comparing the the new and old register allocators. Their execution speed is then measured and visualized.\n\n### Mandelbrot\nThe Mandelbrot fractal viewer is a good speed comparasion example, as it is a common program. The new allocator is approximately 35% faster.\n![](img/mandelbrot.png)\n\n### Sum of numbers\nThis program sums all numbers from 0 to n. The generated code looks nearly the same with both register allocators, so there is no real difference in execution speed.\n![](img/sumOfNumbers.png)\n\n### Constructed\nThis is a program constructed to perform better with a good register allocator. The code does not do anything useful, but contains many values and basic blocks.\n![](img/constructed.png)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm4gnv5%2Fgsoc2018","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm4gnv5%2Fgsoc2018","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm4gnv5%2Fgsoc2018/lists"}