Skip to content

Commit

Permalink
Merge pull request #29 from tgiphil/master
Browse files Browse the repository at this point in the history
Worked on move hints
  • Loading branch information
tgiphil committed Mar 30, 2014
2 parents 62ca0ea + 38ec304 commit 8071ad1
Show file tree
Hide file tree
Showing 27 changed files with 542 additions and 216 deletions.
10 changes: 5 additions & 5 deletions Source/Mosa.Compiler.Common/SimplePriorityQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ namespace Mosa.Compiler.Common
{
public class SimpleKeyPriorityQueue<T>
{
private readonly LinkedList<KeyValuePair<int, T>> items;
private readonly LinkedList<Tuple<int, T>> items;

public int Count { get { return items.Count; } }

public bool IsEmpty { get { return items.Count == 0; } }

public SimpleKeyPriorityQueue()
{
items = new LinkedList<KeyValuePair<int, T>>();
items = new LinkedList<Tuple<int, T>>();
}

public void Enqueue(int priority, T item)
{
var keyitem = new KeyValuePair<int, T>(priority, item);
var keyitem = new Tuple<int, T>(priority, item);

if (IsEmpty)
{
Expand All @@ -36,7 +36,7 @@ public void Enqueue(int priority, T item)

var at = items.First;

while (at != null && priority < at.Value.Key)
while (at != null && priority < at.Value.Item1)
{
at = at.Next;
}
Expand All @@ -55,7 +55,7 @@ public T Dequeue()
{
var item = items.First.Value;
items.RemoveFirst();
return item.Value;
return item.Item2;
}
}
}
7 changes: 7 additions & 0 deletions Source/Mosa.Compiler.Framework/BaseArchitecture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ public abstract class BaseArchitecture
/// <param name="source2">The source2.</param>
public abstract void InsertSubInstruction(Context context, Operand destination, Operand source1, Operand source2);

/// <summary>
/// Determines whether [is instruction move] [the specified instruction].
/// </summary>
/// <param name="instruction">The instruction.</param>
/// <returns></returns>
public abstract bool IsInstructionMove(BaseInstruction instruction);

#endregion Methods
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Mosa.Compiler.Framework.CIL
/// <summary>
///
/// </summary>
public sealed class BinaryBranchInstruction : BinaryInstruction, IBranchInstruction
public sealed class BinaryBranchInstruction : BinaryInstruction
{
#region Construction

Expand Down Expand Up @@ -106,11 +106,5 @@ protected override string GetModifier(Context context)
}

#endregion Methods

/// <summary>
/// Determines if the branch is conditional.
/// </summary>
/// <value></value>
public bool IsConditional { get { return true; } }
}
}
8 changes: 1 addition & 7 deletions Source/Mosa.Compiler.Framework/CIL/BranchInstruction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Mosa.Compiler.Framework.CIL
/// <summary>
///
/// </summary>
public class BranchInstruction : BaseCILInstruction, IBranchInstruction
public class BranchInstruction : BaseCILInstruction
{
#region Construction

Expand Down Expand Up @@ -68,11 +68,5 @@ public override void Visit(ICILVisitor visitor, Context context)
}

#endregion Methods

/// <summary>
/// Determines if the branch is conditional.
/// </summary>
/// <value></value>
public bool IsConditional { get { return false; } }
}
}
26 changes: 0 additions & 26 deletions Source/Mosa.Compiler.Framework/CIL/IBranchInstruction.cs

This file was deleted.

8 changes: 1 addition & 7 deletions Source/Mosa.Compiler.Framework/CIL/ReturnInstruction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Mosa.Compiler.Framework.CIL
/// <summary>
///
/// </summary>
public sealed class ReturnInstruction : UnaryInstruction, IBranchInstruction
public sealed class ReturnInstruction : UnaryInstruction
{
#region Construction

Expand Down Expand Up @@ -78,11 +78,5 @@ public override void Visit(ICILVisitor visitor, Context context)
}

#endregion Methods

/// <summary>
/// Determines if the branch is conditional.
/// </summary>
/// <value></value>
public bool IsConditional { get { return false; } }
}
}
8 changes: 1 addition & 7 deletions Source/Mosa.Compiler.Framework/CIL/UnaryBranchInstruction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Mosa.Compiler.Framework.CIL
/// <remarks>
/// This instruction is used to represent brfalse[.s] and brtrue[.s].
/// </remarks>
public class UnaryBranchInstruction : UnaryInstruction, IBranchInstruction
public class UnaryBranchInstruction : UnaryInstruction
{
#region Construction

Expand Down Expand Up @@ -106,11 +106,5 @@ protected override string GetModifier(Context context)
}

#endregion Methods

/// <summary>
/// Determines if the branch is conditional.
/// </summary>
/// <value></value>
public bool IsConditional { get { return true; } }
}
}
4 changes: 2 additions & 2 deletions Source/Mosa.Compiler.Framework/Mosa.Compiler.Framework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
<Compile Include="IR\CompoundMove.cs" />
<Compile Include="IR\CompoundStore.cs" />
<Compile Include="Analysis\IBlockOrderAnalysis.cs" />
<Compile Include="RegisterAllocator\MoveHint.cs" />
<Compile Include="ShiftType.cs" />
<Compile Include="ConditionCodeExtension.cs" />
<Compile Include="BasicBlocks.cs" />
Expand All @@ -101,7 +102,7 @@
<Compile Include="RegisterAllocator\MoveResolver.cs" />
<Compile Include="RegisterAllocator\Interval.cs" />
<Compile Include="RegisterAllocator\SlotIndex.cs" />
<Compile Include="RegisterAllocator\LiveIntervalUnion.cs" />
<Compile Include="RegisterAllocator\LiveIntervalTrack.cs" />
<Compile Include="RegisterAllocator\ExtendedBlock.cs" />
<Compile Include="RegisterAllocator\LiveInterval.cs" />
<Compile Include="RegisterAllocator\VirtualRegister.cs" />
Expand Down Expand Up @@ -212,7 +213,6 @@
<Compile Include="CIL\DupInstruction.cs" />
<Compile Include="CIL\EndFilterInstruction.cs" />
<Compile Include="CIL\EndFinallyInstruction.cs" />
<Compile Include="CIL\IBranchInstruction.cs" />
<Compile Include="CIL\InitblkInstruction.cs" />
<Compile Include="CIL\InitObjInstruction.cs" />
<Compile Include="CIL\InvokeInstruction.cs" />
Expand Down
Loading

0 comments on commit 8071ad1

Please sign in to comment.