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);
        }
        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);
        }