Mercurial > octave-nkf
comparison libinterp/corefcn/jit-ir.cc @ 20654:b65888ec820e draft default tip gccjit
dmalcom gcc jit import
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Fri, 27 Feb 2015 16:59:36 +0100 |
parents | 4197fc428c7d |
children |
comparison
equal
deleted
inserted
replaced
20653:9cef0a1207e4 | 20654:b65888ec820e |
---|---|
28 | 28 |
29 #ifdef HAVE_CONFIG_H | 29 #ifdef HAVE_CONFIG_H |
30 #include <config.h> | 30 #include <config.h> |
31 #endif | 31 #endif |
32 | 32 |
33 #ifdef HAVE_LLVM | 33 #ifdef HAVE_JIT |
34 | 34 |
35 #include "jit-ir.h" | 35 #include "jit-ir.h" |
36 | 36 |
37 #if HAVE_LLVM | |
37 #ifdef HAVE_LLVM_IR_FUNCTION_H | 38 #ifdef HAVE_LLVM_IR_FUNCTION_H |
38 #include <llvm/IR/BasicBlock.h> | 39 #include <llvm/IR/BasicBlock.h> |
39 #include <llvm/IR/Instructions.h> | 40 #include <llvm/IR/Instructions.h> |
40 #else | 41 #else |
41 #include <llvm/BasicBlock.h> | 42 #include <llvm/BasicBlock.h> |
42 #include <llvm/Instructions.h> | 43 #include <llvm/Instructions.h> |
43 #endif | 44 #endif |
45 #endif | |
44 | 46 |
45 #include "error.h" | 47 #include "error.h" |
46 | 48 |
47 // -------------------- jit_factory -------------------- | 49 // -------------------- jit_factory -------------------- |
48 jit_factory::~jit_factory (void) | 50 jit_factory::~jit_factory (void) |
206 if (mparent) | 208 if (mparent) |
207 mparent->remove (mlocation); | 209 mparent->remove (mlocation); |
208 resize_arguments (0); | 210 resize_arguments (0); |
209 } | 211 } |
210 | 212 |
213 #if HAVE_LLVM | |
211 llvm::BasicBlock * | 214 llvm::BasicBlock * |
212 jit_instruction::parent_llvm (void) const | 215 jit_instruction::parent_llvm (void) const |
213 { | 216 { |
214 return mparent->to_llvm (); | 217 return mparent->to_llvm (); |
215 } | 218 } |
219 #endif | |
216 | 220 |
217 std::ostream& | 221 std::ostream& |
218 jit_instruction::short_print (std::ostream& os) const | 222 jit_instruction::short_print (std::ostream& os) const |
219 { | 223 { |
220 if (type ()) | 224 if (type ()) |
386 { | 390 { |
387 jit_terminator *term = terminator (); | 391 jit_terminator *term = terminator (); |
388 return term ? term->successor_count () : 0; | 392 return term ? term->successor_count () : 0; |
389 } | 393 } |
390 | 394 |
395 #if HAVE_LLVM | |
391 llvm::BasicBlock * | 396 llvm::BasicBlock * |
392 jit_block::to_llvm (void) const | 397 jit_block::to_llvm (void) const |
393 { | 398 { |
394 return llvm::cast<llvm::BasicBlock> (llvm_value); | 399 return llvm::cast<llvm::BasicBlock> (llvm_value); |
395 } | 400 } |
401 #endif | |
396 | 402 |
397 std::ostream& | 403 std::ostream& |
398 jit_block::print_dom (std::ostream& os) const | 404 jit_block::print_dom (std::ostream& os) const |
399 { | 405 { |
400 short_print (os); | 406 short_print (os); |
659 } | 665 } |
660 | 666 |
661 return false; | 667 return false; |
662 } | 668 } |
663 | 669 |
670 #if HAVE_LLVM | |
664 llvm::PHINode * | 671 llvm::PHINode * |
665 jit_phi::to_llvm (void) const | 672 jit_phi::to_llvm (void) const |
666 { | 673 { |
667 return llvm::cast<llvm::PHINode> (jit_value::to_llvm ()); | 674 return llvm::cast<llvm::PHINode> (jit_value::to_llvm ()); |
668 } | 675 } |
676 #endif | |
669 | 677 |
670 // -------------------- jit_terminator -------------------- | 678 // -------------------- jit_terminator -------------------- |
671 size_t | 679 size_t |
672 jit_terminator::successor_index (const jit_block *asuccessor) const | 680 jit_terminator::successor_index (const jit_block *asuccessor) const |
673 { | 681 { |
695 } | 703 } |
696 | 704 |
697 return changed; | 705 return changed; |
698 } | 706 } |
699 | 707 |
708 #if HAVE_LLVM | |
700 llvm::TerminatorInst * | 709 llvm::TerminatorInst * |
701 jit_terminator::to_llvm (void) const | 710 jit_terminator::to_llvm (void) const |
702 { | 711 { |
703 return llvm::cast<llvm::TerminatorInst> (jit_value::to_llvm ()); | 712 return llvm::cast<llvm::TerminatorInst> (jit_value::to_llvm ()); |
704 } | 713 } |
714 #endif | |
705 | 715 |
706 // -------------------- jit_call -------------------- | 716 // -------------------- jit_call -------------------- |
707 bool | 717 bool |
708 jit_call::needs_release (void) const | 718 jit_call::needs_release (void) const |
709 { | 719 { |
840 { | 850 { |
841 const context& ctx = resolve_context (); | 851 const context& ctx = resolve_context (); |
842 return jit_typeinfo::end (ctx.value, ctx.index, ctx.count); | 852 return jit_typeinfo::end (ctx.value, ctx.index, ctx.count); |
843 } | 853 } |
844 | 854 |
845 #endif | 855 #endif /* ifdef HAVE_JIT */ |