blob: 98563db4b9e57734c568a508e146674746fd149e [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
Evan Chengc60f9b72011-07-14 20:59:42 +000018#include "MCTargetDesc/SparcMCTargetDesc.h"
Torok Edwinc25e7582009-07-11 20:10:48 +000019#include "llvm/Support/ErrorHandling.h"
Bill Wendling98a366d2009-04-29 23:29:43 +000020#include "llvm/Target/TargetMachine.h"
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;
David Greene71847812009-07-14 20:18:05 +000025 class formatted_raw_ostream;
Brian Gaekee785e532004-02-25 19:28:19 +000026
Dan Gohmanda8ac5f2008-10-03 16:55:19 +000027 FunctionPass *createSparcISelDag(SparcTargetMachine &TM);
Chris Lattner7c90f732006-02-05 05:50:24 +000028 FunctionPass *createSparcDelaySlotFillerPass(TargetMachine &TM);
Daniel Dunbar4cb1e132009-07-18 23:03:22 +000029
Brian Gaekee785e532004-02-25 19:28:19 +000030} // end namespace llvm;
31
Chris Lattner6788faa2006-01-31 06:49:09 +000032namespace llvm {
Chris Lattner7c90f732006-02-05 05:50:24 +000033 // Enums corresponding to Sparc condition codes, both icc's and fcc's. These
Chris Lattner6788faa2006-01-31 06:49:09 +000034 // values must be kept in sync with the ones in the .td file.
Chris Lattner7c90f732006-02-05 05:50:24 +000035 namespace SPCC {
Chris Lattner6788faa2006-01-31 06:49:09 +000036 enum CondCodes {
37 //ICC_A = 8 , // Always
38 //ICC_N = 0 , // Never
39 ICC_NE = 9 , // Not Equal
40 ICC_E = 1 , // Equal
41 ICC_G = 10 , // Greater
42 ICC_LE = 2 , // Less or Equal
43 ICC_GE = 11 , // Greater or Equal
44 ICC_L = 3 , // Less
45 ICC_GU = 12 , // Greater Unsigned
46 ICC_LEU = 4 , // Less or Equal Unsigned
47 ICC_CC = 13 , // Carry Clear/Great or Equal Unsigned
48 ICC_CS = 5 , // Carry Set/Less Unsigned
49 ICC_POS = 14 , // Positive
50 ICC_NEG = 6 , // Negative
51 ICC_VC = 15 , // Overflow Clear
52 ICC_VS = 7 , // Overflow Set
Venkatraman Govindaraju1e06bcb2013-06-04 18:33:25 +000053
Chris Lattner6788faa2006-01-31 06:49:09 +000054 //FCC_A = 8+16, // Always
55 //FCC_N = 0+16, // Never
56 FCC_U = 7+16, // Unordered
57 FCC_G = 6+16, // Greater
58 FCC_UG = 5+16, // Unordered or Greater
59 FCC_L = 4+16, // Less
60 FCC_UL = 3+16, // Unordered or Less
61 FCC_LG = 2+16, // Less or Greater
62 FCC_NE = 1+16, // Not Equal
63 FCC_E = 9+16, // Equal
64 FCC_UE = 10+16, // Unordered or Equal
65 FCC_GE = 11+16, // Greater or Equal
66 FCC_UGE = 12+16, // Unordered or Greater or Equal
67 FCC_LE = 13+16, // Less or Equal
68 FCC_ULE = 14+16, // Unordered or Less or Equal
Chris Lattnerd74ea2b2006-05-24 17:04:05 +000069 FCC_O = 15+16 // Ordered
Chris Lattner6788faa2006-01-31 06:49:09 +000070 };
71 }
Venkatraman Govindaraju1e06bcb2013-06-04 18:33:25 +000072
Chris Lattner9c5d4de2006-11-03 01:11:05 +000073 inline static const char *SPARCCondCodeToString(SPCC::CondCodes CC) {
Chris Lattner6788faa2006-01-31 06:49:09 +000074 switch (CC) {
Chris Lattner7c90f732006-02-05 05:50:24 +000075 case SPCC::ICC_NE: return "ne";
76 case SPCC::ICC_E: return "e";
77 case SPCC::ICC_G: return "g";
78 case SPCC::ICC_LE: return "le";
79 case SPCC::ICC_GE: return "ge";
80 case SPCC::ICC_L: return "l";
81 case SPCC::ICC_GU: return "gu";
82 case SPCC::ICC_LEU: return "leu";
83 case SPCC::ICC_CC: return "cc";
84 case SPCC::ICC_CS: return "cs";
85 case SPCC::ICC_POS: return "pos";
86 case SPCC::ICC_NEG: return "neg";
87 case SPCC::ICC_VC: return "vc";
88 case SPCC::ICC_VS: return "vs";
89 case SPCC::FCC_U: return "u";
90 case SPCC::FCC_G: return "g";
91 case SPCC::FCC_UG: return "ug";
92 case SPCC::FCC_L: return "l";
93 case SPCC::FCC_UL: return "ul";
94 case SPCC::FCC_LG: return "lg";
95 case SPCC::FCC_NE: return "ne";
96 case SPCC::FCC_E: return "e";
97 case SPCC::FCC_UE: return "ue";
98 case SPCC::FCC_GE: return "ge";
99 case SPCC::FCC_UGE: return "uge";
100 case SPCC::FCC_LE: return "le";
101 case SPCC::FCC_ULE: return "ule";
102 case SPCC::FCC_O: return "o";
Benjamin Kramere4ad5822012-01-10 20:47:20 +0000103 }
104 llvm_unreachable("Invalid cond code");
Chris Lattner6788faa2006-01-31 06:49:09 +0000105 }
106} // end namespace llvm
Brian Gaekee785e532004-02-25 19:28:19 +0000107#endif