Mercurial > octave-nkf
comparison src/jit-typeinfo.h @ 15019:ae3670d4df29
Update the execution engine's global mapping for external functions
* src/jit_typeinfo.cc: (octave_jit_print_double): Rename to
octave_jit_print_scalar
(jit_function::do_add_mapping): New function.
(jit_typeinfo::jit_typeinfo, jit_typeinfo::add_print): Add mappings.
(jit_typeinfo::do_insert_error_check): Rename builder argument.
* src/jit_typeinfo.h: (jit_function::add_mapping): New function.
(jit_function::do_add_mapping): New declaration.
(jit_typeinfo::add_print): Take function ptr as argument.
author | Max Brister <max@2bass.com> |
---|---|
date | Thu, 26 Jul 2012 10:40:26 -0500 |
parents | 005cb78e1dd1 |
children | bc32288f4a42 |
comparison
equal
deleted
inserted
replaced
15018:3d8ace26c5b4 | 15019:ae3670d4df29 |
---|---|
229 jit_function (const jit_function& fn, jit_type *aresult, | 229 jit_function (const jit_function& fn, jit_type *aresult, |
230 const std::vector<jit_type *>& aargs); | 230 const std::vector<jit_type *>& aargs); |
231 | 231 |
232 jit_function (const jit_function& fn); | 232 jit_function (const jit_function& fn); |
233 | 233 |
234 template <typename T> | |
235 void add_mapping (llvm::ExecutionEngine *engine, T fn) | |
236 { | |
237 do_add_mapping (engine, reinterpret_cast<void *> (fn)); | |
238 } | |
239 | |
234 bool valid (void) const { return llvm_function; } | 240 bool valid (void) const { return llvm_function; } |
235 | 241 |
236 std::string name (void) const; | 242 std::string name (void) const; |
237 | 243 |
238 llvm::BasicBlock *new_block (const std::string& aname = "body", | 244 llvm::BasicBlock *new_block (const std::string& aname = "body", |
287 return args[idx]; | 293 return args[idx]; |
288 } | 294 } |
289 | 295 |
290 const std::vector<jit_type *>& arguments (void) const { return args; } | 296 const std::vector<jit_type *>& arguments (void) const { return args; } |
291 private: | 297 private: |
298 void do_add_mapping (llvm::ExecutionEngine *engine, void *fn); | |
299 | |
292 llvm::Module *module; | 300 llvm::Module *module; |
293 llvm::Function *llvm_function; | 301 llvm::Function *llvm_function; |
294 jit_type *mresult; | 302 jit_type *mresult; |
295 std::vector<jit_type *> args; | 303 std::vector<jit_type *> args; |
296 jit_convention::type call_conv; | 304 jit_convention::type call_conv; |
531 | 539 |
532 jit_type *new_type (const std::string& name, jit_type *parent, | 540 jit_type *new_type (const std::string& name, jit_type *parent, |
533 llvm::Type *llvm_type); | 541 llvm::Type *llvm_type); |
534 | 542 |
535 | 543 |
536 void add_print (jit_type *ty); | 544 void add_print (jit_type *ty, void *fptr); |
537 | 545 |
538 void add_binary_op (jit_type *ty, int op, int llvm_op); | 546 void add_binary_op (jit_type *ty, int op, int llvm_op); |
539 | 547 |
540 void add_binary_icmp (jit_type *ty, int op, int llvm_op); | 548 void add_binary_icmp (jit_type *ty, int op, int llvm_op); |
541 | 549 |