One returns a one-value of the specified bool, int or float type.
(ty Type)
| 31 | |
| 32 | // One returns a one-value of the specified bool, int or float type. |
| 33 | func (b *Builder) One(ty Type) *Value { |
| 34 | var value *Value |
| 35 | switch { |
| 36 | case ty == b.m.Types.Bool: |
| 37 | value = b.val(ty, llvm.ConstInt(ty.llvmTy(), 1, false)) |
| 38 | case IsInteger(ty): |
| 39 | value = b.val(ty, llvm.ConstInt(ty.llvmTy(), 1, false)) |
| 40 | case IsFloat(ty): |
| 41 | value = b.val(ty, llvm.ConstFloat(ty.llvmTy(), 1)) |
| 42 | default: |
| 43 | fail("One does not support type %T", ty) |
| 44 | } |
| 45 | value.SetName("1") |
| 46 | return value |
| 47 | } |
| 48 | |
| 49 | // Not returns !x. The type of x must be Bool. |
| 50 | func (b *Builder) Not(x *Value) *Value { |