网站大量收购闲置独家精品文档,联系QQ:2885784924

复旦大学软件学院计算机系统课件 Machine-Level Representation of Programs III.ppt

复旦大学软件学院计算机系统课件 Machine-Level Representation of Programs III.ppt

  1. 1、本文档共30页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Compilers Autumn 2002 Compilers Autumn 2002 * Machine-Level Representation of Programs III * Outline Jump instructions Translate Control constructs in C to assembly goto branch loop Suggested reading Chap 3.6 * Control Two of the most important parts of program execution Data flow (Accessing and operating data) Control flow (control the sequence of operations) * Control Sequential execution is default the instructions are executed in the order they appear in the program Chang the control flow Jump instructions * Jump Instructions 1 xorl %eax, %eax Set %eax to 0 2 jmp .L1 Goto .L1 3 movl (%eax), %edx Null pointer dereference 4 .L1: 5 popl %edx * Unconditional jump Jumps unconditionally Direct jump: jmp label jmp .L Indirect jump: jmp *Operand jmp *%eax jmp *(%eax) * Conditional jump Either jump or continue executing at the next instruction in the code sequence Depending on some combination of the condition codes All direct jump * Jump Instructions jle .L2 .L5: movl %edx, %eax sarl $1, %eax subl %eax, %edx Leal (%edx, %edx, 2), %edx testl %edx, %edx jg .L5 9 .L2: 10 movl %edx, %eax * 8: 7e 0d jle 17silly+0x17 a: 89 d0 mov %edx, %eax dest1: 3 c: c1 f8 sar %eax e: 29 c2 sub %eax, %edx 10: 8d 14 52 lea (%edx, %edx, 2), %edx 6 13: 85 d2 test %edx, %edx 15: 7f f3 jg asilly+0x10 17: 89 d0 movl %edx, %eax dest2: d+a = 17 17+f3(-d) =a Example for Jump * 804839c: 7e 0d jle 17silly+0x17 804839e: 89 d0 mov %edx, %eax dest1: 3 80483a0: c1 f8 sar %eax 80483a2: 29 c2 sub %eax, %edx 80483a4: 8d 14 52 lea (%edx, %edx, 2), %edx 6 80483a7: 85 d2 test %edx, %edx 80483a9: 7f f3 jg asilly+0x10 80483ab: 89 d0 movl %edx, %eax dest2: d+804849e = 80483ab 80483ab+f3(-d) = 804839e Example for Jump * Jump Instructions PC-relative Jump target is an offset relative to the address of the i

文档评论(0)

ormition + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档