[hir] Move inference passes to separate folder

This commit is contained in:
Sathya Gunasekaran
2023-01-04 21:11:37 +00:00
parent d187fff414
commit b8fd4680b1
10 changed files with 38 additions and 21 deletions
+2 -7
View File
@@ -6,13 +6,8 @@
*/
import { NodePath } from "@babel/traverse";
import * as t from "@babel/types";
import {
Environment,
HIRFunction,
inferMutableRanges,
inferReferenceEffects,
lower,
} from "./HIR";
import { inferMutableRanges, inferReferenceEffects } from "./Inference";
import { Environment, HIRFunction, lower } from "./HIR";
import { ReactiveFunction } from "./HIR/HIR";
import {
buildReactiveFunction,
-2
View File
@@ -8,6 +8,4 @@
export { lower } from "./BuildHIR";
export { HIRFunction } from "./HIR";
export { Environment } from "./HIRBuilder";
export { inferMutableRanges } from "./InferMutableRanges";
export { default as inferReferenceEffects } from "./InferReferenceEffects";
export { printFunction } from "./PrintHIR";
@@ -1,5 +1,11 @@
import DisjointSet from "../Utils/DisjointSet";
import { HIRFunction, Identifier, Instruction, LValue, Place } from "./HIR";
import {
HIRFunction,
Identifier,
Instruction,
LValue,
Place,
} from "../HIR/HIR";
export type AliasSet = Set<Identifier>;
@@ -5,7 +5,13 @@
* LICENSE file in the root directory of this source tree.
*/
import DisjointSet from "../Utils/DisjointSet";
import { Effect, HIRFunction, Identifier, InstructionId, Place } from "./HIR";
import {
Effect,
HIRFunction,
Identifier,
InstructionId,
Place,
} from "../HIR/HIR";
export function inferAliasForStores(
func: HIRFunction,
@@ -13,9 +13,9 @@ import {
Instruction,
makeInstructionId,
Place,
} from "./HIR";
import { printInstruction, printPlace } from "./PrintHIR";
import { eachInstructionOperand } from "./visitors";
} from "../HIR/HIR";
import { printInstruction, printPlace } from "../HIR/PrintHIR";
import { eachInstructionOperand } from "../HIR/visitors";
/**
* For each usage of a value in the given function, determines if the usage
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import { HIRFunction } from "./HIR";
import { HIRFunction } from "../HIR/HIR";
import { inferAliases } from "./InferAlias";
import { inferAliasForStores } from "./InferAliasForStores";
import { inferMutableLifetimes } from "./InferMutableLifetimes";
@@ -1,5 +1,5 @@
import DisjointSet from "../Utils/DisjointSet";
import { Identifier, InstructionId } from "./HIR";
import { Identifier, InstructionId } from "../HIR/HIR";
export function inferMutableRangesForAlias(aliases: DisjointSet<Identifier>) {
const aliasSets = aliases.buildSets();
@@ -18,13 +18,17 @@ import {
Phi,
Place,
ValueKind,
} from "./HIR";
import { printMixedHIR, printPlace, printSourceLocation } from "./PrintHIR";
} from "../HIR/HIR";
import {
printMixedHIR,
printPlace,
printSourceLocation,
} from "../HIR/PrintHIR";
import {
eachInstructionOperand,
eachTerminalOperand,
eachTerminalSuccessor,
} from "./visitors";
} from "../HIR/visitors";
/**
* For every usage of a value in the given function, infers the effect or action
+9
View File
@@ -0,0 +1,9 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
export { inferMutableRanges } from "./InferMutableRanges";
export { default as inferReferenceEffects } from "./InferReferenceEffects";
+1 -2
View File
@@ -17,8 +17,7 @@ import * as t from "@babel/types";
import { lower } from "./HIR/BuildHIR";
import codegen from "./HIR/Codegen";
import { Environment } from "./HIR/HIRBuilder";
import { inferMutableRanges } from "./HIR/InferMutableRanges";
import inferReferenceEffects from "./HIR/InferReferenceEffects";
import { inferMutableRanges, inferReferenceEffects } from "./Inference";
import { inferTypes } from "./TypeInference";
import printHIR, { printFunction } from "./HIR/PrintHIR";
import { buildReactiveFunction } from "./ReactiveScopes/BuildReactiveFunction";