Class: Rubycc::Front::AST::BuiltinOverflow
- Inherits:
-
Data
- Object
- Data
- Rubycc::Front::AST::BuiltinOverflow
- Defined in:
- lib/rubycc/front/ast.rb
Overview
"__builtin_add/sub/mul_overflow ( a , b , res )": computes "a op b" with
infinite precision, stores the result converted to the type res points
at (wrapping or truncating like any integer conversion), and yields int 1
when that conversion lost the value and 0 when it did not. op is :add,
:sub or :mul and args holds the three argument expressions as written.
The parser checks only the argument count; the operand types (both
integers, res a pointer to an integer) need resolved types and are the
generator's to diagnose. token is the builtin keyword.
The two operands keep their own types — no usual arithmetic conversion runs between them, which is the whole point of the builtin: "int -1" plus "unsigned 1" is 0 in infinite precision, not UINT_MAX.
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#op ⇒ Object
readonly
Returns the value of attribute op.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args
417 418 419 |
# File 'lib/rubycc/front/ast.rb', line 417 def args @args end |
#op ⇒ Object (readonly)
Returns the value of attribute op
417 418 419 |
# File 'lib/rubycc/front/ast.rb', line 417 def op @op end |
#token ⇒ Object (readonly)
Returns the value of attribute token
417 418 419 |
# File 'lib/rubycc/front/ast.rb', line 417 def token @token end |