protected override LLVMValueRef ValueAsTypeInternal(LLVMTypeRef type, LLVMBuilderRef builder, bool signExtend) { LLVMTypeRef origLLVMType = ILImporter.GetLLVMTypeForTypeDesc(Type); LLVMValueRef value = _importer.LoadTemp(LocalIndex, origLLVMType); return(ILImporter.CastIfNecessary(builder, value, type)); }
protected override LLVMValueRef ValueAsTypeInternal(LLVMTypeRef type, LLVMBuilderRef builder, bool signExtend) { if (RawLLVMValue.Pointer == IntPtr.Zero) throw new NullReferenceException(); return ILImporter.CastIfNecessary(builder, RawLLVMValue, type, Name); }
protected override LLVMValueRef ValueAsTypeInternal(LLVMTypeRef type, LLVMBuilderRef builder, bool signExtend) { if (type.IsPackedStruct && type.Handle != RawLLVMValue.TypeOf.Handle) { var destStruct = type.Undef; for (uint elemNo = 0; elemNo < RawLLVMValue.TypeOf.StructElementTypesCount; elemNo++) { var elemValRef = builder.BuildExtractValue(RawLLVMValue, 0, "ex" + elemNo); destStruct = builder.BuildInsertValue(destStruct, elemValRef, elemNo, "st" + elemNo); } return(destStruct); } return(ILImporter.CastIfNecessary(builder, RawLLVMValue, type, Name, !signExtend)); }
protected override LLVMValueRef ValueAsTypeInternal(LLVMTypeRef type, LLVMBuilderRef builder, bool signExtend) { return(ILImporter.CastIfNecessary(builder, RawLLVMValue, type)); }
protected override LLVMValueRef ValueAsTypeInternal(LLVMTypeRef type, LLVMBuilderRef builder, bool signExtend) { //TODO: deal with sign extension here return(ILImporter.CastIfNecessary(builder, RawLLVMValue, type, Name)); }