示例#1
0
        internal override void Store(LLFunction pFunction, LLLocation pSource)
        {
            LLLocation locationLocal  = LLLocalLocation.Create(pFunction.Locals[Temporary.Name]);
            LLLocation locationSource = pFunction.CurrentBlock.EmitConversion(pSource, locationLocal.Type.PointerDepthMinusOne);

            pFunction.CurrentBlock.EmitStore(locationLocal, locationSource);
        }
示例#2
0
        internal override LLLocation Load(LLFunction pFunction)
        {
            LLLocation locationLocal     = LLLocalLocation.Create(pFunction.Locals[Temporary.Name]);
            LLLocation locationTemporary = LLTemporaryLocation.Create(pFunction.CreateTemporary(locationLocal.Type.PointerDepthMinusOne));

            pFunction.CurrentBlock.EmitLoad(locationTemporary, locationLocal);
            return(locationTemporary);
        }
示例#3
0
 internal override LLLocation Load(LLFunction pFunction)
 {
     if (!Parameter.RequiresAddressing)
     {
         throw new NotSupportedException();
     }
     return(LLLocalLocation.Create(Parameter.AddressableLocal));
 }
示例#4
0
        internal override LLLocation Load(LLFunction pFunction)
        {
            LLLocation location = LLLocalLocation.Create(pFunction.Locals[Local.Name]);

            if (mLocal.IsReference)
            {
                location = location.Load(pFunction.CurrentBlock);
            }
            return(location);
        }
示例#5
0
        internal override void Store(LLFunction pFunction, LLLocation pSource)
        {
            if (!Parameter.RequiresAddressing)
            {
                throw new NotSupportedException();
            }
            LLLocation locationLocal  = LLLocalLocation.Create(Parameter.AddressableLocal);
            LLLocation locationSource = pFunction.CurrentBlock.EmitConversion(pSource, locationLocal.Type.PointerDepthMinusOne);

            pFunction.CurrentBlock.EmitStore(locationLocal, locationSource);
        }
示例#6
0
        internal override LLLocation Load(LLFunction pFunction)
        {
            LLLocation locationTemporary = null;

            if (!Parameter.RequiresAddressing)
            {
                locationTemporary = LLParameterLocation.Create(pFunction.Parameters[Parameter.Name]);
            }
            else
            {
                LLLocation locationLocal = LLLocalLocation.Create(Parameter.AddressableLocal);
                locationTemporary = LLTemporaryLocation.Create(pFunction.CreateTemporary(locationLocal.Type.PointerDepthMinusOne));
                pFunction.CurrentBlock.EmitLoad(locationTemporary, locationLocal);
            }
            return(locationTemporary);
        }
示例#7
0
        internal void Transform()
        {
            Labels.ForEach(l => LLFunction.CreateLabel(l.Identifier));

            foreach (HLInstructionBlock hl in Blocks)
            {
                LLInstructionBlock ll = LLFunction.CreateBlock(LLFunction.Labels.GetByIdentifier(hl.StartLabel.Identifier));
                LLFunction.CurrentBlock = ll;
                if (hl == Blocks.First())
                {
                    foreach (HLParameter parameter in Parameters.Where(p => p.RequiresAddressing))
                    {
                        LLFunction.CurrentBlock.EmitStore(LLLocalLocation.Create(parameter.AddressableLocal), LLParameterLocation.Create(LLFunction.Parameters[parameter.Name]));
                    }
                }

                hl.Instructions.ForEach(i => i.Transform(LLFunction));
            }
        }
示例#8
0
        public LLInstructionBlock CreateBlock(LLLabel pStartLabel)
        {
            if (mBlocks == null)
            {
                mBlocks = new List <LLInstructionBlock>();
            }
            LLInstructionBlock block = LLInstructionBlock.Create(this, pStartLabel);

            mBlocks.Add(block);
            if (mBlocks.Count == 1)
            {
                if (mLocals != null)
                {
                    foreach (LLLocal local in mLocals)
                    {
                        block.EmitAllocate(LLLocalLocation.Create(local));
                    }
                }
            }
            return(block);
        }
示例#9
0
 internal override LLLocation Load(LLFunction pFunction)
 {
     return(LLLocalLocation.Create(pFunction.Locals[Temporary.Name]));
 }