Class: CastOff::Compiler::SimpleIR::OptRegexpmatch2
- Defined in:
- lib/cast_off/compile/ir/call_ir.rb
Constant Summary
Constants included from Instruction
Instruction::BlockSeparator, Instruction::BranchInstruction, Instruction::IgnoreInstruction, Instruction::JumpOrReturnInstruction, Instruction::SupportInstruction, Instruction::TypeInfoUser, Instruction::VM_CALL_ARGS_BLOCKARG_BIT, Instruction::VM_CALL_ARGS_SPLAT_BIT, Instruction::VM_CALL_FCALL_BIT, Instruction::VM_CALL_OPT_SEND_BIT, Instruction::VM_CALL_SUPER_BIT, Instruction::VM_CALL_TAILCALL_BIT, Instruction::VM_CALL_TAILRECURSION_BIT, Instruction::VM_CALL_VCALL_BIT
Instance Attribute Summary
Attributes inherited from VMInsnIR
Attributes inherited from CallIR
#argc, #result_variable, #return_value, #values, #variables, #variables_without_result
Attributes inherited from IR
Instance Method Summary collapse
- #harmless?(recv_p) ⇒ Boolean
-
#initialize(param, argc, return_value, insn, cfg) ⇒ OptRegexpmatch2
constructor
A new instance of OptRegexpmatch2.
- #propergate_guard_usage ⇒ Object
- #side_effect? ⇒ Boolean
- #to_c(params) ⇒ Object
- #type_propergation(defs) ⇒ Object
Methods inherited from VMInsnIR
#dont_duplicate_if_harmless, #should_be_alive?
Methods inherited from CallIR
#can_not_unbox, #mark, #param_irs, #param_variables, #propergate_boxed_value, #propergate_exact_class, #sampling_return_value, #sampling_return_value?, #should_be_alive?, #unboxing_prelude
Methods included from Util
Methods inherited from IR
#add_sampling_variable, #alive, #alive?, #dispatch_method?, #generate_guard, #get_definition, #get_definition_str, #get_usage, #get_variable, #inlining_target?, #propergate_boxed_value, #reset, #sampling_variable, #set_info, #standard_guard_target, #unboxing_prelude, #vanish, #vanish?
Constructor Details
#initialize(param, argc, return_value, insn, cfg) ⇒ OptRegexpmatch2
Returns a new instance of OptRegexpmatch2.
611 612 613 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 611 def initialize(param, argc, return_value, insn, cfg) super(param, argc, return_value, insn, cfg) end |
Instance Method Details
#harmless?(recv_p) ⇒ Boolean
648 649 650 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 648 def harmless?(recv_p) true end |
#propergate_guard_usage ⇒ Object
615 616 617 618 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 615 def propergate_guard_usage() params = param_irs() params.each{|p| p.need_guard(true)} end |
#side_effect? ⇒ Boolean
652 653 654 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 652 def side_effect? true end |
#to_c(params) ⇒ Object
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 620 def to_c(params) ret = [] ret << super(params) param = param_variables() # FIXME 型を見て string だった場合は、分岐を消す obj2 = param.shift obj1 = param.shift if obj2.is_just?(String) ret << " #{@return_value} = rb_reg_match(#{obj1}, #{obj2});" else id = @translator.allocate_id("=~".intern) ret << <<-EOS if (TYPE(#{obj2}) == T_STRING) { #{@return_value} = rb_reg_match(#{obj1}, #{obj2}); } else { #{@return_value} = rb_funcall(#{obj2}, #{id}, 1, #{obj1}); } EOS end bug() unless param.empty? ret.join("\n") end |
#type_propergation(defs) ⇒ Object
644 645 646 |
# File 'lib/cast_off/compile/ir/call_ir.rb', line 644 def type_propergation(defs) @return_value.is_dynamic() end |