Class: Crabstone::ARM::Operand

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

Instance Method Summary collapse

Instance Method Details

#cimm?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/arch/arm.rb', line 73

def cimm?
  self[:type] == OP_CIMM
end

#fp?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/arch/arm.rb', line 85

def fp?
  self[:type] == OP_FP
end

#imm?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/arch/arm.rb', line 69

def imm?
  [OP_IMM, OP_CIMM, OP_PIMM].include? self[:type]
end

#mem?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/arch/arm.rb', line 81

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

#pimm?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/arch/arm.rb', line 77

def pimm?
  self[:type] == OP_PIMM
end

#reg?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/arch/arm.rb', line 65

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

#sysreg?Boolean

Returns:

  • (Boolean)


89
90
91
# File 'lib/arch/arm.rb', line 89

def sysreg?
  self[:type] == OP_SYSREG
end

#valid?Boolean

Returns:

  • (Boolean)


93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/arch/arm.rb', line 93

def valid?
  [
    OP_MEM,
    OP_IMM,
    OP_CIMM,
    OP_PIMM,
    OP_FP,
    OP_REG,
    OP_SYSREG,
    OP_SETEND
  ].include? self[:type]
end

#valueObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/arch/arm.rb', line 48

def value
  case self[:type]
  when *[OP_REG, OP_SYSREG]
    self[:value][:reg]
  when *[OP_IMM, OP_CIMM, OP_PIMM]
    self[:value][:imm]
  when OP_MEM
    self[:value][:mem]
  when OP_FP
    self[:value][:fp]
  when OP_SETEND
    self[:value][:setend]
  else
    nil
  end
end