Mercurial > hg > octave-lyh
changeset 14983:a5f75de0dab1
Rename jit_function to jit_operation
* src/TEMPLATE-INST/Array-jit.cc: Rename jit_function to jit_operation.
* src/pt-jit.h: Rename jit_function to jit_operation.
* src/pt-jit.cc: Rename jit_function to jit_operation.
author | Max Brister <max@2bass.com> |
---|---|
date | Mon, 09 Jul 2012 12:32:42 -0500 |
parents | d27fa4f03706 |
children | 561aad6a9e4b |
files | src/TEMPLATE-INST/Array-jit.cc src/pt-jit.cc src/pt-jit.h |
diffstat | 3 files changed, 68 insertions(+), 68 deletions(-) [+] |
line wrap: on
line diff
--- a/src/TEMPLATE-INST/Array-jit.cc +++ b/src/TEMPLATE-INST/Array-jit.cc @@ -31,8 +31,8 @@ #include "pt-jit.h" -NO_INSTANTIATE_ARRAY_SORT (jit_function::overload); +NO_INSTANTIATE_ARRAY_SORT (jit_operation::overload); -INSTANTIATE_ARRAY (jit_function::overload, OCTINTERP_API); +INSTANTIATE_ARRAY (jit_operation::overload, OCTINTERP_API); #endif
--- a/src/pt-jit.cc +++ b/src/pt-jit.cc @@ -388,9 +388,9 @@ return llvm_type ? llvm_type->getPointerTo () : 0; } -// -------------------- jit_function -------------------- +// -------------------- jit_operation -------------------- void -jit_function::add_overload (const overload& func, +jit_operation::add_overload (const overload& func, const std::vector<jit_type*>& args) { if (args.size () >= overloads.size ()) @@ -420,8 +420,8 @@ over(idx) = func; } -const jit_function::overload& -jit_function::get_overload (const std::vector<jit_type*>& types) const +const jit_operation::overload& +jit_operation::get_overload (const std::vector<jit_type*>& types) const { // FIXME: We should search for the next best overload on failure static overload null_overload; @@ -443,7 +443,7 @@ } Array<octave_idx_type> -jit_function::to_idx (const std::vector<jit_type*>& types) const +jit_operation::to_idx (const std::vector<jit_type*>& types) const { octave_idx_type numel = types.size (); if (numel == 1) @@ -640,7 +640,7 @@ ++fn->arg_begin ()); builder.CreateRet (ret); - jit_function::overload ol (fn, true, scalar, scalar, scalar); + jit_operation::overload ol (fn, true, scalar, scalar, scalar); binary_ops[octave_value::op_div].add_overload (ol); binary_ops[octave_value::op_el_div].add_overload (ol); } @@ -657,7 +657,7 @@ fn->arg_begin ()); builder.CreateRet (ret); - jit_function::overload ol (fn, true, scalar, scalar, scalar); + jit_operation::overload ol (fn, true, scalar, scalar, scalar); binary_ops[octave_value::op_ldiv].add_overload (ol); binary_ops[octave_value::op_el_ldiv].add_overload (ol); } @@ -1045,7 +1045,7 @@ ty->to_llvm ()); engine->addGlobalMapping (fn, call); - jit_function::overload ol (fn, false, 0, string, ty); + jit_operation::overload ol (fn, false, 0, string, ty); print_fn.add_overload (ol); } @@ -1068,7 +1068,7 @@ builder.CreateRet (ret); llvm::verifyFunction (*fn); - jit_function::overload ol(fn, false, ty, ty, ty); + jit_operation::overload ol(fn, false, ty, ty, ty); binary_ops[op].add_overload (ol); } @@ -1090,7 +1090,7 @@ builder.CreateRet (ret); llvm::verifyFunction (*fn); - jit_function::overload ol (fn, false, boolean, ty, ty); + jit_operation::overload ol (fn, false, boolean, ty, ty); binary_ops[op].add_overload (ol); } @@ -1112,7 +1112,7 @@ builder.CreateRet (ret); llvm::verifyFunction (*fn); - jit_function::overload ol (fn, false, boolean, ty, ty); + jit_operation::overload ol (fn, false, boolean, ty, ty); binary_ops[op].add_overload (ol); } @@ -1998,7 +1998,7 @@ tree_expression *rhs = be.rhs (); jit_value *rhsv = visit (rhs); - const jit_function& fn = jit_typeinfo::binary_op (be.op_type ()); + const jit_operation& fn = jit_typeinfo::binary_op (be.op_type ()); result = create_checked (fn, lhsv, rhsv); } } @@ -2126,7 +2126,7 @@ finish_breaks (check_block, continues); block = check_block; - const jit_function& add_fn = jit_typeinfo::binary_op (octave_value::op_add); + const jit_operation& add_fn = jit_typeinfo::binary_op (octave_value::op_add); jit_value *one = create<jit_const_index> (1); jit_call *iter_inc = create<jit_call> (add_fn, iterator, one); block->append (iter_inc); @@ -2407,7 +2407,7 @@ { // FIXME: ugly hack, we need to come up with a way to pass // nargout to visit_identifier - const jit_function& fn = jit_typeinfo::print_value (); + const jit_operation& fn = jit_typeinfo::print_value (); jit_const_string *name = create<jit_const_string> (expr->name ()); block->append (create<jit_call> (fn, name, expr_result)); } @@ -2576,7 +2576,7 @@ if (print) { - const jit_function& print_fn = jit_typeinfo::print_value (); + const jit_operation& print_fn = jit_typeinfo::print_value (); jit_const_string *name = create<jit_const_string> (lhs); block->append (create<jit_call> (print_fn, name, var)); } @@ -2898,7 +2898,7 @@ jit_convert::simplify_phi (jit_phi& phi) { jit_block& pblock = *phi.parent (); - const jit_function& cast_fn = jit_typeinfo::cast (phi.type ()); + const jit_operation& cast_fn = jit_typeinfo::cast (phi.type ()); jit_variable *dest = phi.dest (); for (size_t i = 0; i < phi.argument_count (); ++i) { @@ -3150,7 +3150,7 @@ jit_value *new_value = assign.src (); if (isa<jit_assign_base> (new_value)) { - const jit_function::overload& ol + const jit_operation::overload& ol = jit_typeinfo::get_grab (new_value->type ()); if (ol.function) assign.stash_llvm (create_call (ol, new_value)); @@ -3159,7 +3159,7 @@ jit_value *overwrite = assign.overwrite (); if (isa<jit_assign_base> (overwrite)) { - const jit_function::overload& ol + const jit_operation::overload& ol = jit_typeinfo::get_release (overwrite->type ()); if (ol.function) create_call (ol, overwrite); @@ -3171,7 +3171,7 @@ {} llvm::Value * -jit_convert::convert_llvm::create_call (const jit_function::overload& ol, +jit_convert::convert_llvm::create_call (const jit_operation::overload& ol, const std::vector<jit_value *>& jargs) { llvm::IRBuilder<> alloca_inserter (prelude, prelude->begin ()); @@ -3221,7 +3221,7 @@ } llvm::Value * -jit_convert::convert_llvm::create_call (const jit_function::overload& ol, +jit_convert::convert_llvm::create_call (const jit_operation::overload& ol, const std::vector<jit_use>& uses) { std::vector<jit_value *> values (uses.size ());
--- a/src/pt-jit.h +++ b/src/pt-jit.h @@ -48,9 +48,9 @@ // at the start of a simple for loop. // // The octave low level IR is a linear IR, it works by converting everything to -// calls to jit_functions. This turns expressions like c = a + b into +// calls to jit_operations. This turns expressions like c = a + b into // c = call binary+ (a, b) -// The jit_functions contain information about overloads for different types. +// The jit_operations contain information about overloads for different types. // For, example, if we know a and b are scalars, then c must also be a scalar. // // Support for function calls is in progress. Currently, calls to sin with a @@ -312,7 +312,7 @@ // Keeps track of overloads for a builtin function. Used for both type inference // and code generation. class -jit_function +jit_operation { public: struct @@ -453,74 +453,74 @@ return instance->do_type_of (ov); } - static const jit_function& binary_op (int op) + static const jit_operation& binary_op (int op) { return instance->do_binary_op (op); } - static const jit_function& grab (void) { return instance->grab_fn; } - - static const jit_function::overload& get_grab (jit_type *type) + static const jit_operation& grab (void) { return instance->grab_fn; } + + static const jit_operation::overload& get_grab (jit_type *type) { return instance->grab_fn.get_overload (type); } - static const jit_function& release (void) + static const jit_operation& release (void) { return instance->release_fn; } - static const jit_function::overload& get_release (jit_type *type) + static const jit_operation::overload& get_release (jit_type *type) { return instance->release_fn.get_overload (type); } - static const jit_function& print_value (void) + static const jit_operation& print_value (void) { return instance->print_fn; } - static const jit_function& for_init (void) + static const jit_operation& for_init (void) { return instance->for_init_fn; } - static const jit_function& for_check (void) + static const jit_operation& for_check (void) { return instance->for_check_fn; } - static const jit_function& for_index (void) + static const jit_operation& for_index (void) { return instance->for_index_fn; } - static const jit_function& make_range (void) + static const jit_operation& make_range (void) { return instance->make_range_fn; } - static const jit_function& paren_subsref (void) + static const jit_operation& paren_subsref (void) { return instance->paren_subsref_fn; } - static const jit_function& paren_subsasgn (void) + static const jit_operation& paren_subsasgn (void) { return instance->paren_subsasgn_fn; } - static const jit_function& logically_true (void) + static const jit_operation& logically_true (void) { return instance->logically_true_fn; } - static const jit_function& cast (jit_type *result) + static const jit_operation& cast (jit_type *result) { return instance->do_cast (result); } - static const jit_function::overload& cast (jit_type *to, jit_type *from) + static const jit_operation::overload& cast (jit_type *to, jit_type *from) { return instance->do_cast (to, from); } @@ -572,15 +572,15 @@ jit_type *do_type_of (const octave_value &ov) const; - const jit_function& do_binary_op (int op) const + const jit_operation& do_binary_op (int op) const { assert (static_cast<size_t>(op) < binary_ops.size ()); return binary_ops[op]; } - const jit_function& do_cast (jit_type *to) + const jit_operation& do_cast (jit_type *to) { - static jit_function null_function; + static jit_operation null_function; if (! to) return null_function; @@ -590,7 +590,7 @@ return casts[id]; } - const jit_function::overload& do_cast (jit_type *to, jit_type *from) + const jit_operation::overload& do_cast (jit_type *to, jit_type *from) { return do_cast (to).get_overload (from); } @@ -689,20 +689,20 @@ jit_type *index; std::map<std::string, jit_type *> builtins; - std::vector<jit_function> binary_ops; - jit_function grab_fn; - jit_function release_fn; - jit_function print_fn; - jit_function for_init_fn; - jit_function for_check_fn; - jit_function for_index_fn; - jit_function logically_true_fn; - jit_function make_range_fn; - jit_function paren_subsref_fn; - jit_function paren_subsasgn_fn; + std::vector<jit_operation> binary_ops; + jit_operation grab_fn; + jit_operation release_fn; + jit_operation print_fn; + jit_operation for_init_fn; + jit_operation for_check_fn; + jit_operation for_index_fn; + jit_operation logically_true_fn; + jit_operation make_range_fn; + jit_operation paren_subsref_fn; + jit_operation paren_subsasgn_fn; // type id -> cast function TO that type - std::vector<jit_function> casts; + std::vector<jit_operation> casts; // type id -> identity function std::vector<llvm::Function *> identities; @@ -1724,11 +1724,11 @@ { public: #define JIT_CALL_CONST(N) \ - jit_call (const jit_function& afunction, \ + jit_call (const jit_operation& afunction, \ OCT_MAKE_DECL_LIST (jit_value *, arg, N)) \ : jit_instruction (OCT_MAKE_ARG_LIST (arg, N)), mfunction (afunction) {} \ \ - jit_call (const jit_function& (*afunction) (void), \ + jit_call (const jit_operation& (*afunction) (void), \ OCT_MAKE_DECL_LIST (jit_value *, arg, N)) \ : jit_instruction (OCT_MAKE_ARG_LIST (arg, N)), mfunction (afunction ()) {} @@ -1740,14 +1740,14 @@ #undef JIT_CALL_CONST - const jit_function& function (void) const { return mfunction; } + const jit_operation& function (void) const { return mfunction; } bool can_error (void) const { return overload ().can_error; } - const jit_function::overload& overload (void) const + const jit_operation::overload& overload (void) const { return mfunction.get_overload (argument_types ()); } @@ -1778,7 +1778,7 @@ JIT_VALUE_ACCEPT; private: - const jit_function& mfunction; + const jit_operation& mfunction; }; // FIXME: This is just ugly... @@ -1826,7 +1826,7 @@ return dest ()->name (); } - const jit_function::overload& overload (void) const + const jit_operation::overload& overload (void) const { return jit_typeinfo::cast (type (), jit_typeinfo::get_any ()); } @@ -1854,7 +1854,7 @@ return dest->name (); } - const jit_function::overload& overload (void) const + const jit_operation::overload& overload (void) const { return jit_typeinfo::cast (jit_typeinfo::get_any (), result_type ()); } @@ -2249,13 +2249,13 @@ jvalue.accept (*this); } - llvm::Value *create_call (const jit_function::overload& ol, jit_value *arg0) + llvm::Value *create_call (const jit_operation::overload& ol, jit_value *arg0) { std::vector<jit_value *> args (1, arg0); return create_call (ol, args); } - llvm::Value *create_call (const jit_function::overload& ol, jit_value *arg0, + llvm::Value *create_call (const jit_operation::overload& ol, jit_value *arg0, jit_value *arg1) { std::vector<jit_value *> args (2); @@ -2265,10 +2265,10 @@ return create_call (ol, args); } - llvm::Value *create_call (const jit_function::overload& ol, + llvm::Value *create_call (const jit_operation::overload& ol, const std::vector<jit_value *>& jargs); - llvm::Value *create_call (const jit_function::overload& ol, + llvm::Value *create_call (const jit_operation::overload& ol, const std::vector<jit_use>& uses); private: jit_convert &jthis;