Coder Social home page Coder Social logo

llvm-learn's Introduction

llvm-learn

learn llvm ir pass and someothers if needed

一些编译选项

-enable-new-pm=0
-fno-discard-value-names

LLVM IR

@/% 意义

@ 全局变量符号 % 局部变量符号

extern int a;
extern int b;

@a = external global i32, align 4
@b = external global i32, align 4

int a;
int b;
@a = global i32, align 4
@b = global i32, align 4

IR 数据类型

i32 int32 int i1 int1 bool

常用IR

alloca  : 分配栈空间变量
%retval = alloca i32, align 4

load    : 栈空间变量赋值,load a from b (<-)
%0 = load i32, ptr @a, align 4

store   : 栈空间变量赋值,store a to b (->)
store i32 %2, ptr %retval, align 4


cmp     : 比较指令
%cmp = icmp slt i32 %0, %1


br      : 跳转指令
(条件跳转)
br i1 %cmp, label %if.then, label %if.else

(无条件br)
 br label %return

LLVM IR CFG (control flow graph)

llvm tool-chains

探索LLVM生成的IR控制流

IF CFG of LLVM IR

IF-ELSE CFG of LLVM IR

IF-ELSE-IF CFG of LLVM IR

SWTICH CFG of LLVM IR

FOR CFG of LLVM IR

实用链接

控制流图(Control Flow Graph)-(CFG)

LLVM IR入门指南 LLVM IR入门指南(5)——控制语句

问题记录

llvm5 编译报错

llvm-learn's People

Contributors

hpuedcslearner avatar

Watchers

 avatar

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.