删除指令时断言 [英] Assertions when removing an instruction

查看:221
本文介绍了删除指令时断言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们给出了一个简单的赋值:使用Phoenix中的SSA信息检测具有无用途的目标操​​作数的指令,并删除这些赋值。此作业最初是使用较旧版本的Phoenix SDK(2006年5月)进行的,从那时起一些事情发生了变化。即使在我们的解决方案中进行了所有名称更改之后,断言仍然存在。当在垃圾分配指令上调用Remove()方法时,我们得到一个Phoenix断言:



ir_constructor.cpp第40行:!操作数 - > IsInSsa



2006年5月SDK这是ir_ctor.cpp,但断言也存在。我们刚刚告诉学生们忽略它,现在可以做同样的事情,但学生忽略断言令人不安,所以我们希望学习如何正确地删除指令。


< p align = left>


这是一个在SimpleRegisterVariableDetection之后运行的C2阶段。



感谢有关删除此类指令的任何信息。我们需要先清理一下吗?在remove()之前删除SsaInfo,然后立即再次构建它?


解决方案

您有两个选择。您可以(1)识别构建SSA时要执行的工作,然后拆除SSA,然后删除指令,或(2)使用SSA包进行增量编辑。



要做后者,请执行以下操作:






代码片段


A simple assignment we have given to our class: Detect instructions with a destination operand that has no uses, using the SSA information in Phoenix, and remove those assignments. This assignment was originally given with an older version of the Phoenix SDK (May, 2006) and some things have changed since then. Even after making all the name changes in our solution, an assertion persists. When the Remove() method is called on the junk assignment instruction, we get a Phoenix assertion along the lines of:

 

ir_constructor.cpp line 40:  !Operand->IsInSsa

 

In the May 2006 SDK this was ir_ctor.cpp but the assertion was present then, also. We just told students to ignore it back then, and could do the same thing now, but it is disconcerting to the students to ignore assertions, so we would appreciate learning how to remove an instruction properly.

 

This is a C2 phase that runs after SimpleRegisterVariableDetection.

 

Thanks for any info on removing such an instruction. Do we need to clean something up first? Delete the SsaInfo before the remove(), then build it again immediately afterwards?

 

解决方案

You have two choices. You can (1) identify the work to do when SSA is built, then tear down SSA, and then delete the instructions, or (2) use the SSA package to do incremental edits.

 

To do the latter, do something like the following:

 

Code Snippet


这篇关于删除指令时断言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆