Class: JIT::Primitive

Inherits:
Value
  • Object
show all
Defined in:
lib/libjit/value.rb

Direct Known Subclasses

Bool, FloatConstant, IntConstant, Pointer

Instance Attribute Summary

Attributes inherited from Value

#jit_t

Instance Method Summary (collapse)

Methods inherited from Value

#address, #addressable?, #cast, create, #function, #set_addressable, #store, #to_bool, #to_not_bool, #type, wrap

Instance Method Details

- (Primitive) %(divisor)

Generates an instruction to apply the modulo function on this value.

Parameters:

Returns:

  • (Primitive)

    a temporary value representing the remainder.



265
266
267
# File 'lib/libjit/value.rb', line 265

def %(divisor)
  Value.wrap LibJIT.jit_insn_rem(function.jit_t, jit_t, divisor.jit_t)
end

- (Primitive) &(other)

Generates an instruction to perform a [bitwise AND](en.wikipedia.org/wiki/Bitwise_operation#AND) with this value.

Parameters:

Returns:

  • (Primitive)

    a temporary value representing the calculated result.



200
201
202
# File 'lib/libjit/value.rb', line 200

def &(other)
  Value.wrap LibJIT.jit_insn_and(function.jit_t, jit_t, other.jit_t)
end

- (Primitive) *(other)

Generates an instruction to perform a multiplication with this value.

Parameters:

Returns:

  • (Primitive)

    a temporary value representing the calculated result.



249
250
251
# File 'lib/libjit/value.rb', line 249

def *(other)
  Value.wrap LibJIT.jit_insn_mul(function.jit_t, jit_t, other.jit_t)
end

- (Primitive) **(exponent)

Generates an instruction to find a power of this value.

Parameters:

Returns:

  • (Primitive)

    a temporary value representing the calculated result.



273
274
275
# File 'lib/libjit/value.rb', line 273

def **(exponent)
  Value.wrap LibJIT.jit_insn_pow(function.jit_t, jit_t, exponent.jit_t)
end

- (Primitive) +(other)

Generates an instruction to perform an addition with this value.

Parameters:

Returns:

  • (Primitive)

    a temporary value representing the calculated result.



233
234
235
# File 'lib/libjit/value.rb', line 233

def +(other)
  Value.wrap LibJIT.jit_insn_add(function.jit_t, jit_t, other.jit_t)
end

- (Primitive) -(other)

Generates an instruction to perform a subtraction with this value.

Parameters:

Returns:

  • (Primitive)

    a temporary value representing the calculated result.



241
242
243
# File 'lib/libjit/value.rb', line 241

def -(other)
  Value.wrap LibJIT.jit_insn_sub(function.jit_t, jit_t, other.jit_t)
end

- (Primitive) -@

Generates an instruction to reverse the sign of this value.

Returns:

  • (Primitive)

    a temporary value representing the calculated result.



225
226
227
# File 'lib/libjit/value.rb', line 225

def -@
  Value.wrap LibJIT.jit_insn_neg(function.jit_t, jit_t)
end

- (Primitive) /(divisor)

Generates an instruction to perform a division with this value.

Parameters:

Returns:

  • (Primitive)

    a temporary value representing the calculated result.



257
258
259
# File 'lib/libjit/value.rb', line 257

def /(divisor)
  Value.wrap LibJIT.jit_insn_div(function.jit_t, jit_t, divisor.jit_t)
end

- (Bool) <(other)

Generates an instruction to check whether this value is less than another value.

Parameters:

  • other (Primitive)

    the other value to compare with.

Returns:

  • (Bool)

    a temporary value representing the boolean result of the comparison.



126
127
128
# File 'lib/libjit/value.rb', line 126

def <(other)
  Value.wrap(LibJIT.jit_insn_lt(function.jit_t, jit_t, other.jit_t)).to_bool
end

- (Primitive) <<(other)

Generates an instruction to perform an arithmetic left shift on this value.

Parameters:

  • other (Primitive)

    the number of positions to shift.

Returns:

  • (Primitive)

    a temporary value representing the result of shifting.



183
184
185
# File 'lib/libjit/value.rb', line 183

def <<(other)
  Value.wrap LibJIT.jit_insn_shl(function.jit_t, jit_t, other.jit_t)
end

- (Bool) <=(other)

Generates an instruction to check whether this value is less than or equal to another value.

Parameters:

  • other (Primitive)

    the other value to compare with.

Returns:

  • (Bool)

    a temporary value representing the boolean result of the comparison.



135
136
137
# File 'lib/libjit/value.rb', line 135

def <=(other)
  Value.wrap(LibJIT.jit_insn_le(function.jit_t, jit_t, other.jit_t)).to_bool
end

- (Bool) >(other)

Generates an instruction to check whether this value is greater than another value.

Parameters:

  • other (Primitive)

    the other value to compare with.

Returns:

  • (Bool)

    a temporary value representing the boolean result of the comparison.



143
144
145
# File 'lib/libjit/value.rb', line 143

def >(other)
  Value.wrap(LibJIT.jit_insn_gt(function.jit_t, jit_t, other.jit_t)).to_bool
end

- (Bool) >=(other)

Generates an instruction to check whether this value is greater than or equal to another value.

Parameters:

  • other (Primitive)

    the other value to compare with.

Returns:

  • (Bool)

    a temporary value representing the boolean result of the comparison.



152
153
154
# File 'lib/libjit/value.rb', line 152

def >=(other)
  Value.wrap(LibJIT.jit_insn_ge(function.jit_t, jit_t, other.jit_t)).to_bool
end

- (Primitive) >>(other)

Generates an instruction to perform an arithmetic right shift on this value.

Parameters:

  • other (Primitive)

    the number of positions to shift.

Returns:

  • (Primitive)

    a temporary value representing the result of shifting.



191
192
193
# File 'lib/libjit/value.rb', line 191

def >>(other)
  Value.wrap LibJIT.jit_insn_shr(function.jit_t, jit_t, other.jit_t)
end

- (Primitive) ^(other)

Generates an instruction to perform a [bitwise XOR](en.wikipedia.org/wiki/Bitwise_operation#XOR) with this value.

Parameters:

Returns:

  • (Primitive)

    a temporary value representing the calculated result.



209
210
211
# File 'lib/libjit/value.rb', line 209

def ^(other)
  Value.wrap LibJIT.jit_insn_xor(function.jit_t, jit_t, other.jit_t)
end

- (Bool) eq(other)

Generates an instruction to check whether this value is equal to another value.

Parameters:

  • other (Primitive)

    the other value to compare with.

Returns:

  • (Bool)

    a temporary value representing the boolean result of the comparison.



160
161
162
# File 'lib/libjit/value.rb', line 160

def eq(other)
  Value.wrap(LibJIT.jit_insn_eq(function.jit_t, jit_t, other.jit_t)).to_bool
end

- (Bool) ne(other)

Generates an instruction to check whether this value is not equal to another value.

Parameters:

  • other (Primitive)

    the other value to compare with.

Returns:

  • (Bool)

    a temporary value representing the boolean result of the comparison.



168
169
170
# File 'lib/libjit/value.rb', line 168

def ne(other)
  Value.wrap(LibJIT.jit_insn_ne(function.jit_t, jit_t, other.jit_t)).to_bool
end

- (Primitive) |(other)

Generates an instruction to perform a [bitwise OR](en.wikipedia.org/wiki/Bitwise_operation#OR) with this value.

Parameters:

Returns:

  • (Primitive)

    a temporary value representing the calculated result.



218
219
220
# File 'lib/libjit/value.rb', line 218

def |(other)
  Value.wrap LibJIT.jit_insn_or(function.jit_t, jit_t, other.jit_t)
end

- (Primitive) ~

Generates an instruction to calculate the bitwise negation of this value.

Returns:

  • (Primitive)

    a temporary value representing the result of negation.



175
176
177
# File 'lib/libjit/value.rb', line 175

def ~()
  Value.wrap LibJIT.jit_insn_not(function.jit_t, jit_t)
end