simple.cpp.expectation 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. ===== AST after parser =====
  2. f(cond1, cond2):
  3. TreeList
  4. IfBranch
  5. UnresolvedReference cond1
  6. TreeList
  7. BinaryOperation Declaration
  8. UnresolvedReference a
  9. MathematicalConstant 1
  10. IfBranch
  11. UnresolvedReference cond2
  12. TreeList
  13. BinaryOperation Declaration
  14. UnresolvedReference b
  15. UnresolvedReference a
  16. ElseIfBranch Else
  17. TreeList
  18. BinaryOperation Declaration
  19. UnresolvedReference b
  20. MathematicalConstant 3
  21. ElseIfBranch Else
  22. TreeList
  23. BinaryOperation Declaration
  24. UnresolvedReference b
  25. MathematicalConstant 4
  26. ReturnNode
  27. UnresolvedReference b
  28. ===== AST after if-branch-merging =====
  29. f(cond1, cond2):
  30. TreeList
  31. IfElseIfChain
  32. UnresolvedReference cond1
  33. TreeList
  34. BinaryOperation Declaration
  35. UnresolvedReference a
  36. MathematicalConstant 1
  37. IfElseIfChain
  38. UnresolvedReference cond2
  39. TreeList
  40. BinaryOperation Declaration
  41. UnresolvedReference b
  42. UnresolvedReference a
  43. TreeList
  44. BinaryOperation Declaration
  45. UnresolvedReference b
  46. MathematicalConstant 3
  47. TreeList
  48. BinaryOperation Declaration
  49. UnresolvedReference b
  50. MathematicalConstant 4
  51. ReturnNode
  52. UnresolvedReference b
  53. ===== AST after reference-resolving =====
  54. f(cond1, cond2):
  55. TreeList
  56. IfElseIfChain
  57. Var cond1
  58. TreeList
  59. BinaryOperation Assignment
  60. Var a
  61. MathematicalConstant 1
  62. IfElseIfChain
  63. Var cond2
  64. TreeList
  65. BinaryOperation Assignment
  66. Var b
  67. Var a
  68. TreeList
  69. BinaryOperation Assignment
  70. Var b
  71. MathematicalConstant 3
  72. TreeList
  73. BinaryOperation Assignment
  74. Var b
  75. MathematicalConstant 4
  76. ReturnNode
  77. Var b
  78. ===== AST after cfg-building =====
  79. f(cond1, cond2):
  80. TreeList
  81. IfElseIfChain
  82. Var cond1
  83. TreeList
  84. BinaryOperation Assignment
  85. Var a
  86. MathematicalConstant 1
  87. IfElseIfChain
  88. Var cond2
  89. TreeList
  90. BinaryOperation Assignment
  91. Var b
  92. Var a
  93. TreeList
  94. BinaryOperation Assignment
  95. Var b
  96. MathematicalConstant 3
  97. TreeList
  98. BinaryOperation Assignment
  99. Var b
  100. MathematicalConstant 4
  101. ReturnNode
  102. Var b
  103. ===== CFG after cfg-building =====
  104. f(cond1, cond2):
  105. 0:
  106. ControlFlowBranch true=3 false=7
  107. Var cond1
  108. 1:
  109. ControlFlowFunctionReturn
  110. Var $return
  111. 2:
  112. BinaryOperation Assignment
  113. Var $return
  114. Var b
  115. ControlFlowJump jump=1
  116. 3:
  117. BinaryOperation Assignment
  118. Var a
  119. MathematicalConstant 1
  120. ControlFlowBranch true=5 false=6
  121. Var cond2
  122. 4:
  123. ControlFlowJump jump=2
  124. 5:
  125. BinaryOperation Assignment
  126. Var b
  127. Var a
  128. ControlFlowJump jump=4
  129. 6:
  130. BinaryOperation Assignment
  131. Var b
  132. MathematicalConstant 3
  133. ControlFlowJump jump=4
  134. 7:
  135. BinaryOperation Assignment
  136. Var b
  137. MathematicalConstant 4
  138. ControlFlowJump jump=2
  139. 8:
  140. BinaryOperation Assignment
  141. Var $return
  142. Error ""
  143. ControlFlowJump jump=1
  144. ===== AST after cfg-simplification =====
  145. f(cond1, cond2):
  146. TreeList
  147. IfElseIfChain
  148. Var cond1
  149. TreeList
  150. BinaryOperation Assignment
  151. Var a
  152. MathematicalConstant 1
  153. IfElseIfChain
  154. Var cond2
  155. TreeList
  156. BinaryOperation Assignment
  157. Var b
  158. Var a
  159. TreeList
  160. BinaryOperation Assignment
  161. Var b
  162. MathematicalConstant 3
  163. TreeList
  164. BinaryOperation Assignment
  165. Var b
  166. MathematicalConstant 4
  167. ReturnNode
  168. Var b
  169. ===== CFG after cfg-simplification =====
  170. f(cond1, cond2):
  171. 0:
  172. ControlFlowBranch true=3 false=6
  173. Var cond1
  174. 1:
  175. ControlFlowFunctionReturn
  176. Var $return
  177. 2:
  178. BinaryOperation Assignment
  179. Var $return
  180. Var b
  181. ControlFlowJump jump=1
  182. 3:
  183. BinaryOperation Assignment
  184. Var a
  185. MathematicalConstant 1
  186. ControlFlowBranch true=4 false=5
  187. Var cond2
  188. 4:
  189. BinaryOperation Assignment
  190. Var b
  191. Var a
  192. ControlFlowJump jump=2
  193. 5:
  194. BinaryOperation Assignment
  195. Var b
  196. MathematicalConstant 3
  197. ControlFlowJump jump=2
  198. 6:
  199. BinaryOperation Assignment
  200. Var b
  201. MathematicalConstant 4
  202. ControlFlowJump jump=2
  203. ===== AST after ssa-building =====
  204. f(cond1, cond2):
  205. TreeList
  206. IfElseIfChain
  207. Var cond1@0
  208. TreeList
  209. BinaryOperation Assignment
  210. Var a@1
  211. MathematicalConstant 1
  212. IfElseIfChain
  213. Var cond2@0
  214. TreeList
  215. BinaryOperation Assignment
  216. Var b@1
  217. Var a@1
  218. TreeList
  219. BinaryOperation Assignment
  220. Var b@3
  221. MathematicalConstant 3
  222. TreeList
  223. BinaryOperation Assignment
  224. Var b@4
  225. MathematicalConstant 4
  226. ReturnNode
  227. Var b@2
  228. ===== CFG after ssa-building =====
  229. f(cond1, cond2):
  230. 0:
  231. ControlFlowBranch true=1 false=6
  232. Var cond1@0
  233. 1:
  234. BinaryOperation Assignment
  235. Var a@1
  236. MathematicalConstant 1
  237. ControlFlowBranch true=2 false=5
  238. Var cond2@0
  239. 2:
  240. BinaryOperation Assignment
  241. Var b@1
  242. Var a@1
  243. ControlFlowJump jump=3
  244. 3:
  245. a@2 = phi(2: a@1, 5: a@1, 6: a@0)
  246. b@2 = phi(2: b@1, 5: b@3, 6: b@4)
  247. BinaryOperation Assignment
  248. Var $return@1
  249. Var b@2
  250. ControlFlowJump jump=4
  251. 4:
  252. ControlFlowFunctionReturn
  253. Var $return@1
  254. 5:
  255. BinaryOperation Assignment
  256. Var b@3
  257. MathematicalConstant 3
  258. ControlFlowJump jump=3
  259. 6:
  260. BinaryOperation Assignment
  261. Var b@4
  262. MathematicalConstant 4
  263. ControlFlowJump jump=3
  264. ===== AST after dce =====
  265. f(cond1, cond2):
  266. TreeList
  267. IfElseIfChain
  268. Var cond1@0
  269. TreeList
  270. BinaryOperation Assignment
  271. Var a@1
  272. MathematicalConstant 1
  273. IfElseIfChain
  274. Var cond2@0
  275. TreeList
  276. BinaryOperation Assignment
  277. Var b@1
  278. Var a@1
  279. TreeList
  280. BinaryOperation Assignment
  281. Var b@3
  282. MathematicalConstant 3
  283. TreeList
  284. BinaryOperation Assignment
  285. Var b@4
  286. MathematicalConstant 4
  287. ReturnNode
  288. Var b@2
  289. ===== CFG after dce =====
  290. f(cond1, cond2):
  291. 0:
  292. ControlFlowBranch true=1 false=6
  293. Var cond1@0
  294. 1:
  295. BinaryOperation Assignment
  296. Var a@1
  297. MathematicalConstant 1
  298. ControlFlowBranch true=2 false=5
  299. Var cond2@0
  300. 2:
  301. BinaryOperation Assignment
  302. Var b@1
  303. Var a@1
  304. ControlFlowJump jump=3
  305. 3:
  306. b@2 = phi(2: b@1, 5: b@3, 6: b@4)
  307. BinaryOperation Assignment
  308. Var $return@1
  309. Var b@2
  310. ControlFlowJump jump=4
  311. 4:
  312. ControlFlowFunctionReturn
  313. Var $return@1
  314. 5:
  315. BinaryOperation Assignment
  316. Var b@3
  317. MathematicalConstant 3
  318. ControlFlowJump jump=3
  319. 6:
  320. BinaryOperation Assignment
  321. Var b@4
  322. MathematicalConstant 4
  323. ControlFlowJump jump=3