25 #if !defined (octave_pt_jit_h)
26 #define octave_pt_jit_h 1
49 #define DECL_ARG(n) const ARG ## n& arg ## n
50 #define JIT_CREATE_CHECKED(N) \
51 template <OCT_MAKE_DECL_LIST (typename, ARG, N)> \
52 jit_call *create_checked (OCT_MAKE_LIST (DECL_ARG, N)) \
54 jit_call *ret = factory.create<jit_call> (OCT_MAKE_ARG_LIST (arg, N)); \
55 return create_checked_impl (ret); \
63 #undef JIT_CREATE_CHECKED
68 const type_bound_vector&
get_bounds (
void)
const {
return bounds; }
181 llvm::Function *
function;
199 jit_variable *find_variable (
const std::string& vname)
const;
212 std::string next_iterator (
bool inc =
true)
213 {
return next_name (
"#iter", iterator_count, inc); }
215 std::string next_for_bounds (
bool inc =
true)
216 {
return next_name (
"#for_bounds", for_bounds_count, inc); }
218 std::string next_shortcircut_result (
bool inc =
true)
219 {
return next_name (
"#shortcircut_result", short_count, inc); }
221 std::string next_name (
const char *prefix,
size_t& count,
bool inc);
224 jit_value *extra_arg = 0,
bool lhs =
false);
227 bool artificial =
false);
230 bool artificial =
false);
240 void finish_breaks (
jit_block *dest,
const block_list& lst);
248 llvm::Function *convert_loop (llvm::Module *module,
250 const std::list<jit_value *>& constants);
254 const std::list<jit_value *>& constants,
256 const std::vector<jit_type *>& args);
259 const std::vector<std::pair<std::string, bool> >& get_arguments(
void)
const
260 {
return argument_vec; }
262 #define JIT_METH(clname) \
263 virtual void visit (jit_ ## clname&);
282 llvm::Function *
function;
286 const std::list<jit_value *>& constants);
288 void finish_phi (
jit_phi *phi);
292 return visit (*jvalue);
309 const variable_map& avmap);
326 void construct_ssa (
void);
328 void do_construct_ssa (
jit_block& block,
size_t avisit_count);
334 void place_releases (
void);
340 void release_dead_phi (
jit_block& ablock);
342 void release_temp (
jit_block& ablock, std::set<jit_value *>& temp);
344 void simplify_phi (
void);
346 void simplify_phi (
jit_phi& phi);
363 llvm::ExecutionEngine *
get_engine (
void)
const {
return engine; }
367 void optimize (llvm::Function *fn);
407 jited_function
function;
415 typedef std::map<std::string, const octave_value *>
vmap;
423 bool execute (
const vmap& extra_vars = vmap ())
const;
425 bool match (
const vmap& extra_vars = vmap ())
const;
436 jited_function
function;