Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!uw-entropy!dataio!bright From: bright@Data-IO.COM (Walter Bright) Newsgroups: comp.lang.c Subject: Registers used by compiler Message-ID: <2064@dataio.Data-IO.COM> Date: 19 Jul 89 19:26:16 GMT References: <396@uop.uop.EDU> <225800197@uxe.cso.uiuc.edu> <579@targon.UUCP> <116229@sun.Eng.Sun.COM> Reply-To: bright@dataio.Data-IO.COM (Walter Bright) Organization: Data I/O Corporation; Redmond, WA Lines: 15 Various methods have appeared to determine the number of registers a compiler will use to stuff variables in. None of these will work with my compiler, Zortech. The compiler first generates code for a function, keeping track of what registers are used where. Based on this and a map of where variables are used, it then assigns variables to registers using classic graph-coloring techniques. Therefore, how many registers are used for variables varies from function to function, and also varies depending on whether optimization was selected and what memory model was used. Modern compilers stuff variables into registers regardless of the use of the 'register' keyword. That keyword is an anachronism, only useful with old compilers.