This repository has been archived by the owner on Feb 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(new-llvm): heavy llvm purity/redundancy optimizations
- Loading branch information
1 parent
bf1765c
commit 434132d
Showing
27 changed files
with
184 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
backend/common/src/commonMain/kotlin/intrinsic/IntrinsicFunctionExecutor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package me.gabriel.selene.backend.common.intrinsic | ||
|
||
abstract class IntrinsicFunctionExecutor<Context : Any, Value : Any> { | ||
abstract class IntrinsicFunctionExecutor<Context : Any, Module : Any, Value : Any> { | ||
open fun setup(module: Module) {} | ||
|
||
abstract fun onCall(context: Context): Value | ||
} |
8 changes: 4 additions & 4 deletions
8
backend/common/src/commonMain/kotlin/intrinsic/IntrinsicFunctionRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
backend/llvm/src/commonMain/kotlin/intrinsic/DragonIntrinsicFunctionRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
package me.gabriel.selene.backend.llvm.intrinsic | ||
|
||
import me.gabriel.ryujin.dsl.ModuleScopeDsl | ||
import me.gabriel.ryujin.struct.Value | ||
import me.gabriel.selene.backend.common.intrinsic.IntrinsicFunctionExecutor | ||
import me.gabriel.selene.backend.common.intrinsic.IntrinsicFunctionRepository | ||
import me.gabriel.selene.backend.llvm.DragonHookContext | ||
|
||
class DragonIntrinsicFunctionRepository: IntrinsicFunctionRepository<DragonHookContext, Value>() { | ||
override val intrinsics: MutableMap<String, IntrinsicFunctionExecutor<DragonHookContext, Value>> = mutableMapOf( | ||
class DragonIntrinsicFunctionRepository: IntrinsicFunctionRepository<DragonHookContext, ModuleScopeDsl, Value>() { | ||
override val intrinsics: MutableMap<String, IntrinsicFunctionExecutor<DragonHookContext, ModuleScopeDsl, Value>> = mutableMapOf( | ||
"println" to PrintlnIntrinsicFunctionExecutor() | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package me.gabriel.selene.backend.llvm.intrinsic | ||
|
||
import me.gabriel.ryujin.dsl.ModuleScopeDsl | ||
import me.gabriel.ryujin.struct.DragonType | ||
import me.gabriel.ryujin.struct.Value | ||
import me.gabriel.selene.backend.common.intrinsic.IntrinsicFunctionExecutor | ||
import me.gabriel.selene.backend.llvm.DragonHookContext | ||
|
||
class ReadlnIntrinsicFunctionExecutor: IntrinsicFunctionExecutor<DragonHookContext, ModuleScopeDsl, Value>() { | ||
override fun onCall(context: DragonHookContext): Value { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun setup(module: ModuleScopeDsl) { | ||
module.run { | ||
function( | ||
name = "readln", | ||
returnType = DragonType.Pointer(DragonType.Int8), | ||
parameters = emptyList() | ||
) { | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.