Ejemplo n.º 1
0
        public LivenessAnalysis(BaseLivenessAnalysisEnvironment environment, CreateTraceHandler createTrace, bool numberInstructions)
        {
            Environment = environment;
            CreateTrace = createTrace;

            LiveRanges = new LiveRanges[IndexCount];

            for (int i = 0; i < IndexCount; i++)
            {
                LiveRanges[i] = new LiveRanges();
            }

            if (numberInstructions)
            {
                NumberInstructions();
            }

            TraceNumberInstructions();

            CreateExtendedBlocks();

            ComputeLocalLiveSets();

            ComputeLocalLiveSets();

            BuildLiveIntervals();
        }
Ejemplo n.º 2
0
        public SparseConditionalConstantPropagation(BasicBlocks basicBlocks, CreateTraceHandler createTrace)
        {
            // Method is empty - must be a plugged method
            if (basicBlocks.HeadBlocks.Count == 0)
            {
                return;
            }

            CreateTrace = createTrace;
            BasicBlocks = basicBlocks;

            variableStates      = new Dictionary <Operand, VariableState>();
            instructionWorkList = new Stack <InstructionNode>();
            blockWorklist       = new Stack <BasicBlock>();
            phiStatements       = new KeyedList <BasicBlock, InstructionNode>();
            executedStatements  = new HashSet <InstructionNode>();

            MainTrace = CreateTrace("SparseConditionalConstantPropagation", 5);

            blockStates = new bool[BasicBlocks.Count];

            for (int i = 0; i < BasicBlocks.Count; i++)
            {
                blockStates[i] = false;
            }

            // Initialize
            foreach (var block in BasicBlocks.HeadBlocks)
            {
                AddExecutionBlock(block);
            }

            foreach (var block in BasicBlocks.HandlerHeadBlocks)
            {
                AddExecutionBlock(block);
            }

            while (blockWorklist.Count > 0 || instructionWorkList.Count > 0)
            {
                ProcessBlocks();
                ProcessInstructions();
            }

            DumpTrace();

            // Release
            phiStatements = null;
        }
Ejemplo n.º 3
0
 public GreedyRegisterAllocator(BasicBlocks basicBlocks, VirtualRegisters virtualRegisters, BaseArchitecture architecture, AddStackLocalDelegate addStackLocal, Operand stackFrame, CreateTraceHandler createTrace)
     : base(basicBlocks, virtualRegisters, architecture, addStackLocal, stackFrame, createTrace)
 {
 }