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)); }
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);
public static extern LLVMValueRef BuildCast(LLVMBuilderRef @B, LLVMOpcode @Op, LLVMValueRef @Val, LLVMTypeRef @DestTy, [MarshalAs(UnmanagedType.LPStr)] string @Name);
public static extern LLVMValueRef BuildBinOp(LLVMBuilderRef @B, LLVMOpcode @Op, LLVMValueRef @LHS, LLVMValueRef @RHS, [MarshalAs(UnmanagedType.LPStr)] string @Name);
public LLVMValueRef CreateBinOp(LLVMOpcode @Op, LLVMValueRef @LHS, LLVMValueRef @RHS, string @Name) { return LLVM.BuildBinOp(this.instance, @Op, @LHS, @RHS, @Name); }
public LLVMValueRef CreateCast(LLVMOpcode @Op, LLVMValueRef @Val, LLVMTypeRef @DestTy, string @Name) { return LLVM.BuildCast(this.instance, @Op, @Val, @DestTy, @Name); }
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)); }
public static Opcode Wrap(this LLVMOpcode handle) => (Opcode)(int)handle;
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)); }
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 OperatorSymbol(string name, Symbol owner, Type type, LLVMOpcode opcode, int predicate) : this(name, owner, type, opcode) { llvmPredicate = predicate; }
public OperatorSymbol(string name, Symbol owner, Type type, LLVMOpcode opcode) : base(name, owner, type) { this.opcode = opcode; }
public LLVMValueRef CreateCast(LLVMOpcode @Op, LLVMValueRef @Val, LLVMTypeRef @DestTy, string @Name) { return(LLVM.BuildCast(this.instance, @Op, @Val, @DestTy, @Name)); }
public LLVMValueRef CreateBinOp(LLVMOpcode @Op, LLVMValueRef @LHS, LLVMValueRef @RHS, string @Name) { return(LLVM.BuildBinOp(this.instance, @Op, @LHS, @RHS, @Name)); }