Class: Crabstone::SysZ::Operand

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/arch/systemz.rb

Instance Method Summary collapse

Instance Method Details

#imm?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/arch/systemz.rb', line 53

def imm?
    self[:type] == OP_IMM
end

#mem?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/arch/systemz.rb', line 57

def mem?
    self[:type] == OP_MEM
end

#reg?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/arch/systemz.rb', line 49

def reg?
    [OP_REG, OP_ACREG].include? self[:type]
end

#valid?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/arch/systemz.rb', line 61

def valid?
    [OP_MEM, OP_IMM, OP_REG, OP_ACREG].include? self[:type]
end

#valueObject



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/arch/systemz.rb', line 36

def value
    case self[:type]
    when *[OP_REG, OP_ACREG]
        self[:value][:reg]
    when OP_IMM
        self[:value][:imm]
    when OP_MEM
        self[:value][:mem]
    else
        nil
    end
end