LLVM API Documentation

Sparc.h

Go to the documentation of this file.
00001 //===-- Sparc.h - Top-level interface for Sparc representation --*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file contains the entry points for global functions defined in the LLVM
00011 // Sparc back-end.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef TARGET_SPARC_H
00016 #define TARGET_SPARC_H
00017 
00018 #include "llvm/Support/ErrorHandling.h"
00019 #include "llvm/Target/TargetMachine.h"
00020 #include <cassert>
00021 
00022 namespace llvm {
00023   class FunctionPass;
00024   class SparcTargetMachine;
00025   class formatted_raw_ostream;
00026 
00027   FunctionPass *createSparcISelDag(SparcTargetMachine &TM);
00028   FunctionPass *createSparcDelaySlotFillerPass(TargetMachine &TM);
00029   FunctionPass *createSparcFPMoverPass(TargetMachine &TM);
00030 
00031   extern Target TheSparcTarget;
00032 
00033 } // end namespace llvm;
00034 
00035 // Defines symbolic names for Sparc registers.  This defines a mapping from
00036 // register name to register number.
00037 //
00038 #include "SparcGenRegisterNames.inc"
00039 
00040 // Defines symbolic names for the Sparc instructions.
00041 //
00042 #include "SparcGenInstrNames.inc"
00043 
00044 
00045 namespace llvm {
00046   // Enums corresponding to Sparc condition codes, both icc's and fcc's.  These
00047   // values must be kept in sync with the ones in the .td file.
00048   namespace SPCC {
00049     enum CondCodes {
00050       //ICC_A   =  8   ,  // Always
00051       //ICC_N   =  0   ,  // Never
00052       ICC_NE  =  9   ,  // Not Equal
00053       ICC_E   =  1   ,  // Equal
00054       ICC_G   = 10   ,  // Greater
00055       ICC_LE  =  2   ,  // Less or Equal
00056       ICC_GE  = 11   ,  // Greater or Equal
00057       ICC_L   =  3   ,  // Less
00058       ICC_GU  = 12   ,  // Greater Unsigned
00059       ICC_LEU =  4   ,  // Less or Equal Unsigned
00060       ICC_CC  = 13   ,  // Carry Clear/Great or Equal Unsigned
00061       ICC_CS  =  5   ,  // Carry Set/Less Unsigned
00062       ICC_POS = 14   ,  // Positive
00063       ICC_NEG =  6   ,  // Negative
00064       ICC_VC  = 15   ,  // Overflow Clear
00065       ICC_VS  =  7   ,  // Overflow Set
00066       
00067       //FCC_A   =  8+16,  // Always
00068       //FCC_N   =  0+16,  // Never
00069       FCC_U   =  7+16,  // Unordered
00070       FCC_G   =  6+16,  // Greater
00071       FCC_UG  =  5+16,  // Unordered or Greater
00072       FCC_L   =  4+16,  // Less
00073       FCC_UL  =  3+16,  // Unordered or Less
00074       FCC_LG  =  2+16,  // Less or Greater
00075       FCC_NE  =  1+16,  // Not Equal
00076       FCC_E   =  9+16,  // Equal
00077       FCC_UE  = 10+16,  // Unordered or Equal
00078       FCC_GE  = 11+16,  // Greater or Equal
00079       FCC_UGE = 12+16,  // Unordered or Greater or Equal
00080       FCC_LE  = 13+16,  // Less or Equal
00081       FCC_ULE = 14+16,  // Unordered or Less or Equal
00082       FCC_O   = 15+16   // Ordered
00083     };
00084   }
00085   
00086   inline static const char *SPARCCondCodeToString(SPCC::CondCodes CC) {
00087     switch (CC) {
00088     default: llvm_unreachable("Unknown condition code");
00089     case SPCC::ICC_NE:  return "ne";
00090     case SPCC::ICC_E:   return "e";
00091     case SPCC::ICC_G:   return "g";
00092     case SPCC::ICC_LE:  return "le";
00093     case SPCC::ICC_GE:  return "ge";
00094     case SPCC::ICC_L:   return "l";
00095     case SPCC::ICC_GU:  return "gu";
00096     case SPCC::ICC_LEU: return "leu";
00097     case SPCC::ICC_CC:  return "cc";
00098     case SPCC::ICC_CS:  return "cs";
00099     case SPCC::ICC_POS: return "pos";
00100     case SPCC::ICC_NEG: return "neg";
00101     case SPCC::ICC_VC:  return "vc";
00102     case SPCC::ICC_VS:  return "vs";
00103     case SPCC::FCC_U:   return "u";
00104     case SPCC::FCC_G:   return "g";
00105     case SPCC::FCC_UG:  return "ug";
00106     case SPCC::FCC_L:   return "l";
00107     case SPCC::FCC_UL:  return "ul";
00108     case SPCC::FCC_LG:  return "lg";
00109     case SPCC::FCC_NE:  return "ne";
00110     case SPCC::FCC_E:   return "e";
00111     case SPCC::FCC_UE:  return "ue";
00112     case SPCC::FCC_GE:  return "ge";
00113     case SPCC::FCC_UGE: return "uge";
00114     case SPCC::FCC_LE:  return "le";
00115     case SPCC::FCC_ULE: return "ule";
00116     case SPCC::FCC_O:   return "o";
00117     }       
00118   }
00119 }  // end namespace llvm
00120 #endif