惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
小众软件
小众软件
The Cloudflare Blog
博客园 - 【当耐特】
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Visual Studio Blog
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
美团技术团队
S
SegmentFault 最新的问题
宝玉的分享
宝玉的分享
博客园 - 叶小钗
月光博客
月光博客
Apple Machine Learning Research
Apple Machine Learning Research
T
Tailwind CSS Blog
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks
Y
Y Combinator Blog
D
Docker
Microsoft Azure Blog
Microsoft Azure Blog

Chino's Studio

LLVM Backend Practices - Part 1 · Mars Studio How to support debug on GPU 一篇不知道多久前翻译的译文--30年之后,QBasic依然是最棒的编程启蒙语言 · Mars Studio REPL技术分析——Python的交互式 · Mars Studio REPL技术分析——Swift REPL模式 · Mars Studio 基于Hexo和github page搭建个人博客 · Mars Studio
Instruction Selection In LLVM · Mars Studio
Chino Mars · 2022-03-16 · via Chino's Studio

Instruction Selection In LLVM

Instruction Selection Method

  • FastISel
  • SelectionDAGISel
  • GlobalISel

related hooks, like how to specify which isel method to use

  • in TargetConfig::addCoreISelPasses will choose a valid isel method

FastISel

  • llvm ir based
  • fast
  • used in O0

workflow

llvm ir -> machine instruction with virtual register

how to impl

  1. define a class inherit from FastISel
  2. override a virtual function fastSelectInstruction, then emit each opcode in llvm ir which is target dependent

SelectionDAG based ISel

  • should lowering to DAG first from llvm ir
  • will do several times legalize and combine in instruction selecting, includes:
    • type legalize then combine
    • vector legalize then combine
    • dag legalize then combine
  • will do heuristic schdeule on DAG after selected to MachineDAG

workflow

llvm ir -> lowering to DAG -> initialize DAG -> combine -> type legalize and combine -> vector legalize and type legalize and combine -> dag legalize and combine -> insturction selection -> instruction scheduling(will introduce later)

how to impl

  1. define a class inherit from SelectionDAGISel
  2. override the entry of selection isel Select()
  3. override most of all selectXXX virtual function to select instruction, usually named as <TargetName>DAGToDAGISel()

what is lowering

lowering define some legalization info and other rules for DAG builder when SelectionDAG is initialized

GlobalISel

TODO