comparison src/pt-loop.h @ 14644:3f81e8b42955

JIT for loops over ranges * src/pt-eval.cc (tree_evaluator::visit_statment): Removed jit. (tree_evaluator::visit_simple_for_command): Added jit. * src/pt-jit.cc: Implement JIT of range based for loops. * src/pt-jit.h: Implement JI of range based for loops. * src/pt-loop.h (tree_simple_for_command::get_info, tree_simple_for_command::stash_info): New functions. * src/pt-loop.cc (tree_simple_for_command::~tree_simple_for_command): Delete stashed info.
author Max Brister <max@2bass.com>
date Thu, 17 May 2012 16:07:21 -0600
parents 72c96de7a403
children 51d4b1018efb
comparison
equal deleted inserted replaced
14643:05bf75eaea2a 14644:3f81e8b42955
33 class tree_walker; 33 class tree_walker;
34 34
35 #include "comment-list.h" 35 #include "comment-list.h"
36 #include "pt-cmd.h" 36 #include "pt-cmd.h"
37 #include "symtab.h" 37 #include "symtab.h"
38
39 class jit_info;
40 class jit_type;
38 41
39 // While. 42 // While.
40 43
41 class 44 class
42 tree_while_command : public tree_command 45 tree_while_command : public tree_command
178 tree_command *dup (symbol_table::scope_id scope, 181 tree_command *dup (symbol_table::scope_id scope,
179 symbol_table::context_id context) const; 182 symbol_table::context_id context) const;
180 183
181 void accept (tree_walker& tw); 184 void accept (tree_walker& tw);
182 185
183 private: 186 // some functions use by tree_jit
187 jit_info *get_info (jit_type *type) const
188 {
189 compiled_map::const_iterator iter = compiled.find (type);
190 return iter != compiled.end () ? iter->second : 0;
191 }
192
193 void stash_info (jit_type *type, jit_info *jinfo)
194 {
195 compiled[type] = jinfo;
196 }
197
198 private:
199 typedef std::map<jit_type *, jit_info *> compiled_map;
184 200
185 // TRUE means operate in parallel (subject to the value of the 201 // TRUE means operate in parallel (subject to the value of the
186 // maxproc expression). 202 // maxproc expression).
187 bool parallel; 203 bool parallel;
188 204
202 // Comment preceding FOR token. 218 // Comment preceding FOR token.
203 octave_comment_list *lead_comm; 219 octave_comment_list *lead_comm;
204 220
205 // Comment preceding ENDFOR token. 221 // Comment preceding ENDFOR token.
206 octave_comment_list *trail_comm; 222 octave_comment_list *trail_comm;
223
224 // a map from iterator types -> compiled functions
225 compiled_map compiled;
207 226
208 // No copying! 227 // No copying!
209 228
210 tree_simple_for_command (const tree_simple_for_command&); 229 tree_simple_for_command (const tree_simple_for_command&);
211 230