aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2024-03-30 14:03:18 +0000
committerMichael Williamson <mike@zwobble.org>2024-03-30 14:03:18 +0000
commit72bb083256e85b44b998d15e4b2aa74db0213a6a (patch)
treefad3e4d3bc8d343b746c841a920379bf35ef8792 /src/main/java
parentba1d43354da18aa473200fefde8316e8017841a7 (diff)
Make LlvmCompiler static
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/LlvmBackend.java9
-rw-r--r--src/main/java/org/shedlang/compiler/backends/llvm/LlvmCompiler.java12
2 files changed, 4 insertions, 17 deletions
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/LlvmBackend.java b/src/main/java/org/shedlang/compiler/backends/llvm/LlvmBackend.java
index f2c7c2ef..0789467a 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/LlvmBackend.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/LlvmBackend.java
@@ -66,7 +66,6 @@ public class LlvmBackend implements Backend {
namespaces,
typeInfos,
new PatioToBinary(
- LlvmCompiler.forTarget(this.target),
targetDir,
P.vector(),
PatioToLlvmGlobalContext.empty(this.target)
@@ -75,18 +74,15 @@ public class LlvmBackend implements Backend {
}
private class PatioToBinary implements PatioBackends.PatioToTarget {
- private final LlvmCompiler llvmCompiler;
private final TargetDir targetDir;
private final PVector<Path> objectFilePaths;
private final PatioToLlvmGlobalContext patioToLlvmGlobalContext;
public PatioToBinary(
- LlvmCompiler llvmCompiler,
TargetDir targetDir,
PVector<Path> objectFilePaths,
PatioToLlvmGlobalContext patioToLlvmGlobalContext
) {
- this.llvmCompiler = llvmCompiler;
this.targetDir = targetDir;
this.objectFilePaths = objectFilePaths;
this.patioToLlvmGlobalContext = patioToLlvmGlobalContext;
@@ -104,13 +100,12 @@ public class LlvmBackend implements Backend {
var llvmModule = llvmModuleResult.value();
var patioToLlvmGlobalContext = llvmModuleResult.context();
- var objectPath = llvmCompiler.compileLlvmModule(
+ var objectPath = LlvmCompiler.compileLlvmModule(
llvmModule,
targetDir.namespace(namespaceName)
);
return new PatioToBinary(
- this.llvmCompiler,
this.targetDir,
this.objectFilePaths.plus(objectPath),
patioToLlvmGlobalContext
@@ -131,7 +126,7 @@ public class LlvmBackend implements Backend {
mainFunctionName,
patioToLlvmGlobalContext
);
- var mainObjectPath = llvmCompiler.compileLlvmModule(mainModule, targetDir.bin(binName));
+ var mainObjectPath = LlvmCompiler.compileLlvmModule(mainModule, targetDir.bin(binName));
linkInputs.add(mainObjectPath);
var shedRuntime = ShedRuntime.runtime(
diff --git a/src/main/java/org/shedlang/compiler/backends/llvm/LlvmCompiler.java b/src/main/java/org/shedlang/compiler/backends/llvm/LlvmCompiler.java
index 3166659e..4a2ce026 100644
--- a/src/main/java/org/shedlang/compiler/backends/llvm/LlvmCompiler.java
+++ b/src/main/java/org/shedlang/compiler/backends/llvm/LlvmCompiler.java
@@ -15,17 +15,9 @@ import java.util.List;
import static org.shedlang.compiler.util.processes.ProcessRunner.runInheritIo;
public class LlvmCompiler {
- public static LlvmCompiler forTarget(LlvmTarget target) {
- return new LlvmCompiler(target);
- }
-
- private final LlvmTarget target;
-
- private LlvmCompiler(LlvmTarget target) {
- this.target = target;
- }
+ private LlvmCompiler() {}
- public Path compileLlvmModule(
+ public static Path compileLlvmModule(
LlvmModule llvmModule,
PartialTargetPath targetPath
) throws IOException, InterruptedException {