-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mypyc] Refactor: add two list primitive ops (#17058)
Add ops for getting list size and a pointer to list item data. This simplifies the IR generated in the main irbuild pass. Continue work on mypyc/mypyc#854.
- Loading branch information
Showing
20 changed files
with
883 additions
and
979 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from __future__ import annotations | ||
|
||
from mypyc.ir.ops import GetElementPtr, LoadMem, Value | ||
from mypyc.ir.rtypes import PyVarObject, c_pyssize_t_rprimitive | ||
from mypyc.irbuild.ll_builder import LowLevelIRBuilder | ||
from mypyc.lower.registry import lower_primitive_op | ||
|
||
|
||
@lower_primitive_op("var_object_size") | ||
def var_object_size(builder: LowLevelIRBuilder, args: list[Value], line: int) -> Value: | ||
elem_address = builder.add(GetElementPtr(args[0], PyVarObject, "ob_size")) | ||
return builder.add(LoadMem(c_pyssize_t_rprimitive, elem_address)) |
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
Oops, something went wrong.