Skip to content

Commit e0e0c95

Browse files
DinoVmeta-codesync[bot]
authored andcommitted
Fix LIR stack slot formatting and parsing
Summary: Claude came up with this, but it doesn't impact anything, but it says it's right. Fix the PhyLocation::toString() output format for stack slots and the corresponding LIR parser to use a consistent sign convention. Stack slot locations are stored as negative offsets from the frame pointer. Previously toString() printed them as raw negative values inside parens (e.g. "[RBP(-8)]") which didn't match the parser's regex for stack slots. Change toString() to print "[RBP - 8]" format (negating the stored value) and fix the parser to negate token.data when setting stack slots, so the round-trip through print/parse is consistent. Reviewed By: alexmalyshev Differential Revision: D98161190 fbshipit-source-id: 83bd3ff43e211a3b0f4109da2c41c7302433e0a7
1 parent 23c01db commit e0e0c95

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

cinderx/Jit/lir/parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Parser::Token Parser::getNextToken(const char* str) {
4646
{"[RD][0-9]+", kPhyReg},
4747
#endif
4848
{"XMM[0-9]+", kPhyReg},
49-
{R"(\[RBP[ ]?-[ ]?(\d+)\])", kStack},
49+
{R"(\[RBP\((-?\d+)\)\])", kStack},
5050
{"\\[(0x[0-9a-fA-F]+)\\]", kAddress},
5151
{R"((\d+)(\(0x[0-9a-fA-F]+\))?)", kImmediate},
5252
{"BB%(\\d+)", kBasicBlockRef},

0 commit comments

Comments
 (0)