Exemple #1
0
 public ComparisonBlock(
     LLVMCodeGenerator CodeGenerator,
     CodeBlock Left,
     CodeBlock Right,
     LLVMIntPredicate Predicate)
 {
     this.codeGen   = CodeGenerator;
     this.lhs       = Left;
     this.rhs       = Right;
     this.predicate = Predicate;
 }
        /// <summary>
        /// Handles IntPtr comparisons.
        /// </summary>
        /// <param name="context">The current invocation context.</param>
        /// <param name="predicate">The comparison predicate.</param>
        /// <returns>The resulting value.</returns>
        protected virtual Value?MakeIntPtrCompare(InvocationContext context, LLVMIntPredicate predicate)
        {
            var builder   = context.Builder;
            var args      = context.GetArgs();
            var firstVal  = BuildPtrToInt(builder, args[0].LLVMValue, Unit.NativeIntPtrType, string.Empty);
            var secondVal = BuildPtrToInt(builder, args[1].LLVMValue, Unit.NativeIntPtrType, string.Empty);

            return(new Value(
                       typeof(bool),
                       BuildICmp(builder, predicate, firstVal, secondVal, string.Empty)));
        }
 public static extern LLVMValueRef* BuildICmp(LLVMBuilderRef* LLVMBuilderRef, LLVMIntPredicate Op, LLVMValueRef* LHS, LLVMValueRef* RHS, [In][MarshalAs(UnmanagedType.LPStr)] string Name);
 public static extern LLVMValueRef* ConstICmp(LLVMIntPredicate Predicate, LLVMValueRef* LHSConstant, LLVMValueRef* RHSConstant);
Exemple #5
0
 public LLVMValueRef CompareInts(LLVMIntPredicate op, LLVMValueRef v1, LLVMValueRef v2)
 {
     return(LLVM.BuildICmp(_codeGenerator.Builder, op, v1, v2, ""));
 }
Exemple #6
0
 public static extern LLVMValueRef ConstICmp(LLVMIntPredicate @Predicate, LLVMValueRef @LHSConstant, LLVMValueRef @RHSConstant);
Exemple #7
0
 public static extern LLVMValueRef BuildICmp(LLVMBuilderRef @param0, LLVMIntPredicate @Op, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name);
Exemple #8
0
 public Value BuildICmp(Value lhs, LLVMIntPredicate predicate, Value rhs, string varName = tmpvarname)
 {
     return new Value(Native.BuildICmp(m_builder, predicate, lhs.Handle, rhs.Handle, varName));
 }
Exemple #9
0
 public LLVMValueRef CreateICmp(LLVMIntPredicate @Op, LLVMValueRef @LHS, LLVMValueRef @RHS, string @Name)
 {
     return LLVM.BuildICmp(this.instance, @Op, @LHS, @RHS, @Name);
 }
Exemple #10
0
 public static ConstantExpr GetICmp(LLVMIntPredicate predicate, Constant lhs, Constant rhs) => LLVM.ConstICmp(predicate, lhs.Unwrap(), rhs.Unwrap()).WrapAs <ConstantExpr>();
Exemple #11
0
 public Value BuildICmp(Value lhs, LLVMIntPredicate predicate, Value rhs, string varName = tmpvarname)
 {
     return(new Value(Native.BuildICmp(m_builder, predicate, lhs.Handle, rhs.Handle, varName)));
 }
Exemple #12
0
 public static IntPredicate Wrap(this LLVMIntPredicate handle) => (IntPredicate)(int)handle;
Exemple #13
0
 private OperatorSymbol binary(Tag tag, TypeTag left, TypeTag right, TypeTag result, LLVMOpcode opcode,
                               LLVMIntPredicate intPredicate)
 {
     return(binary(tag, left, right, result, opcode, (int)intPredicate));
 }
 public Value BuildICmp(Value lhs, LLVMIntPredicate predicate, Value rhs)
 {
     return BuildICmp(lhs, predicate, rhs, "cmptmp");
 }
Exemple #15
0
 public LLVMValueRef CreateICmp(LLVMIntPredicate @Op, LLVMValueRef @LHS, LLVMValueRef @RHS, string @Name)
 {
     return(LLVM.BuildICmp(this.instance, @Op, @LHS, @RHS, @Name));
 }