blob: c2ae18d9c4f4c4a7a47b90fcd0bc76bde7e2d04e [file] [log] [blame]
Chris Lattner7c90f732006-02-05 05:50:24 +00001//===-- Sparc.h - Top-level interface for Sparc representation --*- C++ -*-===//
Misha Brukmanb5f662f2005-04-21 23:30:14 +00002//
Brian Gaekee785e532004-02-25 19:28:19 +00003// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
Misha Brukmanb5f662f2005-04-21 23:30:14 +00007//
Brian Gaekee785e532004-02-25 19:28:19 +00008//===----------------------------------------------------------------------===//
9//
10// This file contains the entry points for global functions defined in the LLVM
Chris Lattner7c90f732006-02-05 05:50:24 +000011// Sparc back-end.
Brian Gaekee785e532004-02-25 19:28:19 +000012//
13//===----------------------------------------------------------------------===//
14
Chris Lattner7c90f732006-02-05 05:50:24 +000015#ifndef TARGET_SPARC_H
16#define TARGET_SPARC_H
Brian Gaekee785e532004-02-25 19:28:19 +000017
18#include <iosfwd>
Chris Lattner6788faa2006-01-31 06:49:09 +000019#include <cassert>
Brian Gaekee785e532004-02-25 19:28:19 +000020
21namespace llvm {
Chris Lattner1c809c52004-02-29 00:27:00 +000022 class FunctionPass;
23 class TargetMachine;
Brian Gaekee785e532004-02-25 19:28:19 +000024
Chris Lattner7c90f732006-02-05 05:50:24 +000025 FunctionPass *createSparcISelDag(TargetMachine &TM);
26 FunctionPass *createSparcCodePrinterPass(std::ostream &OS, TargetMachine &TM);
27 FunctionPass *createSparcDelaySlotFillerPass(TargetMachine &TM);
28 FunctionPass *createSparcFPMoverPass(TargetMachine &TM);
Brian Gaekee785e532004-02-25 19:28:19 +000029} // end namespace llvm;
30
Chris Lattner7c90f732006-02-05 05:50:24 +000031// Defines symbolic names for Sparc registers. This defines a mapping from
Brian Gaekee785e532004-02-25 19:28:19 +000032// register name to register number.
33//
Chris Lattner7c90f732006-02-05 05:50:24 +000034#include "SparcGenRegisterNames.inc"
Brian Gaekee785e532004-02-25 19:28:19 +000035
Chris Lattner7c90f732006-02-05 05:50:24 +000036// Defines symbolic names for the Sparc instructions.
Brian Gaekee785e532004-02-25 19:28:19 +000037//
Chris Lattner7c90f732006-02-05 05:50:24 +000038#include "SparcGenInstrNames.inc"
Brian Gaekee785e532004-02-25 19:28:19 +000039
Chris Lattner6788faa2006-01-31 06:49:09 +000040
41namespace llvm {
Chris Lattner7c90f732006-02-05 05:50:24 +000042 // Enums corresponding to Sparc condition codes, both icc's and fcc's. These
Chris Lattner6788faa2006-01-31 06:49:09 +000043 // values must be kept in sync with the ones in the .td file.
Chris Lattner7c90f732006-02-05 05:50:24 +000044 namespace SPCC {
Chris Lattner6788faa2006-01-31 06:49:09 +000045 enum CondCodes {
46 //ICC_A = 8 , // Always
47 //ICC_N = 0 , // Never
48 ICC_NE = 9 , // Not Equal
49 ICC_E = 1 , // Equal
50 ICC_G = 10 , // Greater
51 ICC_LE = 2 , // Less or Equal
52 ICC_GE = 11 , // Greater or Equal
53 ICC_L = 3 , // Less
54 ICC_GU = 12 , // Greater Unsigned
55 ICC_LEU = 4 , // Less or Equal Unsigned
56 ICC_CC = 13 , // Carry Clear/Great or Equal Unsigned
57 ICC_CS = 5 , // Carry Set/Less Unsigned
58 ICC_POS = 14 , // Positive
59 ICC_NEG = 6 , // Negative
60 ICC_VC = 15 , // Overflow Clear
61 ICC_VS = 7 , // Overflow Set
62
63 //FCC_A = 8+16, // Always
64 //FCC_N = 0+16, // Never
65 FCC_U = 7+16, // Unordered
66 FCC_G = 6+16, // Greater
67 FCC_UG = 5+16, // Unordered or Greater
68 FCC_L = 4+16, // Less
69 FCC_UL = 3+16, // Unordered or Less
70 FCC_LG = 2+16, // Less or Greater
71 FCC_NE = 1+16, // Not Equal
72 FCC_E = 9+16, // Equal
73 FCC_UE = 10+16, // Unordered or Equal
74 FCC_GE = 11+16, // Greater or Equal
75 FCC_UGE = 12+16, // Unordered or Greater or Equal
76 FCC_LE = 13+16, // Less or Equal
77 FCC_ULE = 14+16, // Unordered or Less or Equal
Chris Lattnerd74ea2b2006-05-24 17:04:05 +000078 FCC_O = 15+16 // Ordered
Chris Lattner6788faa2006-01-31 06:49:09 +000079 };
80 }
81
Chris Lattner7c90f732006-02-05 05:50:24 +000082 static const char *SPARCCondCodeToString(SPCC::CondCodes CC) {
Chris Lattner6788faa2006-01-31 06:49:09 +000083 switch (CC) {
84 default: assert(0 && "Unknown condition code");
Chris Lattner7c90f732006-02-05 05:50:24 +000085 case SPCC::ICC_NE: return "ne";
86 case SPCC::ICC_E: return "e";
87 case SPCC::ICC_G: return "g";
88 case SPCC::ICC_LE: return "le";
89 case SPCC::ICC_GE: return "ge";
90 case SPCC::ICC_L: return "l";
91 case SPCC::ICC_GU: return "gu";
92 case SPCC::ICC_LEU: return "leu";
93 case SPCC::ICC_CC: return "cc";
94 case SPCC::ICC_CS: return "cs";
95 case SPCC::ICC_POS: return "pos";
96 case SPCC::ICC_NEG: return "neg";
97 case SPCC::ICC_VC: return "vc";
98 case SPCC::ICC_VS: return "vs";
99 case SPCC::FCC_U: return "u";
100 case SPCC::FCC_G: return "g";
101 case SPCC::FCC_UG: return "ug";
102 case SPCC::FCC_L: return "l";
103 case SPCC::FCC_UL: return "ul";
104 case SPCC::FCC_LG: return "lg";
105 case SPCC::FCC_NE: return "ne";
106 case SPCC::FCC_E: return "e";
107 case SPCC::FCC_UE: return "ue";
108 case SPCC::FCC_GE: return "ge";
109 case SPCC::FCC_UGE: return "uge";
110 case SPCC::FCC_LE: return "le";
111 case SPCC::FCC_ULE: return "ule";
112 case SPCC::FCC_O: return "o";
Chris Lattner6788faa2006-01-31 06:49:09 +0000113 }
114 }
115} // end namespace llvm
Brian Gaekee785e532004-02-25 19:28:19 +0000116#endif