Mercurial > hg > octave-nkf
diff src/interp-core/jit-ir.cc @ 15102:d29f2583cf7b
Support end in multi indexing in JIT
* src/interp-core/jit-ir.cc (jit_magic_end::context::context): New function.
(jit_magic_end::jit_magic_end): Take context vector as argument.
(jit_magic_end::resolve_context): Return a context.
(jit_magic_end::print): Prettify output.
(jit_magic_end::overload): Use context.
* src/interp-core/jit-ir.h (jit_magic_end::context::context,
jit_magic_end::print): Move implementation to src/jit-ir.cc.
(jit_magic_end::short_print): Prettify output.
(jit_magic_end::resolve_context): Return a context.
* src/interp-core/jit-typeinfo.cc (octave_jit_end_matrix): New function.
(jit_typeinfo::jit_typeinfo): Initilaize end_fn and end1_fn.
(jit_typeinfo::do_end): New function.
(jit_typeinfo::new_type): Moved location in file.
* src/interp-core/jit-typeinfo.h (jit_typeinfo::end): Take index and count
arguments.
(jit_typeinfo::do_end): New declaration.
* src/interp-core/pt-jit.cc (jit_convert::resolve): Pass extra argument to
context constructor.
(jit_convert::convert_llvm::visit): New arguments to jit_magic_end overload.
author | Max Brister <max@2bass.com> |
---|---|
date | Sat, 04 Aug 2012 00:19:07 -0500 |
parents | 909a2797935b |
children | 0464e3ceb85b |
line wrap: on
line diff
--- a/src/interp-core/jit-ir.cc +++ b/src/interp-core/jit-ir.cc @@ -599,38 +599,30 @@ } // -------------------- jit_magic_end -------------------- +jit_magic_end::context::context (jit_convert& convert, jit_value *avalue, + size_t aindex, size_t acount) + : value (avalue), index (convert.create<jit_const_index> (aindex)), + count (convert.create<jit_const_index> (acount)) +{} + jit_magic_end::jit_magic_end (const std::vector<context>& full_context) + : contexts (full_context) { - // for now we only support end in 1 dimensional indexing - resize_arguments (full_context.size ()); + resize_arguments (contexts.size ()); size_t i; std::vector<context>::const_iterator iter; - for (iter = full_context.begin (), i = 0; iter != full_context.end (); ++iter, - ++i) - { - if (iter->count != 1) - throw jit_fail_exception ("end is only supported in linear contexts"); - stash_argument (i, iter->value); - } + for (iter = contexts.begin (), i = 0; iter != contexts.end (); ++iter, ++i) + stash_argument (i, iter->value); } -const jit_function& -jit_magic_end::overload () const -{ - jit_value *ctx = resolve_context (); - if (ctx) - return jit_typeinfo::end (ctx->type ()); - - static jit_function null_ret; - return null_ret; -} - -jit_value * +jit_magic_end::context jit_magic_end::resolve_context (void) const { // FIXME: We need to have a way of marking functions so we can skip them here - return argument_count () ? argument (0) : 0; + context ret = contexts[0]; + ret.value = argument (0); + return ret; } bool @@ -646,4 +638,19 @@ return false; } +std::ostream& +jit_magic_end::print (std::ostream& os, size_t indent) const +{ + context ctx = resolve_context (); + short_print (print_indent (os, indent)) << " (" << *ctx.value << ", "; + return os << *ctx.index << ", " << *ctx.count << ")"; +} + +const jit_function& +jit_magic_end::overload () const +{ + const context& ctx = resolve_context (); + return jit_typeinfo::end (ctx.value, ctx.index, ctx.count); +} + #endif