Skip to content

Commit 02dd0aa

Browse files
author
bryant
committed
add polymorphic sd operand generator
1 parent 3b924cf commit 02dd0aa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

scripts/tablegen.hs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,16 @@ parens xs = "(" ++ xs ++ ")"
104104

105105
type TableGen = State Int
106106

107+
new_sd_op :: TypeShow a => TableGen (SDNode L a)
108+
new_sd_op = SDPatLeaf "" <$> next_int
109+
107110
i32 :: TableGen (SDNode L I32)
108-
i32 = SDPatLeaf "" <$> next_int
111+
i32 = new_sd_op
109112

110113
i16 :: TableGen (SDNode L I16)
111-
i16 = SDPatLeaf "" <$> next_int
114+
i16 = new_sd_op
112115

113116
i8 :: TableGen (SDNode L I8)
114-
i8 = SDPatLeaf "" <$> next_int
117+
i8 = new_sd_op
115118

116119
next_int = State.get >>= \n -> State.modify (+ 1) >> return n

0 commit comments

Comments
 (0)