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 ...
随机推荐
- 每天一个linux常用命令--ls 和 -ll 有什么区别?
一.-ls 和 -ll 有什么区别? 1. ls 命令可以说是linux下最常用的命令之一.ll不是命令,是ls -l的别名相当于windows里的快捷方式.所以"ll"和“ls ...
- (转)关于SimpleDateFormat安全的时间格式化线程安全问题
想必大家对SimpleDateFormat并不陌生.SimpleDateFormat 是 Java 中一个非常常用的类,该类用来对日期字符串进行解析和格式化输出,但如果使用不小心会导致非常微妙和难以调 ...
- js中的经典案例--简易万年历
js中的经典案例--简易万年历 html代码 <!DOCTYPE html> <html> <head> <meta charset="utf-8& ...
- 1.Jmeter 快速入门教程(一) - 认识jmeter和google插件
Jmeter是免费开源的性能测试工具( 同时也可以用作功能测试,http协议debug工具 ). 在如今越来越注重知识产权的今天, 公司越来越不愿意冒着巨大的风险去使用盗版的商业性能测试工具. 但如 ...
- 解决本地工具无法连接服务器上的mysql的问题
当本地工具尝试连接服务器的时候,如果出现无法连接的情况,可能是权限没有开. 首先: mysql> show databases: 发现有mysql数据库 进入该数据库,找到user表 mysq ...
- Linux中通过grep命令检索文件内容和指定内容前后几行
原文链接: https://www.linuxidc.com/Linux/2017-11/148390.htm Linux系统中搜索.查找文件中的内容,一般最常用的是grep命令,另外还有egrep命 ...
- 【转】CentOS 7.3 从下载到安装
CentOS 7.3 从下载到安装 https://blog.csdn.net/sxy2475/article/details/75194142 [百度知道]图解CentOS 7.3安装步骤 ht ...
- getopts的注意事项
- size - 列出段节大小和总共大小
总览 (SYNOPSIS) size [-A|-B|--format=compatibility] [--help] [-d|-o|-x|--radix=number] [--target=bfdna ...
- setquota - 设置磁盘配额或时间限制
SYNOPSIS(总览) setquota [ -u | -g ] filesystem-name block-soft block-hard inode-soft inode-hard name.. ...