Skip to content

Commit

Permalink
IR: Change convention from number of elements to elementsize
Browse files Browse the repository at this point in the history
The IR stores elementsize, where the json was wanting number of
elements. While the IR Emitter function declaration always wanted
element size. This was causing us to do a little dance from ElementSize
-> Number of elements -> ElementSize. Just pass the ElementSize directly
instead of this bogus little dance.
  • Loading branch information
Sonicadvance1 committed Jan 3, 2025
1 parent 6bc7a83 commit 1ecfa32
Show file tree
Hide file tree
Showing 2 changed files with 148 additions and 148 deletions.
12 changes: 6 additions & 6 deletions FEXCore/Scripts/json_ir_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class OpDefinition:
HasDest: bool
DestType: str
DestSize: str
NumElements: str
ElementSize: str
OpClass: str
HasSideEffects: bool
ImplicitFlagClobber: bool
Expand All @@ -67,7 +67,7 @@ def __init__(self):
self.HasDest = False
self.DestType = None
self.DestSize = None
self.NumElements = None
self.ElementSize = None
self.OpClass = None
self.OpSize = 0
self.HasSideEffects = False
Expand Down Expand Up @@ -234,8 +234,8 @@ def parse_ops(ops):
if "DestSize" in op_val:
OpDef.DestSize = op_val["DestSize"]

if "NumElements" in op_val:
OpDef.NumElements = op_val["NumElements"]
if "ElementSize" in op_val:
OpDef.ElementSize = op_val["ElementSize"]

if len(op_class):
OpDef.OpClass = op_class
Expand Down Expand Up @@ -745,10 +745,10 @@ def print_ir_allocator_helpers():
if op.DestSize != None:
output_file.write("\t\t_Op.first->Header.Size = {};\n".format(op.DestSize))

if op.NumElements == None:
if op.ElementSize == None:
output_file.write("\t\t_Op.first->Header.ElementSize = _Op.first->Header.Size;\n")
else:
output_file.write("\t\t_Op.first->Header.ElementSize = _Op.first->Header.Size / ({});\n".format(op.NumElements))
output_file.write("\t\t_Op.first->Header.ElementSize = {};\n".format(op.ElementSize))

# Insert validation here
if op.EmitValidation != None:
Expand Down
Loading

0 comments on commit 1ecfa32

Please sign in to comment.