LLVM API Documentation

PIC16.h

Go to the documentation of this file.
00001 //===-- PIC16.h - Top-level interface for PIC16 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 
00011 // the LLVM PIC16 back-end.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_TARGET_PIC16_H
00016 #define LLVM_TARGET_PIC16_H
00017 
00018 #include <iosfwd>
00019 #include <cassert>
00020 
00021 namespace llvm {
00022   class PIC16TargetMachine;
00023   class FunctionPass;
00024   class MachineCodeEmitter;
00025   class raw_ostream;
00026 
00027 namespace PIC16CC {
00028   enum CondCodes {
00029     EQ,
00030     NE,
00031     LT,
00032     LE,
00033     GT,
00034     GE,
00035     ULT,
00036     UGT,
00037     ULE,
00038     UGE
00039   };
00040 }
00041 
00042   inline static const char *PIC16CondCodeToString(PIC16CC::CondCodes CC) {
00043     switch (CC) {
00044     default: assert(0 && "Unknown condition code");
00045     case PIC16CC::NE:  return "ne";
00046     case PIC16CC::EQ:   return "eq";
00047     case PIC16CC::LT:   return "lt";
00048     case PIC16CC::ULT:   return "lt";
00049     case PIC16CC::LE:  return "le";
00050     case PIC16CC::GT:  return "gt";
00051     case PIC16CC::UGT:  return "gt";
00052     case PIC16CC::GE:   return "ge";
00053     }
00054   }
00055 
00056   inline static bool isSignedComparison(PIC16CC::CondCodes CC) {
00057     switch (CC) {
00058     default: assert(0 && "Unknown condition code");
00059     case PIC16CC::NE:  
00060     case PIC16CC::EQ: 
00061     case PIC16CC::LT:
00062     case PIC16CC::LE:
00063     case PIC16CC::GE:
00064     case PIC16CC::GT:
00065       return true;
00066     case PIC16CC::ULT:
00067     case PIC16CC::UGT:
00068     case PIC16CC::ULE:
00069     case PIC16CC::UGE:
00070       return false;   // condition codes for unsigned comparison. 
00071     }
00072   }
00073 
00074 
00075   FunctionPass *createPIC16ISelDag(PIC16TargetMachine &TM);
00076   FunctionPass *createPIC16CodePrinterPass(raw_ostream &OS, 
00077                                            PIC16TargetMachine &TM);
00078 } // end namespace llvm;
00079 
00080 // Defines symbolic names for PIC16 registers.  This defines a mapping from
00081 // register name to register number.
00082 #include "PIC16GenRegisterNames.inc"
00083 
00084 // Defines symbolic names for the PIC16 instructions.
00085 #include "PIC16GenInstrNames.inc"
00086 
00087 #endif