Ejemplo n.º 1
0
        public static LLGotoInstruction Create(LLFunction pFunction, LLLabel pTargetLabel)
        {
            LLGotoInstruction instruction = new LLGotoInstruction(pFunction);

            instruction.mTargetLabel = pTargetLabel;
            return(instruction);
        }
Ejemplo n.º 2
0
 public static LLSwitchCase Create(LLLiteral pLiteral, LLLabel pLabel)
 {
     LLSwitchCase switchCase = new LLSwitchCase();
     switchCase.mLiteral = pLiteral;
     switchCase.mLabel = pLabel;
     return switchCase;
 }
Ejemplo n.º 3
0
        public static LLLabelInstruction Create(LLFunction pFunction, LLLabel pLabel)
        {
            LLLabelInstruction instruction = new LLLabelInstruction(pFunction);

            instruction.mLabel = pLabel;
            return(instruction);
        }
Ejemplo n.º 4
0
 public static LLBranchInstruction Create(LLFunction pFunction, LLLocation pConditionSource, LLLabel pTrueTargetLabel, LLLabel pFalseTargetLabel)
 {
     LLBranchInstruction instruction = new LLBranchInstruction(pFunction);
     instruction.mConditionSource = pConditionSource;
     instruction.mTrueTargetLabel = pTrueTargetLabel;
     instruction.mFalseTargetLabel = pFalseTargetLabel;
     return instruction;
 }
Ejemplo n.º 5
0
        public static LLSwitchCase Create(LLLiteral pLiteral, LLLabel pLabel)
        {
            LLSwitchCase switchCase = new LLSwitchCase();

            switchCase.mLiteral = pLiteral;
            switchCase.mLabel   = pLabel;
            return(switchCase);
        }
        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);
        }
Ejemplo n.º 7
0
 public static LLGotoInstruction Create(LLFunction pFunction, LLLabel pTargetLabel)
 {
     LLGotoInstruction instruction = new LLGotoInstruction(pFunction);
     instruction.mTargetLabel = pTargetLabel;
     return instruction;
 }
Ejemplo n.º 8
0
 public static LLLabelInstruction Create(LLFunction pFunction, LLLabel pLabel)
 {
     LLLabelInstruction instruction = new LLLabelInstruction(pFunction);
     instruction.mLabel = pLabel;
     return instruction;
 }
Ejemplo n.º 9
0
        public static LLBranchInstruction Create(LLFunction pFunction, LLLocation pConditionSource, LLLabel pTrueTargetLabel, LLLabel pFalseTargetLabel)
        {
            LLBranchInstruction instruction = new LLBranchInstruction(pFunction);

            instruction.mConditionSource  = pConditionSource;
            instruction.mTrueTargetLabel  = pTrueTargetLabel;
            instruction.mFalseTargetLabel = pFalseTargetLabel;
            return(instruction);
        }
Ejemplo n.º 10
0
        public static LLSwitchInstruction Create(LLFunction pFunction, LLLocation pConditionSource, LLLabel pDefaultTargetLabel, List <LLSwitchCase> pCases)
        {
            LLSwitchInstruction instruction = new LLSwitchInstruction(pFunction);

            instruction.mConditionSource    = pConditionSource;
            instruction.mDefaultTargetLabel = pDefaultTargetLabel;
            instruction.mCases = new List <LLSwitchCase>(pCases);
            return(instruction);
        }
Ejemplo n.º 11
0
 public static LLSwitchInstruction Create(LLFunction pFunction, LLLocation pConditionSource, LLLabel pDefaultTargetLabel, List<LLSwitchCase> pCases)
 {
     LLSwitchInstruction instruction = new LLSwitchInstruction(pFunction);
     instruction.mConditionSource = pConditionSource;
     instruction.mDefaultTargetLabel = pDefaultTargetLabel;
     instruction.mCases = new List<LLSwitchCase>(pCases);
     return instruction;
 }