Class: Relyze::TCG::TCGOperand

Inherits:
Object
  • Object
show all
Defined in:
C:/Program Files/Relyze/lib/relyze/core/tcg.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, access, value, name = nil) ⇒ TCGOperand

Returns a new instance of TCGOperand



15
16
17
18
19
20
# File 'C:/Program Files/Relyze/lib/relyze/core/tcg.rb', line 15

def initialize( type, access, value, name=nil )
    @type   = type
    @access = access
    @value  = value
    @name   = name
end

Instance Attribute Details

#accessObject

Returns the value of attribute access



13
14
15
# File 'C:/Program Files/Relyze/lib/relyze/core/tcg.rb', line 13

def access
  @access
end

#nameObject

Returns the value of attribute name



13
14
15
# File 'C:/Program Files/Relyze/lib/relyze/core/tcg.rb', line 13

def name
  @name
end

#typeObject

Returns the value of attribute type



13
14
15
# File 'C:/Program Files/Relyze/lib/relyze/core/tcg.rb', line 13

def type
  @type
end

#valueObject

Returns the value of attribute value



13
14
15
# File 'C:/Program Files/Relyze/lib/relyze/core/tcg.rb', line 13

def value
  @value
end

Instance Method Details

#to_sObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'C:/Program Files/Relyze/lib/relyze/core/tcg.rb', line 22

def to_s
    txt = ''

    case @type
    when :bar, :register, :cond, :memop, :helper, :alias_register, :register_unversioned
        if( not @name.nil? )
            txt << @name
        else
            txt << "0x%X" % @value
        end
    when :label
        txt << "label_%d" % @value
    when :immediate
        txt << "0x%X" % @value
    when :pointer_domain, :phi
					txt << @name
    when :string_name
        txt << @value
    when :alias_name
        txt << @value
    when :instruction
        txt << @value.to_s
    else
        raise "Unknown TCGOperand type #{@type}"
    end

    return txt
end
ruby-2.6.5).