public static HLTypeOfLocation Create(HLType pTypeOfType) { HLTypeOfLocation location = new HLTypeOfLocation(HLDomain.SystemType); location.mTypeOfType = pTypeOfType; return(location); }
public static HLNewObjectInstruction Create(HLMethod pMethod, HLType pNewObjectType, HLLocation pDestinationSource) { HLNewObjectInstruction instruction = new HLNewObjectInstruction(pMethod); instruction.mNewObjectType = pNewObjectType; instruction.mDestinationSource = pDestinationSource; return instruction; }
public static HLEnumLiteralLocation Create(HLType pType, string pLiteral) { HLEnumLiteralLocation location = new HLEnumLiteralLocation(pType); location.mLiteral = pLiteral; return(location); }
public static HLSizeOfLocation Create(HLType pSizeOfType) { HLSizeOfLocation location = new HLSizeOfLocation(HLDomain.SystemInt32); location.mSizeOfType = pSizeOfType; return(location); }
internal static LLLocation LoadArrayElementPointer(LLFunction pFunction, HLLocation pInstance, HLLocation pIndex, HLType pElementType) { LLLocation locationIndex = pIndex.Load(pFunction); LLLocation locationElementOffset = locationIndex; long? literalElementOffset = null; if (locationIndex is LLLiteralLocation) { literalElementOffset = Convert.ToInt64(((LLLiteralLocation)locationIndex).Literal.Value) * pElementType.VariableSize; } else if (pElementType.VariableSize > 1) { locationElementOffset = LLTemporaryLocation.Create(pFunction.CreateTemporary(locationIndex.Type)); pFunction.CurrentBlock.EmitMultiply(locationElementOffset, locationIndex, LLLiteralLocation.Create(LLLiteral.Create(locationElementOffset.Type, pElementType.VariableSize.ToString()))); } LLLocation locationArrayPointer = pInstance.Load(pFunction); locationArrayPointer = pFunction.CurrentBlock.EmitConversion(locationArrayPointer, LLModule.GetOrCreatePointerType(LLModule.GetOrCreateUnsignedType(8), 1)); LLLocation locationElementPointer = null; if (literalElementOffset.HasValue) { locationElementOffset = LLLiteralLocation.Create(LLLiteral.Create(LLModule.GetOrCreateSignedType(64), (literalElementOffset.Value + HLDomain.SystemArray.CalculatedSize).ToString())); locationElementPointer = LLTemporaryLocation.Create(pFunction.CreateTemporary(locationArrayPointer.Type)); pFunction.CurrentBlock.EmitGetElementPointer(locationElementPointer, locationArrayPointer, locationElementOffset); } else { LLLocation locationTemporary = LLTemporaryLocation.Create(pFunction.CreateTemporary(locationArrayPointer.Type)); pFunction.CurrentBlock.EmitGetElementPointer(locationTemporary, locationArrayPointer, LLLiteralLocation.Create(LLLiteral.Create(LLModule.GetOrCreateSignedType(32), (HLDomain.SystemArray.CalculatedSize).ToString()))); locationElementPointer = LLTemporaryLocation.Create(pFunction.CreateTemporary(locationArrayPointer.Type)); pFunction.CurrentBlock.EmitGetElementPointer(locationElementPointer, locationTemporary, locationElementOffset); } return pFunction.CurrentBlock.EmitConversion(locationElementPointer, pElementType.LLType.PointerDepthPlusOne); }
internal static void CheckStaticConstructorCalled(LLFunction pFunction, HLType pType) { if (pType.StaticConstructor == null) return; if (pType.StaticConstructor.LLFunction == pFunction) return; LLLocation locationConstructorCalled = LLGlobalLocation.Create(LLModule.GetGlobal(pType.ToString())); LLLocation locationConstructorCalledOriginal = LLTemporaryLocation.Create(pFunction.CreateTemporary(locationConstructorCalled.Type.PointerDepthMinusOne)); pFunction.CurrentBlock.EmitCompareExchange(locationConstructorCalledOriginal, locationConstructorCalled, LLLiteralLocation.Create(LLLiteral.Create(locationConstructorCalledOriginal.Type, "0")), LLLiteralLocation.Create(LLLiteral.Create(locationConstructorCalledOriginal.Type, "1")), LLCompareExchangeOrdering.acq_rel); LLLocation locationConstructorCall = LLTemporaryLocation.Create(pFunction.CreateTemporary(LLModule.BooleanType)); pFunction.CurrentBlock.EmitCompareIntegers(locationConstructorCall, locationConstructorCalledOriginal, LLLiteralLocation.Create(LLLiteral.Create(locationConstructorCalledOriginal.Type, "0")), LLCompareIntegersCondition.eq); LLLabel labelTrue = pFunction.CreateLabel(pFunction.Labels.Count); LLLabel labelFalse = pFunction.CreateLabel(pFunction.Labels.Count); LLLabel labelNext = pFunction.CreateLabel(pFunction.Labels.Count); pFunction.CurrentBlock.EmitBranch(locationConstructorCall, labelTrue, labelFalse); LLInstructionBlock blockTrue = pFunction.CreateBlock(labelTrue); List<LLLocation> parameters = new List<LLLocation>(); parameters.Add(LLLiteralLocation.Create(LLLiteral.Create(pType.StaticConstructor.LLFunction.Parameters[0].Type, "zeroinitializer"))); blockTrue.EmitCall(null, LLFunctionLocation.Create(pType.StaticConstructor.LLFunction), parameters); blockTrue.EmitGoto(labelNext); LLInstructionBlock blockFalse = pFunction.CreateBlock(labelFalse); blockFalse.EmitGoto(labelNext); pFunction.CurrentBlock = pFunction.CreateBlock(labelNext); }
public static HLIndirectAddressLocation Create(HLLocation pAddress, HLType pType) { HLIndirectAddressLocation location = new HLIndirectAddressLocation(HLDomain.GetOrCreateType(MutableModelHelper.GetManagedPointerTypeReference(pType.Definition, HLDomain.Host.InternFactory, pType.Definition))); location.mAddress = pAddress; return(location); }
public static HLNewObjectInstruction Create(HLMethod pMethod, HLType pNewObjectType, HLLocation pDestinationSource) { HLNewObjectInstruction instruction = new HLNewObjectInstruction(pMethod); instruction.mNewObjectType = pNewObjectType; instruction.mDestinationSource = pDestinationSource; return(instruction); }
public static HLArrayElementAddressLocation Create(HLLocation pInstance, HLLocation pIndex, HLType pElementType) { HLArrayElementAddressLocation location = new HLArrayElementAddressLocation(HLDomain.GetOrCreateType(MutableModelHelper.GetManagedPointerTypeReference(pElementType.Definition, HLDomain.Host.InternFactory, pElementType.Definition))); location.mInstance = pInstance; location.mIndex = pIndex; location.mElementType = pElementType; return location; }
public static HLArrayElementLocation Create(HLLocation pInstance, HLLocation pIndex, HLType pElementType) { HLArrayElementLocation location = new HLArrayElementLocation(pElementType); location.mInstance = pInstance; location.mIndex = pIndex; location.mElementType = pElementType; return location; }
public static HLNewArrayInstruction Create(HLMethod pMethod, HLLocation pDestinationSource, HLLocation pSizeSource, HLType pArrayType, HLType pElementType) { HLNewArrayInstruction instruction = new HLNewArrayInstruction(pMethod); instruction.mDestinationSource = pDestinationSource; instruction.mSizeSource = pSizeSource; instruction.mArrayType = pArrayType; instruction.mElementType = pElementType; return instruction; }
public static HLNewDelegateInstruction Create(HLMethod pMethod, HLType pNewDelegateType, HLLocation pDestinationSource, HLLocation pInstanceSource, HLMethod pMethodCalled, bool pVirtual) { HLNewDelegateInstruction instruction = new HLNewDelegateInstruction(pMethod); instruction.mNewDelegateType = pNewDelegateType; instruction.mDestinationSource = pDestinationSource; instruction.mInstanceSource = pInstanceSource; instruction.mMethodCalled = pMethodCalled; instruction.mVirtual = pVirtual; return instruction; }
public static HLNewDelegateInstruction Create(HLMethod pMethod, HLType pNewDelegateType, HLLocation pDestinationSource, HLLocation pInstanceSource, HLMethod pMethodCalled, bool pVirtual) { HLNewDelegateInstruction instruction = new HLNewDelegateInstruction(pMethod); instruction.mNewDelegateType = pNewDelegateType; instruction.mDestinationSource = pDestinationSource; instruction.mInstanceSource = pInstanceSource; instruction.mMethodCalled = pMethodCalled; instruction.mVirtual = pVirtual; return(instruction); }
internal static void CheckStaticConstructorCalled(LLFunction pFunction, HLType pType) { if (pType.StaticConstructor == null) { return; } if (pType.StaticConstructor.LLFunction == pFunction) { return; } LLLocation locationConstructorCalled = LLGlobalLocation.Create(LLModule.GetGlobal(pType.ToString())); LLLocation locationConstructorCalledOriginal = LLTemporaryLocation.Create(pFunction.CreateTemporary(locationConstructorCalled.Type.PointerDepthMinusOne)); pFunction.CurrentBlock.EmitCompareExchange(locationConstructorCalledOriginal, locationConstructorCalled, LLLiteralLocation.Create(LLLiteral.Create(locationConstructorCalledOriginal.Type, "0")), LLLiteralLocation.Create(LLLiteral.Create(locationConstructorCalledOriginal.Type, "1")), LLCompareExchangeOrdering.acq_rel); LLLocation locationConstructorCall = LLTemporaryLocation.Create(pFunction.CreateTemporary(LLModule.BooleanType)); pFunction.CurrentBlock.EmitCompareIntegers(locationConstructorCall, locationConstructorCalledOriginal, LLLiteralLocation.Create(LLLiteral.Create(locationConstructorCalledOriginal.Type, "0")), LLCompareIntegersCondition.eq); LLLabel labelTrue = pFunction.CreateLabel(pFunction.Labels.Count); LLLabel labelFalse = pFunction.CreateLabel(pFunction.Labels.Count); LLLabel labelNext = pFunction.CreateLabel(pFunction.Labels.Count); pFunction.CurrentBlock.EmitBranch(locationConstructorCall, labelTrue, labelFalse); LLInstructionBlock blockTrue = pFunction.CreateBlock(labelTrue); List <LLLocation> parameters = new List <LLLocation>(); parameters.Add(LLLiteralLocation.Create(LLLiteral.Create(pType.StaticConstructor.LLFunction.Parameters[0].Type, "zeroinitializer"))); blockTrue.EmitCall(null, LLFunctionLocation.Create(pType.StaticConstructor.LLFunction), parameters); blockTrue.EmitGoto(labelNext); LLInstructionBlock blockFalse = pFunction.CreateBlock(labelFalse); blockFalse.EmitGoto(labelNext); pFunction.CurrentBlock = pFunction.CreateBlock(labelNext); }
private HLTemporaryLocation(HLType pType) : base(pType) { }
public static HLEnumLiteralLocation Create(HLType pType, string pLiteral) { HLEnumLiteralLocation location = new HLEnumLiteralLocation(pType); location.mLiteral = pLiteral; return location; }
public static HLDefaultLocation Create(HLType pType) { return new HLDefaultLocation(pType); }
private HLParameterLocation(HLType pType) : base(pType) { }
public static HLNullLocation Create(HLType pType) { return new HLNullLocation(pType); }
private HLNullLocation(HLType pType) : base(pType) { }
private HLFieldAddressLocation(HLType pType) : base(pType) { }
private HLTemporaryAddressLocation(HLType pType) : base(pType) { }
public static HLNewArrayInstruction Create(HLMethod pMethod, HLLocation pDestinationSource, HLLocation pSizeSource, HLType pArrayType, HLType pElementType) { HLNewArrayInstruction instruction = new HLNewArrayInstruction(pMethod); instruction.mDestinationSource = pDestinationSource; instruction.mSizeSource = pSizeSource; instruction.mArrayType = pArrayType; instruction.mElementType = pElementType; return(instruction); }
private HLCharLiteralLocation(HLType pType) : base(pType) { }
private HLArrayElementAddressLocation(HLType pType) : base(pType) { }
private HLLocalAddressLocation(HLType pType) : base(pType) { }
private HLLocalLocation(HLType pType) : base(pType) { }
private HLStringLiteralLocation(HLType pType) : base(pType) { }
private HLEnumLiteralLocation(HLType pType) : base(pType) { }
public static HLIndirectAddressLocation Create(HLLocation pAddress, HLType pType) { HLIndirectAddressLocation location = new HLIndirectAddressLocation(HLDomain.GetOrCreateType(MutableModelHelper.GetManagedPointerTypeReference(pType.Definition, HLDomain.Host.InternFactory, pType.Definition))); location.mAddress = pAddress; return location; }
private HLParameterAddressLocation(HLType pType) : base(pType) { }
public static HLArrayElementAddressLocation Create(HLLocation pInstance, HLLocation pIndex, HLType pElementType) { HLArrayElementAddressLocation location = new HLArrayElementAddressLocation(HLDomain.GetOrCreateType(MutableModelHelper.GetManagedPointerTypeReference(pElementType.Definition, HLDomain.Host.InternFactory, pElementType.Definition))); location.mInstance = pInstance; location.mIndex = pIndex; location.mElementType = pElementType; return(location); }
private HLDefaultLocation(HLType pType) : base(pType) { }
internal static LLLocation LoadArrayElementPointer(LLFunction pFunction, HLLocation pInstance, HLLocation pIndex, HLType pElementType) { LLLocation locationIndex = pIndex.Load(pFunction); LLLocation locationElementOffset = locationIndex; long? literalElementOffset = null; if (locationIndex is LLLiteralLocation) { literalElementOffset = Convert.ToInt64(((LLLiteralLocation)locationIndex).Literal.Value) * pElementType.VariableSize; } else if (pElementType.VariableSize > 1) { locationElementOffset = LLTemporaryLocation.Create(pFunction.CreateTemporary(locationIndex.Type)); pFunction.CurrentBlock.EmitMultiply(locationElementOffset, locationIndex, LLLiteralLocation.Create(LLLiteral.Create(locationElementOffset.Type, pElementType.VariableSize.ToString()))); } LLLocation locationArrayPointer = pInstance.Load(pFunction); locationArrayPointer = pFunction.CurrentBlock.EmitConversion(locationArrayPointer, LLModule.GetOrCreatePointerType(LLModule.GetOrCreateUnsignedType(8), 1)); LLLocation locationElementPointer = null; if (literalElementOffset.HasValue) { locationElementOffset = LLLiteralLocation.Create(LLLiteral.Create(LLModule.GetOrCreateSignedType(64), (literalElementOffset.Value + HLDomain.SystemArray.CalculatedSize).ToString())); locationElementPointer = LLTemporaryLocation.Create(pFunction.CreateTemporary(locationArrayPointer.Type)); pFunction.CurrentBlock.EmitGetElementPointer(locationElementPointer, locationArrayPointer, locationElementOffset); } else { LLLocation locationTemporary = LLTemporaryLocation.Create(pFunction.CreateTemporary(locationArrayPointer.Type)); pFunction.CurrentBlock.EmitGetElementPointer(locationTemporary, locationArrayPointer, LLLiteralLocation.Create(LLLiteral.Create(LLModule.GetOrCreateSignedType(32), (HLDomain.SystemArray.CalculatedSize).ToString()))); locationElementPointer = LLTemporaryLocation.Create(pFunction.CreateTemporary(locationArrayPointer.Type)); pFunction.CurrentBlock.EmitGetElementPointer(locationElementPointer, locationTemporary, locationElementOffset); } return(pFunction.CurrentBlock.EmitConversion(locationElementPointer, pElementType.LLType.PointerDepthPlusOne)); }
public static HLArrayElementLocation Create(HLLocation pInstance, HLLocation pIndex, HLType pElementType) { HLArrayElementLocation location = new HLArrayElementLocation(pElementType); location.mInstance = pInstance; location.mIndex = pIndex; location.mElementType = pElementType; return(location); }
private HLArrayLengthLocation(HLType pType) : base(pType) { }
private HLStaticFieldLocation(HLType pType) : base(pType) { }
private HLUInt32LiteralLocation(HLType pType) : base(pType) { }
private HLInt64LiteralLocation(HLType pType) : base(pType) { }
private HLTypeOfLocation(HLType pType) : base(pType) { }
private HLArrayElementLocation(HLType pType) : base(pType) { }
private HLIndirectAddressLocation(HLType pType) : base(pType) { }
private HLBooleanLiteralLocation(HLType pType) : base(pType) { }
private HLUInt16LiteralLocation(HLType pType) : base(pType) { }
private HLFloat32LiteralLocation(HLType pType) : base(pType) { }