示例#1
0
        private OperatorSymbol unary(Tag tag, TypeTag argType, TypeTag result, LLVMOpcode opcode = default)
        {
            FuncType funcType = new FuncType(
                CollectionUtils.singletonList <Type>(symtab.typeForTag(argType)),
                symtab.typeForTag(result)
                );

            return(new OperatorSymbol(operatorNames[tag.operatorIndex()], symtab.noSymbol, funcType, opcode));
        }
示例#2
0
        private Value ConvertToType(Value val, Type tp)
        {
            if (val.TypeOf == tp)
            {
                return(val);
            }

            LLVMOpcode castOp = GetCastOpcode(val, tp);

            return(_builder.BuildCast(castOp, val, tp));
        }
 public static extern LLVMValueRef* BuildCast(LLVMBuilderRef* B, LLVMOpcode Op, LLVMValueRef* Val, LLVMTypeRef* DestTy, [In][MarshalAs(UnmanagedType.LPStr)] string Name);
 public static extern LLVMValueRef* BuildBinOp(LLVMBuilderRef* B, LLVMOpcode Op, LLVMValueRef* LHS, LLVMValueRef* RHS, [In][MarshalAs(UnmanagedType.LPStr)] string Name);
示例#5
0
 public static extern LLVMValueRef BuildCast(LLVMBuilderRef @B, LLVMOpcode @Op, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name);
示例#6
0
 public static extern LLVMValueRef BuildBinOp(LLVMBuilderRef @B, LLVMOpcode @Op, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name);
示例#7
0
 public LLVMValueRef CreateBinOp(LLVMOpcode @Op, LLVMValueRef @LHS, LLVMValueRef @RHS, string @Name)
 {
     return LLVM.BuildBinOp(this.instance, @Op, @LHS, @RHS, @Name);
 }
示例#8
0
 public LLVMValueRef CreateCast(LLVMOpcode @Op, LLVMValueRef @Val, LLVMTypeRef @DestTy, string @Name)
 {
     return LLVM.BuildCast(this.instance, @Op, @Val, @DestTy, @Name);
 }
示例#9
0
        private void BinOp(ExpressionSyntax node, ExpressionSyntax left, ExpressionSyntax right, LLVMOpcode opcode, string name, bool visit = true)
        {
            var lhs = visit ? this.Pop(left) : this.OnlyPop(left);
            var rhs = visit ? this.Pop(right) : this.OnlyPop(right);

            this.Push(node, LLVM.BuildBinOp(builder, opcode, lhs, rhs, name));
        }
示例#10
0
 public static Opcode Wrap(this LLVMOpcode handle) => (Opcode)(int)handle;
示例#11
0
        private OperatorSymbol binary(Tag tag, TypeTag left, TypeTag right, TypeTag result, LLVMOpcode opcode,
                                      int predicate = 0)
        {
            FuncType funcType = new FuncType(
                new Type[] { symtab.typeForTag(left), symtab.typeForTag(right) },
                symtab.typeForTag(result)
                );

            return(new OperatorSymbol(operatorNames[tag.operatorIndex()], symtab.noSymbol, funcType, opcode,
                                      predicate));
        }
示例#12
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));
 }
示例#13
0
 public OperatorSymbol(string name, Symbol owner, Type type, LLVMOpcode opcode,
                       int predicate)
     : this(name, owner, type, opcode)
 {
     llvmPredicate = predicate;
 }
示例#14
0
 public OperatorSymbol(string name, Symbol owner, Type type, LLVMOpcode opcode) : base(name, owner, type)
 {
     this.opcode = opcode;
 }
示例#15
0
 public LLVMValueRef CreateCast(LLVMOpcode @Op, LLVMValueRef @Val, LLVMTypeRef @DestTy, string @Name)
 {
     return(LLVM.BuildCast(this.instance, @Op, @Val, @DestTy, @Name));
 }
示例#16
0
 public LLVMValueRef CreateBinOp(LLVMOpcode @Op, LLVMValueRef @LHS, LLVMValueRef @RHS, string @Name)
 {
     return(LLVM.BuildBinOp(this.instance, @Op, @LHS, @RHS, @Name));
 }