From 36bca8ac06808464eca36b629ac338328aff30b8 Mon Sep 17 00:00:00 2001 From: dev-m03 Date: Mon, 26 Jan 2026 00:34:10 +0530 Subject: [PATCH 1/6] fixing string model mixing --- docs/index.md | 2 +- src/irx/builders/llvmliteir.py | 35 ++++++++++++++-------------------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/docs/index.md b/docs/index.md index 32d46ee..94389ae 120000 --- a/docs/index.md +++ b/docs/index.md @@ -1 +1 @@ -../README.md \ No newline at end of file +../README.md diff --git a/src/irx/builders/llvmliteir.py b/src/irx/builders/llvmliteir.py index e2fe53b..5e6effa 100644 --- a/src/irx/builders/llvmliteir.py +++ b/src/irx/builders/llvmliteir.py @@ -90,9 +90,7 @@ class VariablesLLVM: INT32_TYPE: ir.types.Type VOID_TYPE: ir.types.Type BOOLEAN_TYPE: ir.types.Type - STRING_TYPE: ir.types.Type - ASCII_STRING_TYPE: ir.types.Type - UTF8_STRING_TYPE: ir.types.Type + TIMESTAMP_TYPE: ir.types.Type DATETIME_TYPE: ir.types.Type SIZE_T_TYPE: ir.types.Type @@ -134,11 +132,11 @@ def get_data_type(self, type_name: str) -> ir.types.Type: elif type_name == "char": return self.INT8_TYPE elif type_name == "string": - return self.STRING_TYPE + return ir.IntType(8).as_pointer() elif type_name == "stringascii": - return self.ASCII_STRING_TYPE + return ir.IntType(8).as_pointer() elif type_name == "utf8string": - return self.UTF8_STRING_TYPE + return ir.IntType(8).as_pointer() elif type_name == "nonetype": return self.VOID_TYPE @@ -214,11 +212,7 @@ def initialize(self) -> None: self._llvm.INT32_TYPE = ir.IntType(32) self._llvm.INT64_TYPE = ir.IntType(64) self._llvm.VOID_TYPE = ir.VoidType() - self._llvm.STRING_TYPE = ir.LiteralStructType( - [ir.IntType(32), ir.IntType(8).as_pointer()] - ) - self._llvm.ASCII_STRING_TYPE = ir.IntType(8).as_pointer() - self._llvm.UTF8_STRING_TYPE = self._llvm.STRING_TYPE + # Composite types self._llvm.TIMESTAMP_TYPE = ir.LiteralStructType( [ @@ -1620,8 +1614,8 @@ def _create_string_concat_function(self) -> ir.Function: return self._llvm.module.get_global(func_name) func_type = ir.FunctionType( - self._llvm.ASCII_STRING_TYPE, - [self._llvm.ASCII_STRING_TYPE, self._llvm.ASCII_STRING_TYPE], + ir.IntType(8).as_pointer(), + [ir.IntType(8).as_pointer(), ir.IntType(8).as_pointer()], ) func = ir.Function(self._llvm.module, func_type, func_name) @@ -1636,7 +1630,7 @@ def _create_string_length_function(self) -> ir.Function: # Function signature: string_length(char* str) -> i32 func_type = ir.FunctionType( - self._llvm.INT32_TYPE, [self._llvm.ASCII_STRING_TYPE] + self._llvm.INT32_TYPE, [ir.IntType(8).as_pointer()] ) func = ir.Function(self._llvm.module, func_type, func_name) func.linkage = "external" @@ -1651,7 +1645,7 @@ def _create_string_equals_function(self) -> ir.Function: # Function signature: string_equals(char* str1, char* str2) -> i1 func_type = ir.FunctionType( self._llvm.BOOLEAN_TYPE, - [self._llvm.ASCII_STRING_TYPE, self._llvm.ASCII_STRING_TYPE], + [ir.IntType(8).as_pointer(), ir.IntType(8).as_pointer()], ) func = ir.Function(self._llvm.module, func_type, func_name) func.linkage = "external" @@ -1665,9 +1659,9 @@ def _create_string_substring_function(self) -> ir.Function: # string_substring(char* str, i32 start, i32 length) -> char* func_type = ir.FunctionType( - self._llvm.ASCII_STRING_TYPE, + ir.IntType(8).as_pointer(), [ - self._llvm.ASCII_STRING_TYPE, + ir.IntType(8).as_pointer(), self._llvm.INT32_TYPE, self._llvm.INT32_TYPE, ], @@ -2210,10 +2204,9 @@ def visit(self, node: system.Cast) -> None: value, target_type, "cast_fp_down" ) - elif target_type in ( - self._llvm.ASCII_STRING_TYPE, - self._llvm.STRING_TYPE, - ): + elif isinstance( + target_type, ir.PointerType + ) and target_type.pointee == ir.IntType(8): if isinstance(value.type, ir.IntType): arg, fmt_str = self._normalize_int_for_printf(value) fmt_gv = self._get_or_create_format_global(fmt_str) From 656f5785a7bdb6029f6d3a80966de6d54a7f81d3 Mon Sep 17 00:00:00 2001 From: dev-m03 Date: Mon, 26 Jan 2026 01:11:56 +0530 Subject: [PATCH 2/6] fixing docs error --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 31c3d2e..104d0f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "pyirx" version = "1.5.0" # semantic-release description = "IRx" -readme = "docs/index.md" +readme = "README.md" authors = [ {name = "Ivan Ogasawara", email = "ivan.ogasawara@gmail.com"} ] From 6c6ae79708094b9fce9d77727c205d71de5eb74c Mon Sep 17 00:00:00 2001 From: dev-m03 Date: Mon, 26 Jan 2026 01:26:44 +0530 Subject: [PATCH 3/6] ci: trigger From 3e96e84f4bbef34a8513284006d2ab5b920cece1 Mon Sep 17 00:00:00 2001 From: dev-m03 Date: Mon, 26 Jan 2026 01:26:55 +0530 Subject: [PATCH 4/6] ci: trigger From 514c90476ef31428cb8988f9d7e4e9505a41b1ce Mon Sep 17 00:00:00 2001 From: dev-m03 Date: Mon, 26 Jan 2026 01:32:11 +0530 Subject: [PATCH 5/6] fixing issue in pyproject --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 104d0f8..31c3d2e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "pyirx" version = "1.5.0" # semantic-release description = "IRx" -readme = "README.md" +readme = "docs/index.md" authors = [ {name = "Ivan Ogasawara", email = "ivan.ogasawara@gmail.com"} ] From f5915eec95d98e8747ecfef6d2e6c021cc7f2e22 Mon Sep 17 00:00:00 2001 From: dev-m03 Date: Mon, 26 Jan 2026 01:40:25 +0530 Subject: [PATCH 6/6] ci: trigger