Giter Site home page Giter Site logo

gocompa's Introduction

al-folio

deploy demo GitHub contributors Maintainers GitHub release GitHub license GitHub stars GitHub forks

Docker Image Version Docker Image Size Docker Pulls

A simple, clean, and responsive Jekyll theme for academics. If you like the theme, give it a star!

Preview

User community

The vibrant community of al-folio users is growing! Academics around the world use this theme for their homepages, blogs, lab pages, as well as webpages for courses, workshops, conferences, meetups, and more. Check out the community webpages below. Feel free to add your own page(s) by sending a PR.

Academics
Labs
Courses CMU PGM (S-19)
CMU DeepRL (F-19, S-20, F-20, S-21, F-21, S-22)
CMU MMML (F-20, F-22)
CMU AMMML (S-22, S-23)
CMU ASI (S-23)
CMU Distributed Systems (S-21)
Conferences & workshops ICLR Blog Post Track (2023)
ML Retrospectives (NeurIPS: 2019, 2020; ICML: 2020)
HAMLETS (NeurIPS: 2020)
ICBINB (NeurIPS: 2020, 2021)
Neural Compression (ICLR: 2021)
Score Based Methods (NeurIPS: 2022)
Images2Symbols (CogSci: 2022) Medical Robotics Junior Faculty Forum (ISMR: 2023)

Lighthouse PageSpeed Insights

Google PageSpeed

Table Of Contents

Getting started

Want to learn more about Jekyll? Check out this tutorial. Why Jekyll? Read Andrej Karpathy's blog post!

Installation

For a hands-on walkthrough of al-folio installation, check out this cool video tutorial by one of the community members! 🎬 🍿

The preferred way of using this template is by clicking in Use this template above the file list. Then, create a new repository at github.com:<your-username>/<your-repo-name>. If you plan to upload your site to <your-github-username>.github.io, note that the name of your repository must be <your-github-username>.github.io or <your-github-orgname>.github.io, as stated in the GitHub pages docs. For more information on how to deploy your site, check the Deployment section below. After you created your new repository, just download it to your machine:

$ git clone [email protected]:<your-username>/<your-repo-name>.git
$ cd <your-repo-name>

Local setup using Docker (Recommended on Windows)

You need to take the following steps to get al-folio up and running in your local machine:

  • First, install docker and docker-compose.
  • Finally, run the following command that will pull a pre-built image from DockerHub and will run your website.
$ docker-compose up

Note that when you run it for the first time, it will download a docker image of size 300MB or so.

Now, feel free to customize the theme however you like (don't forget to change the name!). After you are done, you can use the same command (docker-compose up) to render the webpage with all you changes. Also, make sure to commit your final changes.

To change port number, you can edit docker-compose.yml file.

(click to expand) Build your own docker image:

Note: this approach is only necessary if you would like to build an older or very custom version of al-folio.

Build and run a new docker image using:

$ docker-compose -f docker-local.yml up

If you want to update jekyll, install new ruby packages, etc., all you have to do is build the image again using --force-recreate argument at the end of previous command! It will download ruby and jekyll and install all ruby packages again from scratch.


Local Setup (Standard)

Assuming you have Ruby and Bundler installed on your system (hint: for ease of managing ruby gems, consider using rbenv).

$ bundle install
$ bundle exec jekyll serve --lsi

Now, feel free to customize the theme however you like (don't forget to change the name!). After you are done, commit your final changes.


Deployment

Deploying your website to GitHub Pages is the most popular option. Starting version v0.3.5, al-folio will automatically re-deploy your webpage each time you push new changes to your repository! ✨

For personal and organization webpages:

  1. The name of your repository MUST BE <your-github-username>.github.io or <your-github-orgname>.github.io.
  2. In _config.yml, set url to https://<your-github-username>.github.io and leave baseurl empty.
  3. Set up automatic deployment of your webpage (see instructions below).
  4. Make changes, commit, and push!
  5. After deployment, the webpage will become available at <your-github-username>.github.io.

For project pages:

  1. In _config.yml, set url to https://<your-github-username>.github.io and baseurl to /<your-repository-name>/.
  2. Set up automatic deployment of your webpage (see instructions below).
  3. Make changes, commit, and push!
  4. After deployment, the webpage will become available at <your-github-username>.github.io/<your-repository-name>/.

To enable automatic deployment:

  1. Click on Actions tab and Enable GitHub Actions; do not worry about creating any workflows as everything has already been set for you.
  2. Go to Settings -> Actions -> General -> Workflow permissions, and give Read and write permissions to GitHub Actions
  3. Make any other changes to your webpage, commit, and push. This will automatically trigger the Deploy action.
  4. Wait for a few minutes and let the action complete. You can see the progress in the Actions tab. If completed successfully, in addition to the master branch, your repository should now have a newly built gh-pages branch.
  5. Finally, in the Settings of your repository, in the Pages section, set the branch to gh-pages (NOT to master). For more details, see Configuring a publishing source for your GitHub Pages site.

If you keep your site on another branch, open .github/workflows/deploy.yml on the branch you keep your website on and change on->push->branches and on->pull_request->branches to the branch you keep your website on. This will trigger the action on pulls/pushes on that branch. The action will then deploy the website on the branch it was triggered from.

(click to expand) Manual deployment to GitHub Pages:

If you need to manually re-deploy your website to GitHub pages, go to Actions, click "Deploy" in the left sidebar, then "Run workflow."

(click to expand) Deployment to another hosting server (non GitHub Pages):

If you decide to not use GitHub Pages and host your page elsewhere, simply run:

$ bundle exec jekyll build --lsi

which will (re-)generate the static webpage in the _site/ folder. Then simply copy the contents of the _site/ directory to your hosting server.

Note: Make sure to correctly set the url and baseurl fields in _config.yml before building the webpage. If you are deploying your webpage to your-domain.com/your-project/, you must set url: your-domain.com and baseurl: /your-project/. If you are deploying directly to your-domain.com, leave baseurl blank.

(click to expand) Deployment to a separate repository (advanced users only):

Note: Do not try using this method unless you know what you are doing (make sure you are familiar with publishing sources). This approach allows to have the website's source code in one repository and the deployment version in a different repository.

Let's assume that your website's publishing source is a publishing-source subdirectory of a git-versioned repository cloned under $HOME/repo/. For a user site this could well be something like $HOME/<user>.github.io.

Firstly, from the deployment repo dir, checkout the git branch hosting your publishing source.

Then from the website sources dir (commonly your al-folio fork's clone):

$ bundle exec jekyll build --lsi --destination $HOME/repo/publishing-source

This will instruct jekyll to deploy the website under $HOME/repo/publishing-source.

Note: Jekyll will clean $HOME/repo/publishing-source before building!

The quote below is taken directly from the jekyll configuration docs:

Destination folders are cleaned on site builds

The contents of <destination> are automatically cleaned, by default, when the site is built. Files or folders that are not created by your site will be removed. Some files could be retained by specifying them within the <keep_files> configuration directive.

Do not use an important location for <destination>; instead, use it as a staging area and copy files from there to your web server.

If $HOME/repo/publishing-source contains files that you want jekyll to leave untouched, specify them under keep_files in _config.yml. In its default configuration, al-folio will copy the top-level README.md to the publishing source. If you want to change this behavior, add README.md under exclude in _config.yml.

Note: Do not run jekyll clean on your publishing source repo as this will result in the entire directory getting deleted, irrespective of the content of keep_files in _config.yml.


Upgrading from a previous version

If you installed al-folio as described above, you can configure a GitHub action to automatically sync your repository with the latest version of the theme.

Go to Settings -> Actions -> General -> Workflow permissions, give Read and write permissions to GitHub Actions, check "Allow GitHub Actions to create and approve pull requests", and save your changes.

Then go to Actions -> New workflow -> set up a workflow yourself, setup the following workflow and commit your changes:

name: Sync from template
on:
    # cronjob trigger
  schedule:
  - cron:  "0 0 1 * *"
  # manual trigger
  workflow_dispatch:
jobs:
  repo-sync:
    runs-on: ubuntu-latest
    steps:
      # To use this repository's private action, you must check out the repository
      - name: Checkout
        uses: actions/checkout@v3
      - name: actions-template-sync
        uses: AndreasAugustin/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          source_repo_path: alshedivat/al-folio
          upstream_branch: master

You will receive a pull request within your repository if there are some changes available in the template.

Another option is to manually update your code by following the steps below:

# Assuming the current directory is <your-repo-name>
$ git remote add upstream https://github.com/alshedivat/al-folio.git
$ git fetch upstream
$ git rebase v0.9.0

If you have extensively customized a previous version, it might be trickier to upgrade. You can still follow the steps above, but git rebase may result in merge conflicts that must be resolved. See git rebase manual and how to resolve conflicts for more information. If rebasing is too complicated, we recommend re-installing the new version of the theme from scratch and port over your content and changes from the previous version manually.


FAQ

Here are some frequently asked questions. If you have a different question, please ask using Discussions.

  1. Q: After I create a new repository from this template and setup the repo, I get a deployment error. Isn't the website supposed to correctly deploy automatically?
    A: Yes, if you are using release v0.3.5 or later, the website will automatically and correctly re-deploy right after your first commit. Please make some changes (e.g., change your website info in _config.yml), commit, and push. Make sure to follow deployment instructions in the previous section. (Relevant issue: 209.)

  2. Q: I am using a custom domain (e.g., foo.com). My custom domain becomes blank in the repository settings after each deployment. How do I fix that?
    A: You need to add CNAME file to the master or source branch of your repository. The file should contain your custom domain name. (Relevant issue: 130.)

  3. Q: My webpage works locally. But after deploying, it is not displayed correctly (CSS and JS is not loaded properly). How do I fix that?
    A: Make sure to correctly specify the url and baseurl paths in _config.yml. Set url to https://<your-github-username>.github.io or to https://<your.custom.domain> if you are using a custom domain. If you are deploying a personal or organization website, leave baseurl blank. If you are deploying a project page, set baseurl: /<your-project-name>/.

  4. Q: Atom feed doesn't work. Why?
    A: Make sure to correctly specify the url and baseurl paths in _config.yml. RSS Feed plugin works with these correctly set up fields: title, url, description and author. Make sure to fill them in an appropriate way and try again.

  5. Q: My site doesn't work when I enable related_blog_posts. Why?
    A: This is probably due to the classifier reborn plugin, which is used to calculate related posts. If the error states Liquid Exception: Zero vectors can not be normalized..., it means that it could not calculate related posts for a specific post. This is usually caused by empty or minimal blog posts without meaningful words (i.e. only stop words) or even specific characters you used in your posts. Also, the calculus for similar posts are made for every post, which means every page that uses layout: post, including the announcements. To change this behavior, simply add related_posts: false to the front matter of the page you don't want to display related posts on.

Features

Publications

Your publications' page is generated automatically from your BibTex bibliography. Simply edit _bibliography/papers.bib. You can also add new *.bib files and customize the look of your publications however you like by editing _pages/publications.md.

(click to expand) Author annotation:

In publications, the author entry for yourself is identified by string array scholar:last_name and string array scholar:first_name in _config.yml:

scholar:
  last_name: [Einstein]
  first_name: [Albert, A.]

If the entry matches one form of the last names and the first names, it will be underlined. Keep meta-information about your co-authors in _data/coauthors.yml and Jekyll will insert links to their webpages automatically. The co-author data format in _data/coauthors.yml is as follows,

"Adams":
  - firstname: ["Edwin", "E.", "E. P.", "Edwin Plimpton"]
    url: https://en.wikipedia.org/wiki/Edwin_Plimpton_Adams

"Podolsky":
  - firstname: ["Boris", "B.", "B. Y.", "Boris Yakovlevich"]
    url: https://en.wikipedia.org/wiki/Boris_Podolsky

"Rosen":
  - firstname: ["Nathan", "N."]
    url: https://en.wikipedia.org/wiki/Nathan_Rosen

"Bach":
  - firstname: ["Johann Sebastian", "J. S."]
    url: https://en.wikipedia.org/wiki/Johann_Sebastian_Bach

  - firstname: ["Carl Philipp Emanuel", "C. P. E."]
    url: https://en.wikipedia.org/wiki/Carl_Philipp_Emanuel_Bach

If the entry matches one of the combinations of the last names and the first names, it will be highlighted and linked to the url provided.

(click to expand) Buttons (through custom bibtex keywords):

There are several custom bibtex keywords that you can use to affect how the entries are displayed on the webpage:

  • abbr: Adds an abbreviation to the left of the entry. You can add links to these by creating a venue.yaml-file in the _data folder and adding entries that match.
  • abstract: Adds an "Abs" button that expands a hidden text field when clicked to show the abstract text
  • arxiv: Adds a link to the Arxiv website (Note: only add the arxiv identifier here - the link is generated automatically)
  • bibtex_show: Adds a "Bib" button that expands a hidden text field with the full bibliography entry
  • html: Inserts an "HTML" button redirecting to the user-specified link
  • pdf: Adds a "PDF" button redirecting to a specified file (if a full link is not specified, the file will be assumed to be placed in the /assets/pdf/ directory)
  • supp: Adds a "Supp" button to a specified file (if a full link is not specified, the file will be assumed to be placed in the /assets/pdf/ directory)
  • blog: Adds a "Blog" button redirecting to the specified link
  • code: Adds a "Code" button redirecting to the specified link
  • poster: Adds a "Poster" button redirecting to a specified file (if a full link is not specified, the file will be assumed to be placed in the /assets/pdf/ directory)
  • slides: Adds a "Slides" button redirecting to a specified file (if a full link is not specified, the file will be assumed to be placed in the /assets/pdf/ directory)
  • website: Adds a "Website" button redirecting to the specified link
  • altmetric: Adds an Altmetric badge (Note: if DOI is provided just use true, otherwise only add the altmetric identifier here - the link is generated automatically)
  • dimensions: Adds a Dimensions badge (Note: if DOI or PMID is provided just use true, otherwise only add the Dimensions' identifier here - the link is generated automatically)

You can implement your own buttons by editing the bib.html file.


Collections

This Jekyll theme implements collections to let you break up your work into categories. The theme comes with two default collections: news and projects. Items from the news collection are automatically displayed on the home page. Items from the projects collection are displayed on a responsive grid on projects page.

You can easily create your own collections, apps, short stories, courses, or whatever your creative work is. To do this, edit the collections in the _config.yml file, create a corresponding folder, and create a landing page for your collection, similar to _pages/projects.md.


Layouts

al-folio comes with stylish layouts for pages and blog posts.

The iconic style of Distill

The theme allows you to create blog posts in the distill.pub style:

For more details on how to create distill-styled posts using <d-*> tags, please refer to the example.

Full support for math & code

al-folio supports fast math typesetting through MathJax and code syntax highlighting using GitHub style:

Photos

Photo formatting is made simple using Bootstrap's grid system. Easily create beautiful grids within your blog posts and project pages:


Other features

GitHub's repositories and user stats

al-folio uses github-readme-stats and github-profile-trophy to display GitHub repositories and user stats on the /repositories/ page.

Edit the _data/repositories.yml and change the github_users and github_repos lists to include your own GitHub profile and repositories to the /repositories/ page.

You may also use the following codes for displaying this in any other pages.

<!-- code for GitHub users -->
{% if site.data.repositories.github_users %}
<div class="repositories d-flex flex-wrap flex-md-row flex-column justify-content-between align-items-center">
  {% for user in site.data.repositories.github_users %}
    {% include repository/repo_user.html username=user %}
  {% endfor %}
</div>
{% endif %}

<!-- code for GitHub trophies -->
{% if site.repo_trophies.enabled %}
{% for user in site.data.repositories.github_users %}
  {% if site.data.repositories.github_users.size > 1 %}
  <h4>{{ user }}</h4>
  {% endif %}
  <div class="repositories d-flex flex-wrap flex-md-row flex-column justify-content-between align-items-center">
  {% include repository/repo_trophies.html username=user %}
  </div>
{% endfor %}
{% endif %}

<!-- code for GitHub repositories -->
{% if site.data.repositories.github_repos %}
<div class="repositories d-flex flex-wrap flex-md-row flex-column justify-content-between align-items-center">
  {% for repo in site.data.repositories.github_repos %}
    {% include repository/repo.html repository=repo %}
  {% endfor %}
</div>
{% endif %}

Theming

A variety of beautiful theme colors have been selected for you to choose from. The default is purple, but you can quickly change it by editing the --global-theme-color variable in the _sass/_themes.scss file. Other color variables are listed there as well. The stock theme color options available can be found at _sass/variables.scss. You can also add your own colors to this file assigning each a name for ease of use across the template.

Social media previews

al-folio supports preview images on social media. To enable this functionality you will need to set serve_og_meta to true in your _config.yml. Once you have done so, all your site's pages will include Open Graph data in the HTML head element.

You will then need to configure what image to display in your site's social media previews. This can be configured on a per-page basis, by setting the og_image page variable. If for an individual page this variable is not set, then the theme will fall back to a site-wide og_image variable, configurable in your _config.yml. In both the page-specific and site-wide cases, the og_image variable needs to hold the URL for the image you wish to display in social media previews.

Atom (RSS-like) Feed

It generates an Atom (RSS-like) feed of your posts, useful for Atom and RSS readers. The feed is reachable simply by typing after your homepage /feed.xml. E.g. assuming your website mountpoint is the main folder, you can type yourusername.github.io/feed.xml

Related posts

By default, there will be a related posts section on the bottom of the blog posts. These are generated by selecting the max_related most recent posts that share at least min_common_tags tags with the current post. If you do not want to display related posts on a specific post, simply add related_posts: false to the front matter of the post. If you want to disable it for all posts, simply set enabled to false in the related_blog_posts section in _config.yml.

Contributing

Contributions to al-folio are very welcome! Before you get started, please take a look at the guidelines.

If you would like to improve documentation, add your webpage to the list below, or fix a minor inconsistency or bug, please feel free to send a PR directly to master. For more complex issues/bugs or feature requests, please open an issue using the appropriate template.

Maintainers

Our most active contributors are welcome to join the maintainers team. If you are interested, please reach out!


Maruan

Rohan Deb Sarkar

Amir Pourmand

George

License

The theme is available as open source under the terms of the MIT License.

Originally, al-folio was based on the *folio theme (published by Lia Bogoev and under the MIT license). Since then, it got a full re-write of the styles and many additional cool features.

gocompa's People

Contributors

minkiminki avatar

Stargazers

 avatar  avatar

Watchers

 avatar

gocompa's Issues

array 관련

datatype array는 스택에 저장되어 있지 않고, 값 static하게 결정되어 있다. 컴파일 타임에 이 값을 옮긴다(lea instruction으로).

반면 datatype pointer는 실제 array의 첫 주소 값을 담고 있다.

array 변수는 register allocation할 필요가 없다. 이를 위한 패치를 했다(dead store elimination은 여전히 할 수 있다). ad22981

한편, pointer 값 중 lea 연산으로 정해지는 것들은 static하게 무슨 값인지 알 수 있다. 이것으로 constant propagation을 하는 것을 생각해볼 수 있다.
그런데 이것은 몇몇 어려운 점이 있다.

  1. stack offset 값이 전부 결정된 다음에야 알 수 있다. 따라서 꽤나 컴파일 뒷부분에서 진행되어야 한다.
  2. 아낄 수 있는 것이 lea 한번씩이다. 이득이 너무 적다.

따라서 이런 최적화는 진행하지 않기로 하였다.

TODO list

프로포절

  1. x86-64로 확장
  • 인스트럭션 바꾸기
    • pointer의 size 바꾸기
    • case에 8바이트 추가하기
    • 인스트럭션 바꾸기
  • calling convention
    • param 인스트럭션 컴파일 수정 (장기적으로는 register allocation과 조합해서)
    • callee save 추가, 모듈화시키기
    • caller save 추가
  1. ir 확장
  • ir 확장한 새 클래스 정의, 분석 정보 담을 것임
    • instruction에 변수 liveness 정보 담을 수 있게
  • tail call instruction 추가
    • enum에 안 쓰인 숫자 쓰기
  • 변수에 스택 위치뿐만 아니라 레지스터 정보 담을 수 있게
    • 피연산자가 register에 있을 경우 다르게 처리하도록 바꾸기
  • codeblock에 basic block 정보 담기
    • block table 추가하기 - 각 block은 들어오는 블록, 나가는 블록, 그리고 시작점과 끝 인스트럭션 정보 담음
    • 각 인스트럭션에 소속 블록 정보 담기
  1. 분석
  • basic block 분석
    • TODO!!
  • tail call 분석
    • tail call 가능 여부
      • 인자 개수랑 type만 보고 결정
    • tail call 위치에 있는지 여부
      • 각 return마다 그 바로 위에 call이 있는지 확인
  • liveness
    • TODO!!
  1. tail call
  • tail call instruction으로 바꾸기
  • tail call compile 추가
  1. register allocation
  1. inlining
  • TODO!!
  1. coverting to SSA
  • TODO!!

parameter 관련 버그

원래 snuplc는 함수 인자를 계산하는 중에 함수 호출이 있을 수 있었다.
이것이 인자를 스택에만 넘길 때는 문제가 없는데 우리는 레지스터에도 담기 때문에 뒤의 함수를 부를 때 앞의 인자가 덮어 씌워지는 문제가 있다. 866d645

매번 인자를 임시 변수에 담았다가 콜 직전에 전부 옮기도록 바꾸면 해결된다.
7e4eeb7 에서 완료

x86_64 extension

인스트럭션 바꾸기

  • pointer의 size 바꾸기
  • case에 8바이트 추가하기
  • 인스트럭션 바꾸기

calling convention

  • param 인스트럭션 컴파일 수정 (장기적으로는 register allocation과 조합해서)
  • callee save 추가, 모듈화시키기
  • caller save 추가

남은 할 일

  1. register allocation 결과 이용하여 실제로 register에 할당시키기 => 완료 a5330b9
  2. #16 (comment) 에서 말한 pointer에 대한 constant propagation
  3. subexpression 최적화 + array의 값에 대한 peephole optimization

그 외 마이너한 것들

  1. callee save register 저장을 사용하지 않은 레지스터에 대해서는 안 하게 만들기
    => 완료 dbb9352
  2. #22 대로 수정하면서 tail call optimization이 덜 공격적으로 작동한다. 제대로 동작하게 수정하기
    => 완료 2c1f97e
  3. tail call 중 tail recursion은 loop로 바꾸는 최적화
  4. 필요 이상의 mov 지우기, opGetParam 효율적으로 컴파일 바꾸기
    =>완료 eb87de1

비트셋 연산

집합에 대한 and, or를 연산할 필요가 많다. 이를 bit set에 대한 bitwise 연산으로 처리하려 한다.

  • std::bitset은 크기를 dynamic하게 할 수 없다.
  • std::vector<bool>는 일반 vector와 다르게 bitset처럼 최적화가 잘 된듯 하고 dynamic하게 크기를 정할 수 있지만 bitwise 연산이 안 정의되어 있는듯 하다.
  • boost의 dynamic bitset 라이브러리 - bitwise 연산, dynamic한 크기 모두 지원!!

-> boost의 dynamic_bitset으로 가자

operation 관련 버그 모음

보고서 쓸 때 자료를 남겨두면 편할 것 같아서 만들음. 생기고 해결할 때마다 댓으로 달 예정.

precolored register

레지스터를 고려할 상황이 여럿 있다.

  1. callee save register
    고려하지 않고 register allocation을 한다. 그리고 callee save가 필요한 경우만 push, pop을 한다.

  2. caller save register
    call 인스트럭션을 실행할 때 caller save register들이 죽어있는 것으로 처리한다. 구체적으로는 call instruction 때에만 살아있는 임시 변수를 추가한다.

  3. 받은 parameter
    TODO 어렵다...
    처음에 parameter 변수로 옮기는 instruction을 추가하는 것이 가장 쉬워보인다.
    => opGetParam이라는 instruction 추가해서 완료 d923ad1

  4. 보낼 parameter
    call 전까지 살아 있는 임시변수(1)와, caller save register처럼 call 때만 차지하는 임시변수(2)를 추가한다. 또한 parameter에 넣는 변수는 (1)과 coalescing될 수 있다.
    이대로 구현은 아직 안 했음

  5. 함수 부른 뒤 return 값
    rax를 비워두고 있으므로 문제 없음(이슈 참조)

  6. 함수 끝낼 때 return 값
    rax를 비워두고 있으므로 문제 없음

  7. 특정 register를 사용해야 하는 연산
    항상 rax와 rdx를 비워두고 여기에 옮겨서 연산을 할 것

  8. 연산을 할 때 비어있어야 하는 레지스터
    항상 rax와 rdx를 비워두고 여기에 옮겨서 연산을 할 것이므로 문제 없음

Register Allocation 계획

연산마다 레지스터가 하나씩은 필요하다. 그것을 어떻게 표현할지?
두가지 방법이 가능

  1. 각 연산마다 임시 레지스터를 둔다. 이것은 메모리에 들어갈 수 없다.
  • 장점 : 그래프 컬러링 알고리즘이 잘 작동할 경우 필요한 레지스터 개수를 최소화 할 수 있다.
  • 단점 : coalescing 알고리즘이 좋지 않다면 좋지 않은 결과를 낼 수도 있다.
  1. 하나의 레지스터는 항상 비워둔다.
  • 장점 : 간단하다. 그래프 컬러링 알고리즘의 성능이 안 좋다면 이게 더 좋을 수 있다.
  • 단점 : 잘 작동한다면 1이 완벽한 방법이다.

결국 문제는 그래프 컬러링 알고리즘이 얼마나 잘 작동하냐이다. 일단 무난하게 2번으로?

구현할 최적화

  1. tail call optimization
  • 구현 끝
  1. register allocation
  • 열심히 하자...
  1. function inlining
  • 쉬울 것

위가 처음 계획. 아래는 추가로 해볼 수 있을 것들

  1. constant propagation
  • 안 어려울 듯?
  1. dead code elimination
  • liveness 분석이 되면 날로 먹는 최적화
  1. subexpression analysis
  • 이것도 안 어려울 듯?

x86_64 extension

인스트럭션 바꾸기

  • pointer의 size 바꾸기
  • case에 8바이트 추가하기

calling convention

  • param 인스트럭션 컴파일 수정 (장기적으로는 register allocation과 조합해서)
  • callee save 추가, 모듈화시키기
  • caller save 추가

ssa 분석을 global variable에 대해서도?

지금은 global variable에 대해서는 ssa 분석과 모든 최적화를 포기한다.
그런데 global variable에 대해서도 ssa 분석을 할 경우 constant propagation, subexpression 최적화는 가능할 것으로 보인다.
이 경우 register allocation에서는 제외된다. 또한 다른 함수를 부를 경우는 글로벌 변수의 값은 전부 새로 쓴다(함수가 건드리는 글로벌 변수들을 추적해서 활용하는 더 잘 최적화하는 방법도 있다).

조금 더 공격적으로, write가 두 번 있을 경우 하나로 합치는 것을 고려할 수 있다.

prologue, epilogue 없애기

prologue에서 하는 일:

  1. stack 주소 수정
  2. callee save register
  3. parameter 스택에 넣기
  4. clear stack
  5. initialize local array
    1은 필수. 2와 3은 레지스터에서 임시 변수로 옮기는 것으로 대체 가능. 4와 5는 안 해도 될듯?

epilogue에서 하는 일:

  1. stack 주소 수정
  2. callee save register
    1은 필수. 2는 위와 마찬가지.

prologue, epilogue에서 stack 주소 수정만 하게 만들기?!

snuplc backend는 코드의 맨 앞에 prologue를 넣고 마지막에 epilogue를 넣는다. return은 epilogue 지점으로 가는 goto로 컴파일 된다.

현재 initial basic block은 하나만 있을 수 있고 이것의 부모는 없다. prologue의 1, 2, 3 위치는 여기에 넣어도 된다.
final basic block은 여럿이 있을 수 있다. final block의 자식은 없다. 각 final block의 뒤에 epilogue의 2를 넣고 원래의 epilogue에서는 stack 주소만 수정하는 방법도 가능.

reports

I am quite happy with your work and effort and a bit less happy with the absence of the reports. Where can I find them? thx

Register Allocation

  1. liveness 분석
  • TODO!!
  • 인자로 넘어갈 값, 리턴값은 마지막에 live여야 한다, 인자로 넘어온 값은 처음에 정의가 되어있다고 생각
  1. precoloring
  • 연산은 모두 register에서만 되도록
    • 각 연산에 모두 레지스터에 넘기는 부분을 하나씩 추가하면 될듯
  • 받는 인자, 넘기는 인자와 리턴 값은 위치 정해지게
    위치 정해진 것은 live 범위가 전체
  • callee save를 어떻게 처리할지
    • 처음에 callee save reigster를 전부 다른 곳에 저장한 뒤 마지막에 넣는걸로
    • coalescing이 잘 된다면 위의 것으로 충분할 것임
  1. coalescing
  • TODO!!
  • move 연산은 특수하게 다루어서 두 결과물 모두 같은 레지스터에 들어갈 수 있게, 그리고 잘 그래지게 하기
  1. spilling
  • TODO!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.