Put Target definitions inside Target specific header, and llvm namespace.
[oota-llvm.git] / lib / Target / Sparc / Sparc.h
1 //===-- Sparc.h - Top-level interface for Sparc representation --*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the entry points for global functions defined in the LLVM
11 // Sparc back-end.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef TARGET_SPARC_H
16 #define TARGET_SPARC_H
17
18 #include "llvm/Support/ErrorHandling.h"
19 #include "llvm/Target/TargetMachine.h"
20 #include <cassert>
21
22 namespace llvm {
23   class FunctionPass;
24   class SparcTargetMachine;
25   class formatted_raw_ostream;
26
27   FunctionPass *createSparcISelDag(SparcTargetMachine &TM);
28   FunctionPass *createSparcCodePrinterPass(formatted_raw_ostream &OS,
29                                            TargetMachine &TM,
30                                            bool Verbose);
31   FunctionPass *createSparcDelaySlotFillerPass(TargetMachine &TM);
32   FunctionPass *createSparcFPMoverPass(TargetMachine &TM);
33
34   extern Target TheSparcTarget;
35
36 } // end namespace llvm;
37
38 // Defines symbolic names for Sparc registers.  This defines a mapping from
39 // register name to register number.
40 //
41 #include "SparcGenRegisterNames.inc"
42
43 // Defines symbolic names for the Sparc instructions.
44 //
45 #include "SparcGenInstrNames.inc"
46
47
48 namespace llvm {
49   // Enums corresponding to Sparc condition codes, both icc's and fcc's.  These
50   // values must be kept in sync with the ones in the .td file.
51   namespace SPCC {
52     enum CondCodes {
53       //ICC_A   =  8   ,  // Always
54       //ICC_N   =  0   ,  // Never
55       ICC_NE  =  9   ,  // Not Equal
56       ICC_E   =  1   ,  // Equal
57       ICC_G   = 10   ,  // Greater
58       ICC_LE  =  2   ,  // Less or Equal
59       ICC_GE  = 11   ,  // Greater or Equal
60       ICC_L   =  3   ,  // Less
61       ICC_GU  = 12   ,  // Greater Unsigned
62       ICC_LEU =  4   ,  // Less or Equal Unsigned
63       ICC_CC  = 13   ,  // Carry Clear/Great or Equal Unsigned
64       ICC_CS  =  5   ,  // Carry Set/Less Unsigned
65       ICC_POS = 14   ,  // Positive
66       ICC_NEG =  6   ,  // Negative
67       ICC_VC  = 15   ,  // Overflow Clear
68       ICC_VS  =  7   ,  // Overflow Set
69       
70       //FCC_A   =  8+16,  // Always
71       //FCC_N   =  0+16,  // Never
72       FCC_U   =  7+16,  // Unordered
73       FCC_G   =  6+16,  // Greater
74       FCC_UG  =  5+16,  // Unordered or Greater
75       FCC_L   =  4+16,  // Less
76       FCC_UL  =  3+16,  // Unordered or Less
77       FCC_LG  =  2+16,  // Less or Greater
78       FCC_NE  =  1+16,  // Not Equal
79       FCC_E   =  9+16,  // Equal
80       FCC_UE  = 10+16,  // Unordered or Equal
81       FCC_GE  = 11+16,  // Greater or Equal
82       FCC_UGE = 12+16,  // Unordered or Greater or Equal
83       FCC_LE  = 13+16,  // Less or Equal
84       FCC_ULE = 14+16,  // Unordered or Less or Equal
85       FCC_O   = 15+16   // Ordered
86     };
87   }
88   
89   inline static const char *SPARCCondCodeToString(SPCC::CondCodes CC) {
90     switch (CC) {
91     default: llvm_unreachable("Unknown condition code");
92     case SPCC::ICC_NE:  return "ne";
93     case SPCC::ICC_E:   return "e";
94     case SPCC::ICC_G:   return "g";
95     case SPCC::ICC_LE:  return "le";
96     case SPCC::ICC_GE:  return "ge";
97     case SPCC::ICC_L:   return "l";
98     case SPCC::ICC_GU:  return "gu";
99     case SPCC::ICC_LEU: return "leu";
100     case SPCC::ICC_CC:  return "cc";
101     case SPCC::ICC_CS:  return "cs";
102     case SPCC::ICC_POS: return "pos";
103     case SPCC::ICC_NEG: return "neg";
104     case SPCC::ICC_VC:  return "vc";
105     case SPCC::ICC_VS:  return "vs";
106     case SPCC::FCC_U:   return "u";
107     case SPCC::FCC_G:   return "g";
108     case SPCC::FCC_UG:  return "ug";
109     case SPCC::FCC_L:   return "l";
110     case SPCC::FCC_UL:  return "ul";
111     case SPCC::FCC_LG:  return "lg";
112     case SPCC::FCC_NE:  return "ne";
113     case SPCC::FCC_E:   return "e";
114     case SPCC::FCC_UE:  return "ue";
115     case SPCC::FCC_GE:  return "ge";
116     case SPCC::FCC_UGE: return "uge";
117     case SPCC::FCC_LE:  return "le";
118     case SPCC::FCC_ULE: return "ule";
119     case SPCC::FCC_O:   return "o";
120     }       
121   }
122 }  // end namespace llvm
123 #endif