Mercurial > octave-nkf
comparison src/pt-jit.cc @ 14961:903a5ee2cdde
Simplify the creation of error checks in jit
* src/pt-jit.h (jit_convert::create_checked,
jit_convert::create_checked_impl): New function.
* src/pt-jit.cc (jit_convert::visit_binary_expression,
jit_convert::visit_if_command, jit_convert::visit_index_expression):
Use create_checked.
author | Max Brister <max@2bass.com> |
---|---|
date | Tue, 19 Jun 2012 13:10:10 -0500 |
parents | c959136f8c3e |
children | 90a7a2af2cd5 |
comparison
equal
deleted
inserted
replaced
14960:c959136f8c3e | 14961:903a5ee2cdde |
---|---|
1613 | 1613 |
1614 tree_expression *rhs = be.rhs (); | 1614 tree_expression *rhs = be.rhs (); |
1615 jit_value *rhsv = visit (rhs); | 1615 jit_value *rhsv = visit (rhs); |
1616 | 1616 |
1617 const jit_function& fn = jit_typeinfo::binary_op (be.op_type ()); | 1617 const jit_function& fn = jit_typeinfo::binary_op (be.op_type ()); |
1618 jit_call *call = block->append (create<jit_call> (fn, lhsv, rhsv)); | 1618 result = create_checked (fn, lhsv, rhsv); |
1619 | |
1620 jit_block *normal = create<jit_block> (block->name ()); | |
1621 block->append (create<jit_error_check> (call, normal, final_block)); | |
1622 add_block (normal); | |
1623 block = normal; | |
1624 result = call; | |
1625 } | 1619 } |
1626 | 1620 |
1627 void | 1621 void |
1628 jit_convert::visit_break_command (tree_break_command&) | 1622 jit_convert::visit_break_command (tree_break_command&) |
1629 { | 1623 { |
1867 | 1861 |
1868 if (! tic->is_else_clause ()) | 1862 if (! tic->is_else_clause ()) |
1869 { | 1863 { |
1870 tree_expression *expr = tic->condition (); | 1864 tree_expression *expr = tic->condition (); |
1871 jit_value *cond = visit (expr); | 1865 jit_value *cond = visit (expr); |
1872 jit_call *check = create<jit_call> (&jit_typeinfo::logically_true, | 1866 jit_call *check = create_checked (&jit_typeinfo::logically_true, |
1873 cond); | 1867 cond); |
1874 block->append (check); | 1868 block->append (check); |
1875 | |
1876 jit_block *next = create<jit_block> (block->name ()); | |
1877 add_block (next); | |
1878 block->append (create<jit_error_check> (check, next, final_block)); | |
1879 block = next; | |
1880 | 1869 |
1881 jit_block *body = create<jit_block> (i == 0 ? "if_body" | 1870 jit_block *body = create<jit_block> (i == 0 ? "if_body" |
1882 : "ifelse_body"); | 1871 : "ifelse_body"); |
1883 add_block (body); | 1872 add_block (body); |
1884 | 1873 |
1933 jit_value *object = visit (tree_object); | 1922 jit_value *object = visit (tree_object); |
1934 | 1923 |
1935 tree_expression *arg0 = arg_list->front (); | 1924 tree_expression *arg0 = arg_list->front (); |
1936 jit_value *index = visit (arg0); | 1925 jit_value *index = visit (arg0); |
1937 | 1926 |
1938 jit_call *call = create<jit_call> (jit_typeinfo::paren_subsref, object, | 1927 result = create_checked (jit_typeinfo::paren_subsref, object, index); |
1939 index); | |
1940 block->append (call); | |
1941 | |
1942 jit_block *normal = create<jit_block> (block->name ()); | |
1943 block->append (create<jit_error_check> (call, normal, final_block)); | |
1944 add_block (normal); | |
1945 block = normal; | |
1946 result = call; | |
1947 } | 1928 } |
1948 | 1929 |
1949 void | 1930 void |
1950 jit_convert::visit_matrix (tree_matrix&) | 1931 jit_convert::visit_matrix (tree_matrix&) |
1951 { | 1932 { |