Skip to content
Snippets Groups Projects
Commit 6a205065 authored by Frederik Hennig's avatar Frederik Hennig
Browse files

removed unnecessary undetType + minor fixes

parent 32076b2c
Branches
Tags
No related merge requests found
Pipeline #61681 failed with stages
in 6 minutes and 10 seconds
...@@ -46,14 +46,13 @@ class PsKernelParametersSpec: ...@@ -46,14 +46,13 @@ class PsKernelParametersSpec:
elif var in self.params: elif var in self.params:
continue continue
else: raise PsInternalCompilerError(
raise PsInternalCompilerError( "Constrained parameter was neither contained in kernel parameter list "
"Constrained parameter was neither contained in kernel parameter list " "nor associated with a kernel array.\n"
"nor associated with a kernel array.\n" f" Parameter: {var}\n"
f" Parameter: {var}\n" f" Constraint: {constraint.condition}"
f" Constraint: {constraint.condition}" )
)
class PsKernelFunction(PsAstNode): class PsKernelFunction(PsAstNode):
......
...@@ -19,8 +19,9 @@ NodeT = TypeVar("NodeT", bound=PsAstNode) ...@@ -19,8 +19,9 @@ NodeT = TypeVar("NodeT", bound=PsAstNode)
class EraseAnonymousStructTypes(IdentityMapper): class EraseAnonymousStructTypes(IdentityMapper):
"""Lower anonymous struct arrays to a byte-array representation. """Lower anonymous struct arrays to a byte-array representation.
Arrays whose element type is an anonymous struct are transformed to arrays with element type UInt(8). For arrays whose element type is an anonymous struct, the struct type is erased from the base pointer,
Lookups on accesses into these arrays are transformed using type casts. making it a pointer to uint8_t.
Member lookups on accesses into these arrays are then transformed using type casts.
""" """
def __init__(self, ctx: KernelCreationContext) -> None: def __init__(self, ctx: KernelCreationContext) -> None:
......
from __future__ import annotations from __future__ import annotations
from typing import TypeVar, Any, NoReturn from typing import TypeVar, Any
import pymbolic.primitives as pb import pymbolic.primitives as pb
from pymbolic.mapper import Mapper from pymbolic.mapper import Mapper
...@@ -10,7 +10,6 @@ from ..types import PsAbstractType, PsNumericType, PsStructType, deconstify ...@@ -10,7 +10,6 @@ from ..types import PsAbstractType, PsNumericType, PsStructType, deconstify
from ..typed_expressions import PsTypedVariable, PsTypedConstant, ExprOrConstant from ..typed_expressions import PsTypedVariable, PsTypedConstant, ExprOrConstant
from ..arrays import PsArrayAccess from ..arrays import PsArrayAccess
from ..ast import PsAstNode, PsBlock, PsExpression, PsAssignment from ..ast import PsAstNode, PsBlock, PsExpression, PsAssignment
from ..exceptions import PsInternalCompilerError
__all__ = ["Typifier"] __all__ = ["Typifier"]
...@@ -22,40 +21,6 @@ class TypificationError(Exception): ...@@ -22,40 +21,6 @@ class TypificationError(Exception):
NodeT = TypeVar("NodeT", bound=PsAstNode) NodeT = TypeVar("NodeT", bound=PsAstNode)
class UndeterminedType(PsNumericType):
"""Placeholder for types that could not yet be determined by the typifier.
Instances of this class should never leave the typifier; it is an error if they do.
"""
def create_constant(self, value: Any) -> Any:
return None
def _err(self) -> NoReturn:
raise PsInternalCompilerError("Calling UndeterminedType.")
def create_literal(self, value: Any) -> str:
self._err()
def is_int(self) -> bool:
self._err()
def is_sint(self) -> bool:
self._err()
def is_uint(self) -> bool:
self._err()
def is_float(self) -> bool:
self._err()
def __eq__(self, other: object) -> bool:
self._err()
def c_string(self) -> str:
self._err()
class DeferredTypedConstant(PsTypedConstant): class DeferredTypedConstant(PsTypedConstant):
"""Special subclass for constants whose types cannot be determined yet at the time of their creation. """Special subclass for constants whose types cannot be determined yet at the time of their creation.
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment