Add reg clobber list for direct calls
[oota-llvm.git] / lib / Target / X86 / X86RegisterInfo.def
1 //===-- X86RegisterInfo.def - X86 Register Information ----------*- C++ -*-===//
2 //
3 // This file describes all of the registers that the X86 backend uses. It relies
4 // on an external 'R' macro being defined that takes the arguments specified
5 // below, and is used to make all of the information relevant to registers be in
6 // one place.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // NOTE: No include guards desired
11 #ifndef R
12 #define R(ENUM, NAME, FLAGS, TSFLAGS, ALIAS_SET)
13 #endif
14
15 #ifndef R8
16 #define R8(ENUM, NAME, FLAGS, TSFLAGS, ALIAS_SET) \
17    R(ENUM, NAME, FLAGS, TSFLAGS, ALIAS_SET)
18 #endif
19
20 #ifndef R16
21 #define R16(ENUM, NAME, FLAGS, TSFLAGS, ALIAS_SET) \
22    R(ENUM, NAME, FLAGS, TSFLAGS, ALIAS_SET)
23 #endif
24
25 #ifndef R32
26 #define R32(ENUM, NAME, FLAGS, TSFLAGS, ALIAS_SET) \
27    R(ENUM, NAME, FLAGS, TSFLAGS, ALIAS_SET)
28 #endif
29
30 // Arguments passed into the R macros
31 //  #1: Enum Name - This ends up being a symbol in the X86 namespace
32 //  #2: Register name - The name of the register as used by the gnu assembler
33 //  #3: Register Flags - A bitfield of flags or'd together from the
34 //      MRegisterInfo.h file.
35 //  #4: Target Specific Flags - Another bitfield containing X86 specific flags
36 //      as neccesary.
37 //  #5: Alias set for registers aliased to this register (sets defined below).
38
39
40 // The first register must always be a 'noop' register for all backends.  This
41 // is used as the destination register for instructions that do not produce a
42 // value.  Some frontends may use this as an operand register to mean special
43 // things, for example, the Sparc backend uses R#0 to mean %g0 which always
44 // PRODUCES the value 0.
45 //
46 // The X86 backend uses this value as an operand register only in memory
47 // references where it means that there is no base or index register.
48 //
49 R(NoReg,"none",          0, 0, 0/*noalias*/)
50
51 // 32 bit registers, ordered as the processor does...
52 R32(EAX, "EAX", MRF::INT32, 0, A_EAX)
53 R32(ECX, "ECX", MRF::INT32, 0, A_ECX)
54 R32(EDX, "EDX", MRF::INT32, 0, A_EDX)
55 R32(EBX, "EBX", MRF::INT32, 0, A_EBX)
56 R32(ESP, "ESP", MRF::INT32, 0, A_ESP)
57 R32(EBP, "EBP", MRF::INT32, 0, A_EBP)
58 R32(ESI, "ESI", MRF::INT32, 0, A_ESI)
59 R32(EDI, "EDI", MRF::INT32, 0, A_EDI)
60
61 // 16 bit registers, aliased with the corresponding 32 bit registers above
62 R16( AX, "AX" , MRF::INT16, 0, A_AX)
63 R16( CX, "CX" , MRF::INT16, 0, A_CX)
64 R16( DX, "DX" , MRF::INT16, 0, A_DX)
65 R16( BX, "BX" , MRF::INT16, 0, A_BX)
66 R16( SP, "SP" , MRF::INT16, 0, A_SP)
67 R16( BP, "BP" , MRF::INT16, 0, A_BP)
68 R16( SI, "SI" , MRF::INT16, 0, A_SI)
69 R16( DI, "DI" , MRF::INT16, 0, A_DI)
70
71 // 8 bit registers aliased with registers above as well
72   R8 ( AL, "AL" , MRF::INT8 , 0, A_AL)
73   R8 ( CL, "CL" , MRF::INT8 , 0, A_CL)
74   R8 ( DL, "DL" , MRF::INT8 , 0, A_DL)
75   R8 ( BL, "BL" , MRF::INT8 , 0, A_BL)
76   R8 ( AH, "AH" , MRF::INT8 , 0, A_AH)
77   R8 ( CH, "CH" , MRF::INT8 , 0, A_CH)
78   R8 ( DH, "DH" , MRF::INT8 , 0, A_DH)
79   R8 ( BH, "BH" , MRF::INT8 , 0, A_BH)
80
81 // Flags, Segment registers, etc...
82
83 // This is a slimy hack to make it possible to say that flags are clobbered...
84 // Ideally we'd model instructions based on which particular flag(s) they
85 // could clobber. 
86 R(EFLAGS, "EFLAGS", MRF::INT16, 0, 0 /*noalias*/)
87
88
89 //===----------------------------------------------------------------------===//
90 // Register alias set handling...
91 //
92
93 // Macro to handle definitions of alias sets that registers use...
94 #ifndef ALIASLIST
95 #define ALIASLIST(NAME, ...)
96 #endif
97
98 ALIASLIST(A_EAX     , X86::AX, X86::AH, X86::AL, 0)
99 ALIASLIST(A_ECX     , X86::CX, X86::CH, X86::CL, 0)
100 ALIASLIST(A_EDX     , X86::DX, X86::DH, X86::DL, 0)
101 ALIASLIST(A_EBX     , X86::BX, X86::BH, X86::BL, 0)
102 ALIASLIST(A_ESP     , X86::SP, 0)
103 ALIASLIST(A_EBP     , X86::BP, 0)
104 ALIASLIST(A_ESI     , X86::SI, 0)
105 ALIASLIST(A_EDI     , X86::DI, 0)
106 ALIASLIST(A_AX      , X86::EAX, X86::AH, X86::AL, 0)
107 ALIASLIST(A_CX      , X86::ECX, X86::CH, X86::CL, 0)
108 ALIASLIST(A_DX      , X86::EDX, X86::DH, X86::DL, 0)
109 ALIASLIST(A_BX      , X86::EBX, X86::BH, X86::BL, 0)
110 ALIASLIST(A_SP      , X86::ESP, 0)
111 ALIASLIST(A_BP      , X86::EBP, 0)
112 ALIASLIST(A_SI      , X86::ESI, 0)
113 ALIASLIST(A_DI      , X86::EDI, 0)
114 ALIASLIST(A_AL      , X86::EAX, X86::AX, 0)
115 ALIASLIST(A_CL      , X86::ECX, X86::CX, 0)
116 ALIASLIST(A_DL      , X86::EDX, X86::DX, 0)
117 ALIASLIST(A_BL      , X86::EBX, X86::BX, 0)
118 ALIASLIST(A_AH      , X86::EAX, X86::AX, 0)
119 ALIASLIST(A_CH      , X86::ECX, X86::CX, 0)
120 ALIASLIST(A_DH      , X86::EDX, X86::DX, 0)
121 ALIASLIST(A_BH      , X86::EBX, X86::BX, 0)
122 #undef ALIASLIST
123
124 // We are now done with the R* macros
125 #undef R
126 #undef R8
127 #undef R16
128 #undef R32