Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ir_constant_expression.cpp 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. /*
  2. * Copyright © 2010 Intel Corporation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  21. * DEALINGS IN THE SOFTWARE.
  22. */
  23. /**
  24. * \file ir_constant_expression.cpp
  25. * Evaluate and process constant valued expressions
  26. *
  27. * In GLSL, constant valued expressions are used in several places. These
  28. * must be processed and evaluated very early in the compilation process.
  29. *
  30. * * Sizes of arrays
  31. * * Initializers for uniforms
  32. * * Initializers for \c const variables
  33. */
  34. #include <math.h>
  35. #include "ir.h"
  36. #include "ir_visitor.h"
  37. #include "glsl_types.h"
  38. /**
  39. * Visitor class for evaluating constant expressions
  40. */
  41. class ir_constant_visitor : public ir_visitor {
  42. public:
  43. ir_constant_visitor()
  44. : value(NULL)
  45. {
  46. /* empty */
  47. }
  48. virtual ~ir_constant_visitor()
  49. {
  50. /* empty */
  51. }
  52. /**
  53. * \name Visit methods
  54. *
  55. * As typical for the visitor pattern, there must be one \c visit method for
  56. * each concrete subclass of \c ir_instruction. Virtual base classes within
  57. * the hierarchy should not have \c visit methods.
  58. */
  59. /*@{*/
  60. virtual void visit(ir_variable *);
  61. virtual void visit(ir_function_signature *);
  62. virtual void visit(ir_function *);
  63. virtual void visit(ir_expression *);
  64. virtual void visit(ir_texture *);
  65. virtual void visit(ir_swizzle *);
  66. virtual void visit(ir_dereference_variable *);
  67. virtual void visit(ir_dereference_array *);
  68. virtual void visit(ir_dereference_record *);
  69. virtual void visit(ir_assignment *);
  70. virtual void visit(ir_constant *);
  71. virtual void visit(ir_call *);
  72. virtual void visit(ir_return *);
  73. virtual void visit(ir_if *);
  74. virtual void visit(ir_loop *);
  75. virtual void visit(ir_loop_jump *);
  76. /*@}*/
  77. /**
  78. * Value of the constant expression.
  79. *
  80. * \note
  81. * This field will be \c NULL if the expression is not constant valued.
  82. */
  83. /* FINIHSME: This cannot hold values for constant arrays or structures. */
  84. ir_constant *value;
  85. };
  86. ir_constant *
  87. ir_instruction::constant_expression_value()
  88. {
  89. ir_constant_visitor visitor;
  90. this->accept(& visitor);
  91. return visitor.value;
  92. }
  93. void
  94. ir_constant_visitor::visit(ir_variable *ir)
  95. {
  96. (void) ir;
  97. value = NULL;
  98. }
  99. void
  100. ir_constant_visitor::visit(ir_function_signature *ir)
  101. {
  102. (void) ir;
  103. value = NULL;
  104. }
  105. void
  106. ir_constant_visitor::visit(ir_function *ir)
  107. {
  108. (void) ir;
  109. value = NULL;
  110. }
  111. void
  112. ir_constant_visitor::visit(ir_expression *ir)
  113. {
  114. value = NULL;
  115. ir_constant *op[2];
  116. unsigned int operand, c;
  117. ir_constant_data data;
  118. for (operand = 0; operand < ir->get_num_operands(); operand++) {
  119. op[operand] = ir->operands[operand]->constant_expression_value();
  120. if (!op[operand])
  121. return;
  122. }
  123. switch (ir->operation) {
  124. case ir_unop_logic_not:
  125. assert(op[0]->type->base_type == GLSL_TYPE_BOOL);
  126. for (c = 0; c < ir->operands[0]->type->components(); c++)
  127. data.b[c] = !op[0]->value.b[c];
  128. break;
  129. case ir_unop_f2i:
  130. assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
  131. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  132. data.i[c] = op[0]->value.f[c];
  133. }
  134. break;
  135. case ir_unop_i2f:
  136. assert(op[0]->type->base_type == GLSL_TYPE_UINT ||
  137. op[0]->type->base_type == GLSL_TYPE_INT);
  138. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  139. if (op[0]->type->base_type == GLSL_TYPE_INT)
  140. data.f[c] = op[0]->value.i[c];
  141. else
  142. data.f[c] = op[0]->value.u[c];
  143. }
  144. break;
  145. case ir_unop_b2f:
  146. assert(op[0]->type->base_type == GLSL_TYPE_BOOL);
  147. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  148. data.f[c] = op[0]->value.b[c] ? 1.0 : 0.0;
  149. }
  150. break;
  151. case ir_unop_f2b:
  152. assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
  153. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  154. data.b[c] = bool(op[0]->value.f[c]);
  155. }
  156. break;
  157. case ir_unop_b2i:
  158. assert(op[0]->type->base_type == GLSL_TYPE_BOOL);
  159. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  160. data.u[c] = op[0]->value.b[c] ? 1 : 0;
  161. }
  162. break;
  163. case ir_unop_i2b:
  164. assert(op[0]->type->is_integer());
  165. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  166. data.b[c] = bool(op[0]->value.u[c]);
  167. }
  168. break;
  169. case ir_unop_neg:
  170. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  171. switch (ir->type->base_type) {
  172. case GLSL_TYPE_UINT:
  173. data.u[c] = -op[0]->value.u[c];
  174. break;
  175. case GLSL_TYPE_INT:
  176. data.i[c] = -op[0]->value.i[c];
  177. break;
  178. case GLSL_TYPE_FLOAT:
  179. data.f[c] = -op[0]->value.f[c];
  180. break;
  181. default:
  182. assert(0);
  183. }
  184. }
  185. break;
  186. case ir_unop_abs:
  187. assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
  188. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  189. switch (ir->type->base_type) {
  190. case GLSL_TYPE_UINT:
  191. data.u[c] = op[0]->value.u[c];
  192. break;
  193. case GLSL_TYPE_INT:
  194. data.i[c] = op[0]->value.i[c];
  195. if (data.i[c] < 0)
  196. data.i[c] = -data.i[c];
  197. break;
  198. case GLSL_TYPE_FLOAT:
  199. data.f[c] = fabs(op[0]->value.f[c]);
  200. break;
  201. default:
  202. assert(0);
  203. }
  204. }
  205. break;
  206. case ir_unop_rcp:
  207. assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
  208. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  209. switch (ir->type->base_type) {
  210. case GLSL_TYPE_UINT:
  211. if (op[0]->value.u[c] != 0.0)
  212. data.u[c] = 1 / op[0]->value.u[c];
  213. break;
  214. case GLSL_TYPE_INT:
  215. if (op[0]->value.i[c] != 0.0)
  216. data.i[c] = 1 / op[0]->value.i[c];
  217. break;
  218. case GLSL_TYPE_FLOAT:
  219. if (op[0]->value.f[c] != 0.0)
  220. data.f[c] = 1.0 / op[0]->value.f[c];
  221. break;
  222. default:
  223. assert(0);
  224. }
  225. }
  226. break;
  227. case ir_unop_rsq:
  228. assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
  229. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  230. data.f[c] = 1.0 / sqrtf(op[0]->value.f[c]);
  231. }
  232. break;
  233. case ir_unop_sqrt:
  234. assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
  235. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  236. data.f[c] = sqrtf(op[0]->value.f[c]);
  237. }
  238. break;
  239. case ir_unop_exp:
  240. assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
  241. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  242. data.f[c] = expf(op[0]->value.f[c]);
  243. }
  244. break;
  245. case ir_unop_log:
  246. assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
  247. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  248. data.f[c] = logf(op[0]->value.f[c]);
  249. }
  250. break;
  251. case ir_unop_dFdx:
  252. case ir_unop_dFdy:
  253. assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
  254. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  255. data.f[c] = 0.0;
  256. }
  257. break;
  258. case ir_binop_add:
  259. if (ir->operands[0]->type == ir->operands[1]->type) {
  260. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  261. switch (ir->operands[0]->type->base_type) {
  262. case GLSL_TYPE_UINT:
  263. data.u[c] = op[0]->value.u[c] + op[1]->value.u[c];
  264. break;
  265. case GLSL_TYPE_INT:
  266. data.i[c] = op[0]->value.i[c] + op[1]->value.i[c];
  267. break;
  268. case GLSL_TYPE_FLOAT:
  269. data.f[c] = op[0]->value.f[c] + op[1]->value.f[c];
  270. break;
  271. default:
  272. assert(0);
  273. }
  274. }
  275. } else
  276. /* FINISHME: Support operations with non-equal types. */
  277. return;
  278. break;
  279. case ir_binop_sub:
  280. if (ir->operands[0]->type == ir->operands[1]->type) {
  281. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  282. switch (ir->operands[0]->type->base_type) {
  283. case GLSL_TYPE_UINT:
  284. data.u[c] = op[0]->value.u[c] - op[1]->value.u[c];
  285. break;
  286. case GLSL_TYPE_INT:
  287. data.i[c] = op[0]->value.i[c] - op[1]->value.i[c];
  288. break;
  289. case GLSL_TYPE_FLOAT:
  290. data.f[c] = op[0]->value.f[c] - op[1]->value.f[c];
  291. break;
  292. default:
  293. assert(0);
  294. }
  295. }
  296. } else
  297. /* FINISHME: Support operations with non-equal types. */
  298. return;
  299. break;
  300. case ir_binop_mul:
  301. if (ir->operands[0]->type == ir->operands[1]->type &&
  302. !ir->operands[0]->type->is_matrix()) {
  303. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  304. switch (ir->operands[0]->type->base_type) {
  305. case GLSL_TYPE_UINT:
  306. data.u[c] = op[0]->value.u[c] * op[1]->value.u[c];
  307. break;
  308. case GLSL_TYPE_INT:
  309. data.i[c] = op[0]->value.i[c] * op[1]->value.i[c];
  310. break;
  311. case GLSL_TYPE_FLOAT:
  312. data.f[c] = op[0]->value.f[c] * op[1]->value.f[c];
  313. break;
  314. default:
  315. assert(0);
  316. }
  317. }
  318. } else
  319. /* FINISHME: Support operations with non-equal types. */
  320. return;
  321. break;
  322. case ir_binop_div:
  323. if (ir->operands[0]->type == ir->operands[1]->type) {
  324. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  325. switch (ir->operands[0]->type->base_type) {
  326. case GLSL_TYPE_UINT:
  327. data.u[c] = op[0]->value.u[c] / op[1]->value.u[c];
  328. break;
  329. case GLSL_TYPE_INT:
  330. data.i[c] = op[0]->value.i[c] / op[1]->value.i[c];
  331. break;
  332. case GLSL_TYPE_FLOAT:
  333. data.f[c] = op[0]->value.f[c] / op[1]->value.f[c];
  334. break;
  335. default:
  336. assert(0);
  337. }
  338. }
  339. } else
  340. /* FINISHME: Support operations with non-equal types. */
  341. return;
  342. break;
  343. case ir_binop_logic_and:
  344. assert(op[0]->type->base_type == GLSL_TYPE_BOOL);
  345. for (c = 0; c < ir->operands[0]->type->components(); c++)
  346. data.b[c] = op[0]->value.b[c] && op[1]->value.b[c];
  347. break;
  348. case ir_binop_logic_xor:
  349. assert(op[0]->type->base_type == GLSL_TYPE_BOOL);
  350. for (c = 0; c < ir->operands[0]->type->components(); c++)
  351. data.b[c] = op[0]->value.b[c] ^ op[1]->value.b[c];
  352. break;
  353. case ir_binop_logic_or:
  354. assert(op[0]->type->base_type == GLSL_TYPE_BOOL);
  355. for (c = 0; c < ir->operands[0]->type->components(); c++)
  356. data.b[c] = op[0]->value.b[c] || op[1]->value.b[c];
  357. break;
  358. case ir_binop_less:
  359. switch (ir->operands[0]->type->base_type) {
  360. case GLSL_TYPE_UINT:
  361. data.b[0] = op[0]->value.u[0] < op[1]->value.u[0];
  362. break;
  363. case GLSL_TYPE_INT:
  364. data.b[0] = op[0]->value.i[0] < op[1]->value.i[0];
  365. break;
  366. case GLSL_TYPE_FLOAT:
  367. data.b[0] = op[0]->value.f[0] < op[1]->value.f[0];
  368. break;
  369. default:
  370. assert(0);
  371. }
  372. break;
  373. case ir_binop_greater:
  374. switch (ir->operands[0]->type->base_type) {
  375. case GLSL_TYPE_UINT:
  376. data.b[0] = op[0]->value.u[0] > op[1]->value.u[0];
  377. break;
  378. case GLSL_TYPE_INT:
  379. data.b[0] = op[0]->value.i[0] > op[1]->value.i[0];
  380. break;
  381. case GLSL_TYPE_FLOAT:
  382. data.b[0] = op[0]->value.f[0] > op[1]->value.f[0];
  383. break;
  384. default:
  385. assert(0);
  386. }
  387. break;
  388. case ir_binop_lequal:
  389. switch (ir->operands[0]->type->base_type) {
  390. case GLSL_TYPE_UINT:
  391. data.b[0] = op[0]->value.u[0] <= op[1]->value.u[0];
  392. break;
  393. case GLSL_TYPE_INT:
  394. data.b[0] = op[0]->value.i[0] <= op[1]->value.i[0];
  395. break;
  396. case GLSL_TYPE_FLOAT:
  397. data.b[0] = op[0]->value.f[0] <= op[1]->value.f[0];
  398. break;
  399. default:
  400. assert(0);
  401. }
  402. break;
  403. case ir_binop_gequal:
  404. switch (ir->operands[0]->type->base_type) {
  405. case GLSL_TYPE_UINT:
  406. data.b[0] = op[0]->value.u[0] >= op[1]->value.u[0];
  407. break;
  408. case GLSL_TYPE_INT:
  409. data.b[0] = op[0]->value.i[0] >= op[1]->value.i[0];
  410. break;
  411. case GLSL_TYPE_FLOAT:
  412. data.b[0] = op[0]->value.f[0] >= op[1]->value.f[0];
  413. break;
  414. default:
  415. assert(0);
  416. }
  417. break;
  418. case ir_binop_equal:
  419. data.b[0] = true;
  420. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  421. switch (ir->operands[0]->type->base_type) {
  422. case GLSL_TYPE_UINT:
  423. data.b[0] = data.b[0] && op[0]->value.u[c] == op[1]->value.u[c];
  424. break;
  425. case GLSL_TYPE_INT:
  426. data.b[0] = data.b[0] && op[0]->value.i[c] == op[1]->value.i[c];
  427. break;
  428. case GLSL_TYPE_FLOAT:
  429. data.b[0] = data.b[0] && op[0]->value.f[c] == op[1]->value.f[c];
  430. break;
  431. case GLSL_TYPE_BOOL:
  432. data.b[0] = data.b[0] && op[0]->value.b[c] == op[1]->value.b[c];
  433. break;
  434. default:
  435. assert(0);
  436. }
  437. }
  438. break;
  439. case ir_binop_nequal:
  440. data.b[0] = false;
  441. for (c = 0; c < ir->operands[0]->type->components(); c++) {
  442. switch (ir->operands[0]->type->base_type) {
  443. case GLSL_TYPE_UINT:
  444. data.b[0] = data.b[0] || op[0]->value.u[c] != op[1]->value.u[c];
  445. break;
  446. case GLSL_TYPE_INT:
  447. data.b[0] = data.b[0] || op[0]->value.i[c] != op[1]->value.i[c];
  448. break;
  449. case GLSL_TYPE_FLOAT:
  450. data.b[0] = data.b[0] || op[0]->value.f[c] != op[1]->value.f[c];
  451. break;
  452. case GLSL_TYPE_BOOL:
  453. data.b[0] = data.b[0] || op[0]->value.b[c] != op[1]->value.b[c];
  454. break;
  455. default:
  456. assert(0);
  457. }
  458. }
  459. break;
  460. default:
  461. /* FINISHME: Should handle all expression types. */
  462. return;
  463. }
  464. this->value = new ir_constant(ir->type, &data);
  465. }
  466. void
  467. ir_constant_visitor::visit(ir_texture *ir)
  468. {
  469. // FINISHME: Do stuff with texture lookups
  470. (void) ir;
  471. value = NULL;
  472. }
  473. void
  474. ir_constant_visitor::visit(ir_swizzle *ir)
  475. {
  476. ir_constant *v = ir->val->constant_expression_value();
  477. this->value = NULL;
  478. if (v != NULL) {
  479. ir_constant_data data;
  480. const unsigned swiz_idx[4] = {
  481. ir->mask.x, ir->mask.y, ir->mask.z, ir->mask.w
  482. };
  483. for (unsigned i = 0; i < ir->mask.num_components; i++) {
  484. switch (v->type->base_type) {
  485. case GLSL_TYPE_UINT:
  486. case GLSL_TYPE_INT: data.u[i] = v->value.u[swiz_idx[i]]; break;
  487. case GLSL_TYPE_FLOAT: data.f[i] = v->value.f[swiz_idx[i]]; break;
  488. case GLSL_TYPE_BOOL: data.b[i] = v->value.b[swiz_idx[i]]; break;
  489. default: assert(!"Should not get here."); break;
  490. }
  491. }
  492. this->value = new ir_constant(ir->type, &data);
  493. }
  494. }
  495. void
  496. ir_constant_visitor::visit(ir_dereference_variable *ir)
  497. {
  498. value = NULL;
  499. ir_variable *var = ir->variable_referenced();
  500. if (var && var->constant_value)
  501. value = var->constant_value->clone();
  502. }
  503. void
  504. ir_constant_visitor::visit(ir_dereference_array *ir)
  505. {
  506. ir_constant *array = ir->array->constant_expression_value();
  507. ir_constant *idx = ir->array_index->constant_expression_value();
  508. this->value = NULL;
  509. if ((array != NULL) && (idx != NULL)) {
  510. if (array->type->is_matrix()) {
  511. /* Array access of a matrix results in a vector.
  512. */
  513. const unsigned column = idx->value.u[0];
  514. const glsl_type *const column_type = array->type->column_type();
  515. /* Offset in the constant matrix to the first element of the column
  516. * to be extracted.
  517. */
  518. const unsigned mat_idx = column * column_type->vector_elements;
  519. ir_constant_data data;
  520. switch (column_type->base_type) {
  521. case GLSL_TYPE_UINT:
  522. case GLSL_TYPE_INT:
  523. for (unsigned i = 0; i < column_type->vector_elements; i++)
  524. data.u[i] = array->value.u[mat_idx + i];
  525. break;
  526. case GLSL_TYPE_FLOAT:
  527. for (unsigned i = 0; i < column_type->vector_elements; i++)
  528. data.f[i] = array->value.f[mat_idx + i];
  529. break;
  530. default:
  531. assert(!"Should not get here.");
  532. break;
  533. }
  534. this->value = new ir_constant(column_type, &data);
  535. } else if (array->type->is_vector()) {
  536. const unsigned component = idx->value.u[0];
  537. this->value = new ir_constant(array, component);
  538. } else {
  539. /* FINISHME: Handle access of constant arrays. */
  540. }
  541. }
  542. }
  543. void
  544. ir_constant_visitor::visit(ir_dereference_record *ir)
  545. {
  546. ir_constant *v = ir->record->constant_expression_value();
  547. this->value = (v != NULL) ? v->get_record_field(ir->field) : NULL;
  548. }
  549. void
  550. ir_constant_visitor::visit(ir_assignment *ir)
  551. {
  552. (void) ir;
  553. value = NULL;
  554. }
  555. void
  556. ir_constant_visitor::visit(ir_constant *ir)
  557. {
  558. value = ir;
  559. }
  560. void
  561. ir_constant_visitor::visit(ir_call *ir)
  562. {
  563. (void) ir;
  564. value = NULL;
  565. }
  566. void
  567. ir_constant_visitor::visit(ir_return *ir)
  568. {
  569. (void) ir;
  570. value = NULL;
  571. }
  572. void
  573. ir_constant_visitor::visit(ir_if *ir)
  574. {
  575. (void) ir;
  576. value = NULL;
  577. }
  578. void
  579. ir_constant_visitor::visit(ir_loop *ir)
  580. {
  581. (void) ir;
  582. value = NULL;
  583. }
  584. void
  585. ir_constant_visitor::visit(ir_loop_jump *ir)
  586. {
  587. (void) ir;
  588. value = NULL;
  589. }