diff --git a/compiler/forget/src/CompilerPipeline.ts b/compiler/forget/src/CompilerPipeline.ts index 6f51a55070..c8d6c2a8fe 100644 --- a/compiler/forget/src/CompilerPipeline.ts +++ b/compiler/forget/src/CompilerPipeline.ts @@ -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, diff --git a/compiler/forget/src/HIR/index.ts b/compiler/forget/src/HIR/index.ts index 7f68353c85..9753e1f112 100644 --- a/compiler/forget/src/HIR/index.ts +++ b/compiler/forget/src/HIR/index.ts @@ -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"; diff --git a/compiler/forget/src/HIR/InferAlias.ts b/compiler/forget/src/Inference/InferAlias.ts similarity index 91% rename from compiler/forget/src/HIR/InferAlias.ts rename to compiler/forget/src/Inference/InferAlias.ts index 337c0cad06..970e3fe2f6 100644 --- a/compiler/forget/src/HIR/InferAlias.ts +++ b/compiler/forget/src/Inference/InferAlias.ts @@ -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; diff --git a/compiler/forget/src/HIR/InferAliasForStores.ts b/compiler/forget/src/Inference/InferAliasForStores.ts similarity index 94% rename from compiler/forget/src/HIR/InferAliasForStores.ts rename to compiler/forget/src/Inference/InferAliasForStores.ts index 92881ad3de..a98e013dba 100644 --- a/compiler/forget/src/HIR/InferAliasForStores.ts +++ b/compiler/forget/src/Inference/InferAliasForStores.ts @@ -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, diff --git a/compiler/forget/src/HIR/InferMutableLifetimes.ts b/compiler/forget/src/Inference/InferMutableLifetimes.ts similarity index 96% rename from compiler/forget/src/HIR/InferMutableLifetimes.ts rename to compiler/forget/src/Inference/InferMutableLifetimes.ts index e836f256dc..1af0efa1ce 100644 --- a/compiler/forget/src/HIR/InferMutableLifetimes.ts +++ b/compiler/forget/src/Inference/InferMutableLifetimes.ts @@ -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 diff --git a/compiler/forget/src/HIR/InferMutableRanges.ts b/compiler/forget/src/Inference/InferMutableRanges.ts similarity index 96% rename from compiler/forget/src/HIR/InferMutableRanges.ts rename to compiler/forget/src/Inference/InferMutableRanges.ts index 63a59bbd69..43da935c03 100644 --- a/compiler/forget/src/HIR/InferMutableRanges.ts +++ b/compiler/forget/src/Inference/InferMutableRanges.ts @@ -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"; diff --git a/compiler/forget/src/HIR/InferMutableRangesForAlias.ts b/compiler/forget/src/Inference/InferMutableRangesForAlias.ts similarity index 95% rename from compiler/forget/src/HIR/InferMutableRangesForAlias.ts rename to compiler/forget/src/Inference/InferMutableRangesForAlias.ts index 576eac7e26..56f8360001 100644 --- a/compiler/forget/src/HIR/InferMutableRangesForAlias.ts +++ b/compiler/forget/src/Inference/InferMutableRangesForAlias.ts @@ -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) { const aliasSets = aliases.buildSets(); diff --git a/compiler/forget/src/HIR/InferReferenceEffects.ts b/compiler/forget/src/Inference/InferReferenceEffects.ts similarity index 99% rename from compiler/forget/src/HIR/InferReferenceEffects.ts rename to compiler/forget/src/Inference/InferReferenceEffects.ts index 0a6c727594..94dc09087a 100644 --- a/compiler/forget/src/HIR/InferReferenceEffects.ts +++ b/compiler/forget/src/Inference/InferReferenceEffects.ts @@ -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 diff --git a/compiler/forget/src/Inference/index.ts b/compiler/forget/src/Inference/index.ts new file mode 100644 index 0000000000..e6508e1fae --- /dev/null +++ b/compiler/forget/src/Inference/index.ts @@ -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"; diff --git a/compiler/forget/src/index.ts b/compiler/forget/src/index.ts index 9ee0c7b02c..71a8d88f9e 100644 --- a/compiler/forget/src/index.ts +++ b/compiler/forget/src/index.ts @@ -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";