blob: 539e50addeb3d7e4b64b308ce271e5d8766a2909 [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//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// 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
Torok Edwinc25e7582009-07-11 20:10:48 +000018#include "llvm/Support/ErrorHandling.h"
Bill Wendling98a366d2009-04-29 23:29:43 +000019#include "llvm/Target/TargetMachine.h"
Chris Lattner6788faa2006-01-31 06:49:09 +000020#include <cassert>
Brian Gaekee785e532004-02-25 19:28:19 +000021
22namespace llvm {
Chris Lattner1c809c52004-02-29 00:27:00 +000023 class FunctionPass;
Dan Gohmanda8ac5f2008-10-03 16:55:19 +000024 class SparcTargetMachine;
Owen Andersoncb371882008-08-21 00:14:44 +000025 class raw_ostream;
Brian Gaekee785e532004-02-25 19:28:19 +000026
Dan Gohmanda8ac5f2008-10-03 16:55:19 +000027 FunctionPass *createSparcISelDag(SparcTargetMachine &TM);
Evan Cheng42bf74b2009-03-25 01:47:28 +000028 FunctionPass *createSparcCodePrinterPass(raw_ostream &OS, TargetMachine &TM,
Bill Wendling98a366d2009-04-29 23:29:43 +000029 bool Verbose);
Chris Lattner7c90f732006-02-05 05:50:24 +000030 FunctionPass *createSparcDelaySlotFillerPass(TargetMachine &TM);
31 FunctionPass *createSparcFPMoverPass(TargetMachine &TM);
Brian Gaekee785e532004-02-25 19:28:19 +000032} // end namespace llvm;
33
Chris Lattner7c90f732006-02-05 05:50:24 +000034// Defines symbolic names for Sparc registers. This defines a mapping from
Brian Gaekee785e532004-02-25 19:28:19 +000035// register name to register number.
36//
Chris Lattner7c90f732006-02-05 05:50:24 +000037#include "SparcGenRegisterNames.inc"
Brian Gaekee785e532004-02-25 19:28:19 +000038
Chris Lattner7c90f732006-02-05 05:50:24 +000039// Defines symbolic names for the Sparc instructions.
Brian Gaekee785e532004-02-25 19:28:19 +000040//
Chris Lattner7c90f732006-02-05 05:50:24 +000041#include "SparcGenInstrNames.inc"
Brian Gaekee785e532004-02-25 19:28:19 +000042
Chris Lattner6788faa2006-01-31 06:49:09 +000043
44namespace llvm {
Chris Lattner7c90f732006-02-05 05:50:24 +000045 // Enums corresponding to Sparc condition codes, both icc's and fcc's. These
Chris Lattner6788faa2006-01-31 06:49:09 +000046 // values must be kept in sync with the ones in the .td file.
Chris Lattner7c90f732006-02-05 05:50:24 +000047 namespace SPCC {
Chris Lattner6788faa2006-01-31 06:49:09 +000048 enum CondCodes {
49 //ICC_A = 8 , // Always
50 //ICC_N = 0 , // Never
51 ICC_NE = 9 , // Not Equal
52 ICC_E = 1 , // Equal
53 ICC_G = 10 , // Greater
54 ICC_LE = 2 , // Less or Equal
55 ICC_GE = 11 , // Greater or Equal
56 ICC_L = 3 , // Less
57 ICC_GU = 12 , // Greater Unsigned
58 ICC_LEU = 4 , // Less or Equal Unsigned
59 ICC_CC = 13 , // Carry Clear/Great or Equal Unsigned
60 ICC_CS = 5 , // Carry Set/Less Unsigned
61 ICC_POS = 14 , // Positive
62 ICC_NEG = 6 , // Negative
63 ICC_VC = 15 , // Overflow Clear
64 ICC_VS = 7 , // Overflow Set
65
66 //FCC_A = 8+16, // Always
67 //FCC_N = 0+16, // Never
68 FCC_U = 7+16, // Unordered
69 FCC_G = 6+16, // Greater
70 FCC_UG = 5+16, // Unordered or Greater
71 FCC_L = 4+16, // Less
72 FCC_UL = 3+16, // Unordered or Less
73 FCC_LG = 2+16, // Less or Greater
74 FCC_NE = 1+16, // Not Equal
75 FCC_E = 9+16, // Equal
76 FCC_UE = 10+16, // Unordered or Equal
77 FCC_GE = 11+16, // Greater or Equal
78 FCC_UGE = 12+16, // Unordered or Greater or Equal
79 FCC_LE = 13+16, // Less or Equal
80 FCC_ULE = 14+16, // Unordered or Less or Equal
Chris Lattnerd74ea2b2006-05-24 17:04:05 +000081 FCC_O = 15+16 // Ordered
Chris Lattner6788faa2006-01-31 06:49:09 +000082 };
83 }
84
Chris Lattner9c5d4de2006-11-03 01:11:05 +000085 inline static const char *SPARCCondCodeToString(SPCC::CondCodes CC) {
Chris Lattner6788faa2006-01-31 06:49:09 +000086 switch (CC) {
Torok Edwinc25e7582009-07-11 20:10:48 +000087 default: LLVM_UNREACHABLE("Unknown condition code");
Chris Lattner7c90f732006-02-05 05:50:24 +000088 case SPCC::ICC_NE: return "ne";
89 case SPCC::ICC_E: return "e";
90 case SPCC::ICC_G: return "g";
91 case SPCC::ICC_LE: return "le";
92 case SPCC::ICC_GE: return "ge";
93 case SPCC::ICC_L: return "l";
94 case SPCC::ICC_GU: return "gu";
95 case SPCC::ICC_LEU: return "leu";
96 case SPCC::ICC_CC: return "cc";
97 case SPCC::ICC_CS: return "cs";
98 case SPCC::ICC_POS: return "pos";
99 case SPCC::ICC_NEG: return "neg";
100 case SPCC::ICC_VC: return "vc";
101 case SPCC::ICC_VS: return "vs";
102 case SPCC::FCC_U: return "u";
103 case SPCC::FCC_G: return "g";
104 case SPCC::FCC_UG: return "ug";
105 case SPCC::FCC_L: return "l";
106 case SPCC::FCC_UL: return "ul";
107 case SPCC::FCC_LG: return "lg";
108 case SPCC::FCC_NE: return "ne";
109 case SPCC::FCC_E: return "e";
110 case SPCC::FCC_UE: return "ue";
111 case SPCC::FCC_GE: return "ge";
112 case SPCC::FCC_UGE: return "uge";
113 case SPCC::FCC_LE: return "le";
114 case SPCC::FCC_ULE: return "ule";
115 case SPCC::FCC_O: return "o";
Chris Lattner6788faa2006-01-31 06:49:09 +0000116 }
117 }
118} // end namespace llvm
Brian Gaekee785e532004-02-25 19:28:19 +0000119#endif