1 -- | Sizes on this architecture
2 -- A Size is a combination of width and class
4 -- TODO: Rename this to "Format" instead of "Size" to reflect
5 -- the fact that it represents floating point vs integer.
7 -- TODO: Signed vs unsigned?
9 -- TODO: This module is currenly shared by all architectures because
10 -- NCGMonad need to know about it to make a VReg. It would be better
11 -- to have architecture specific formats, and do the overloading
12 -- properly. eg SPARC doesn't care about FF80.
28 -- It looks very like the old MachRep, but it's now of purely local
29 -- significance, here in the native code generator. You can change it
30 -- without global consequences.
32 -- A major use is as an opcode qualifier; thus the opcode
36 -- where the Size field encodes the ".l" part.
38 -- ToDo: it's not clear to me that we need separate signed-vs-unsigned sizes
39 -- here. I've removed them from the x86 version, we'll see what happens --SDM
41 -- ToDo: quite a few occurrences of Size could usefully be replaced by Width
54 -- | Get the integer size of this width.
55 intSize :: Width -> Size
62 other -> pprPanic "Size.intSize" (ppr other)
65 -- | Get the float size of this width.
66 floatSize :: Width -> Size
71 other -> pprPanic "Size.floatSize" (ppr other)
74 -- | Check if a size represents a floating point value.
75 isFloatSize :: Size -> Bool
84 -- | Convert a Cmm type to a Size.
85 cmmTypeSize :: CmmType -> Size
87 | isFloatType ty = floatSize (typeWidth ty)
88 | otherwise = intSize (typeWidth ty)
91 -- | Get the Width of a Size.
92 sizeToWidth :: Size -> Width