Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
Interface Dispatch (#1848)
Browse files Browse the repository at this point in the history
Interface Dispatch implementation
  • Loading branch information
A-And authored and jkotas committed Sep 16, 2016
1 parent 3358184 commit c6a2b27
Show file tree
Hide file tree
Showing 5 changed files with 308 additions and 168 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the LICENSE file in the project root for more information.

using System;

using ILCompiler.DependencyAnalysisFramework;
using Internal.TypeSystem;

namespace ILCompiler.DependencyAnalysis
Expand All @@ -15,6 +15,12 @@ public CppCodegenNodeFactory(CompilerTypeSystemContext context, CompilationModul
{
}

public override void AttachToDependencyGraph(DependencyAnalysisFramework.DependencyAnalyzerBase<NodeFactory> graph)
{
AddWellKnownTypes(graph);
base.AttachToDependencyGraph(graph);
}

protected override IMethodNode CreateMethodEntrypointNode(MethodDesc method)
{
if (CompilationModuleGroup.ContainsMethod(method))
Expand All @@ -38,5 +44,33 @@ protected override ISymbolNode CreateReadyToRunHelperNode(Tuple<ReadyToRunHelper
// TODO: this is wrong: this returns an assembly stub node
return new ReadyToRunHelperNode(helperCall.Item1, helperCall.Item2);
}

private void AddWellKnownType(WellKnownType wellKnownType, DependencyAnalysisFramework.DependencyAnalyzerBase<NodeFactory> graph)
{
var type = TypeSystemContext.GetWellKnownType(wellKnownType);
var typeNode = ConstructedTypeSymbol(type);
graph.AddRoot(typeNode, "Enables CPP codegen");
}
private void AddWellKnownTypes(DependencyAnalysisFramework.DependencyAnalyzerBase<NodeFactory> graph)
{

AddWellKnownType(WellKnownType.Void, graph);
AddWellKnownType(WellKnownType.Boolean, graph);
AddWellKnownType(WellKnownType.Char, graph);
AddWellKnownType(WellKnownType.SByte, graph);
AddWellKnownType(WellKnownType.Byte, graph);
AddWellKnownType(WellKnownType.Int16, graph);
AddWellKnownType(WellKnownType.UInt16, graph);
AddWellKnownType(WellKnownType.Int32, graph);
AddWellKnownType(WellKnownType.UInt32, graph);
AddWellKnownType(WellKnownType.Int64, graph);
AddWellKnownType(WellKnownType.UInt64, graph);
AddWellKnownType(WellKnownType.IntPtr, graph);
AddWellKnownType(WellKnownType.UIntPtr, graph);
AddWellKnownType(WellKnownType.Single, graph);
AddWellKnownType(WellKnownType.Double, graph);

}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ public string GetSymbolAlternateName(ISymbolNode node)
public static NameMangler NameMangler;
public static string CompilationUnitPrefix;

public void AttachToDependencyGraph(DependencyAnalysisFramework.DependencyAnalyzerBase<NodeFactory> graph)
public virtual void AttachToDependencyGraph(DependencyAnalysisFramework.DependencyAnalyzerBase<NodeFactory> graph)
{
ReadyToRunHeader = new ReadyToRunHeaderNode(Target);

Expand Down
Loading

0 comments on commit c6a2b27

Please sign in to comment.