VEX IR语言语法
/*---------------------------------------------------------------*/
/*--- High-level IR description ---*/
/*---------------------------------------------------------------*/
/* Vex IR is an architecture-neutral intermediate representation.
Unlike some IRs in systems similar to Vex, it is not like assembly
language (ie. a list of instructions). Rather, it is more like the
IR that might be used in a compiler.
相对汇编语言,VEX IR更像是Compiler的中间语言
Code blocks
~~~~~~~~~~~
The code is broken into small code blocks ("superblocks", type:
'IRSB'). Each code block typically represents from 1 to perhaps 50
instructions. IRSBs are single-entry, multiple-exit code blocks.
Each IRSB contains three things:
单入口,多出口的代码块,与Intel Pin中的Trace级别相仿
- a type environment, which indicates the type of each temporary
value present in the IRSB
【实例:】
(*ir_block).tyenv
-types
-[0] Ity_I32
-[1] Ity_I32
-types_size 0x00000008
-types_used 0x00000002
types_used提示有多少个Temp变量被使用,types数组里面分别保存着每个Temp变量的类型
- a list of statements, which represent code
【实例:】
stmts_size 0x00000003 int
stmts_used 0x00000003 int
- (*ir_block).stmts[]
tag Ist_IMark
- (*ir_block).stmts[]
tag Ist_WrTmp
- (*ir_block).stmts[]
tag Ist_Put
Statements也是保存在stmts数组中,stmts_used代表实际上使用的Statements的数目
- a jump that exits from the end the IRSB
【实例:】
jumpkind Ijk_Boring
最后打印出来的结果如下
0x77D699A0: movl %esi,%esp
IRSB {
t0:I32 t1:I32 【2个Temp变量】
------ IMark(0x77D699A0, , ) ------ 【3个Statements,包含IMark,但是没有包含最后一条,因为它是对于IP寄存器操作的,是自动的】
t0 = GET:I32() 【整条是一个Statements,而GET:I32()是Expression】
PUT() = t0
PUT() = 0x77D699A2:I32; exit-Boring
其中, 第二条Statements可以继续分解
- (*ir_block).stmts[]
tag Ist_WrTmp
.tmp 0
.tag Iex_Get
.offset
.ty Ity_I32
Because the blocks are multiple-exit, there can be additional
conditional exit statements that cause control to leave the IRSB
before the final exit. Also because of this, IRSBs can cover
multiple non-consecutive sequences of code (up to 3). These are
recorded in the type VexGuestExtents (see libvex.h).
Statements and expressions
~~~~~~~~~~~~~~~~~~~~~~~~~~
Statements (type 'IRStmt') represent operations with side-effects,
eg. guest register writes, stores, and assignments to temporaries.
Expressions (type 'IRExpr') represent operations without
side-effects, eg. arithmetic operations, loads, constants.
Expressions can contain sub-expressions, forming expression trees,
eg. (3 + (4 * load(addr1)).
Statements可以有Side-Effects,但是Expressions是Pure的,没有副作用的。
ST代表从寄存器到内存的数据转移, LD代表从内存到寄存器转移数据
Expression的类型
typedef
enum {
Iex_Binder=0x15000,
Iex_Get,
Iex_GetI,
Iex_RdTmp,
Iex_Qop,
Iex_Triop,
Iex_Binop,
Iex_Unop,
Iex_Load,
Iex_Const,
Iex_Mux0X,
Iex_CCall
}
IRExprTag;
Statements的类型
typedef
enum {
Ist_NoOp=0x19000,
Ist_IMark, /* META */
Ist_AbiHint, /* META */
Ist_Put,
Ist_PutI,
Ist_WrTmp,
Ist_Store,
Ist_CAS,
Ist_LLSC,
Ist_Dirty,
Ist_MBE, /* META (maybe) */
Ist_Exit
}
IRStmtTag;
VEX IR语言语法的更多相关文章
- Go语言语法汇总(转)
Go语言语法汇总 分类: 技术2013-09-16 14:21 3007人阅读 评论(0) 收藏 举报 go语言golang并发语法 目录(?)[+] 最近看了看GoLang,把Go语言的语法 ...
- C语言语法笔记 – 高级用法 指针数组 指针的指针 二维数组指针 结构体指针 链表 | IT宅.com
原文:C语言语法笔记 – 高级用法 指针数组 指针的指针 二维数组指针 结构体指针 链表 | IT宅.com C语言语法笔记 – 高级用法 指针数组 指针的指针 二维数组指针 结构体指针 链表 | I ...
- R语言语法基础二
R语言语法基础二 重塑数据 增加行和列 # 创建向量 city = c("Tampa","Seattle","Hartford"," ...
- R语言语法基础一
R语言语法基础一 Hello world #这里是注释 myString = "hello world" print(myString) [1] "hello world ...
- L脚本语言语法手冊 0.10版
L脚本语言语法手冊 0.10版 简 介 L脚本语言是一个轻量级的,旨在接近自然语言的编程语言,眼下支持在中文.英文基础上的编程.并可扩展为随意语种.L脚本语言的语法结构简单.程序结构相对 ...
- 嵌入式C语言自我修养 01:Linux 内核中的GNU C语言语法扩展
1.1 Linux 内核驱动中的奇怪语法 大家在看一些 GNU 开源软件,或者阅读 Linux 内核.驱动源码时会发现,在 Linux 内核源码中,有大量的 C 程序看起来“怪怪的”.说它是C语言吧, ...
- Go语言语法说明
Go语言语法说明 go语言中的go func(){}() 表示以并发的方式调用匿名函数func 深入讲解Go语言中函数new与make的使用和区别 前言 本文主要给大家介绍了Go语言中函数new与ma ...
- PL真有意思(二):程序设计语言语法
前言 虽然标题是程序语言的语法,但是讲的是对词法和语法的解析,其实关于这个前面那个写编译器系列的描述会更清楚,有关语言语法的部分应该是穿插在整个设计当中的,也看语言设计者的心情了 和英语汉语这些自然语 ...
- Neo4j-Cypher语言语法
Neo4j-Cypher语言语法 梦飞扬 2018-03-15 264 阅读 Neo4j 本文是记录Neo4j图数据库中实用的Cypher语言语法. Cypher是什么 "Cypher&qu ...
随机推荐
- Objective-C Properties 详解
关于Objective-C 的property,很多iOS开发的新手都会很迷惑,也会包括有经验的iOS开发程序员, 因为Objective-C的property,说多不多,说少却也不少,从MRR(Ma ...
- python zip 压缩
zipfile zip文件操作 引入模块: import zipfile zip文件格式是通用的文档压缩标准,在ziplib模块中,使用ZipFile类来操作zip文件,下面具体介绍一下: zipfi ...
- 搭建邮件服务器 使用Postfix与Dovecot
首先需要从yum中下载安装三个服务:bind-chroot postfix dovecot 配置文件依次: /etc/named.conf 下载安装完后要开启的服务:named ...
- Dubbo 系列(07-5)集群容错 - Mock
Dubbo 系列(07-5)集群容错 - Mock [toc] Spring Cloud Alibaba 系列目录 - Dubbo 篇 1. 背景介绍 相关文档推荐: Dubbo 实战 - 服务降级 ...
- Ubuntu下配置了ssh,但是连接很慢
ssh登录服务器时总是要停顿等待一下才能连接上,这是因为OpenSSH服务器有一个DNS查找选项UseDNS默认是打开的. UseDNS选项打开状态下,当客户端试图登录OpenSSH服务器时,服务器端 ...
- HTML中的img标签属性
<img>标签 标签用于插入图片.它是单独使用的,没有闭合标签. <img src="https://fakeimg.pl/350x200/ff0000,128/000,2 ...
- STM8硬件设计注意事项
1.中断 STM8的外部中断和STM32不一样,每个端口PX只有1个中断 2.ADC 1)Additional AIN12 analog input is not selectable in ADC ...
- go语言从例子开始之Example2.类型
Go 拥有各值类型,包括字符串,整形,浮点型,布尔型等.下面是一些基本的例子. Example: values.go package main import "fmt" func ...
- IDA技巧
3. 用[shift+F12]调出字符串表,再根据这些字符串,查看引用的地方,也可以分析出一些sub_0XXXX函数的功能. 进入import函数内 x查看调用处 jump to xref 跳到引用 ...
- 力扣—gray code (格雷编码) python实现
题目描述: 中文: 格雷编码是一个二进制数字系统,在该系统中,两个连续的数值仅有一个位数的差异. 给定一个代表编码总位数的非负整数 n,打印其格雷编码序列.格雷编码序列必须以 0 开头. 英文: Th ...