Refactor: switch to IR-based HPC codegen pipeline
Major rewrite replacing Roslyn syntax rewriters with an intermediate representation (IR) architecture. Adds IR nodes, analyzer, type resolver, and node rewriter base for optimization passes (e.g., FMA fusion). Refactors AVX2 backend to emit from IR and updates generator pipeline for analysis, optimization, and emission. Removes legacy rewriter classes. Adds polyfills for modern C# features and updates tests and project settings for latest language version. This enables advanced optimizations, easier backend targeting, and future extensibility.
This commit is contained in:
31
Misaki.HighPerformance.HPC.Generator/Polyfills.cs
Normal file
31
Misaki.HighPerformance.HPC.Generator/Polyfills.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
// Polyfills needed for modern C# features on netstandard2.0 target.
|
||||
// These types are built into .NET 5+ runtimes but must be declared manually
|
||||
// when targeting netstandard2.0, which source generators must do.
|
||||
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
// Enables `init` accessors and `record` types (C# 9)
|
||||
internal static class IsExternalInit { }
|
||||
|
||||
// Enables `required` members (C# 11)
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
|
||||
AttributeTargets.Field | AttributeTargets.Property,
|
||||
AllowMultiple = false, Inherited = false)]
|
||||
internal sealed class RequiredMemberAttribute : Attribute { }
|
||||
|
||||
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
|
||||
internal sealed class CompilerFeatureRequiredAttribute : Attribute
|
||||
{
|
||||
public CompilerFeatureRequiredAttribute(string featureName)
|
||||
=> FeatureName = featureName;
|
||||
public string FeatureName { get; }
|
||||
public bool IsOptional { get; init; }
|
||||
}
|
||||
}
|
||||
|
||||
namespace System.Diagnostics.CodeAnalysis
|
||||
{
|
||||
// Enables `required` constructor attribution (C# 11)
|
||||
[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
|
||||
internal sealed class SetsRequiredMembersAttribute : Attribute { }
|
||||
}
|
||||
Reference in New Issue
Block a user