Instead of passing in an unsigned value for the optimization level, use an enum,
[oota-llvm.git] / lib / Target / PIC16 / PIC16.h
1 //===-- PIC16.h - Top-level interface for PIC16 representation --*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source 
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the entry points for global functions defined in 
11 // the LLVM PIC16 back-end.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_TARGET_PIC16_H
16 #define LLVM_TARGET_PIC16_H
17
18 #include "llvm/Target/TargetMachine.h"
19 #include <iosfwd>
20 #include <cassert>
21
22 namespace llvm {
23   class PIC16TargetMachine;
24   class FunctionPass;
25   class MachineCodeEmitter;
26   class raw_ostream;
27
28 namespace PIC16CC {
29   enum CondCodes {
30     EQ,
31     NE,
32     LT,
33     LE,
34     GT,
35     GE,
36     ULT,
37     UGT,
38     ULE,
39     UGE
40   };
41 }
42
43   inline static const char *PIC16CondCodeToString(PIC16CC::CondCodes CC) {
44     switch (CC) {
45     default: assert(0 && "Unknown condition code");
46     case PIC16CC::NE:  return "ne";
47     case PIC16CC::EQ:   return "eq";
48     case PIC16CC::LT:   return "lt";
49     case PIC16CC::ULT:   return "lt";
50     case PIC16CC::LE:  return "le";
51     case PIC16CC::GT:  return "gt";
52     case PIC16CC::UGT:  return "gt";
53     case PIC16CC::GE:   return "ge";
54     }
55   }
56
57   inline static bool isSignedComparison(PIC16CC::CondCodes CC) {
58     switch (CC) {
59     default: assert(0 && "Unknown condition code");
60     case PIC16CC::NE:  
61     case PIC16CC::EQ: 
62     case PIC16CC::LT:
63     case PIC16CC::LE:
64     case PIC16CC::GE:
65     case PIC16CC::GT:
66       return true;
67     case PIC16CC::ULT:
68     case PIC16CC::UGT:
69     case PIC16CC::ULE:
70     case PIC16CC::UGE:
71       return false;   // condition codes for unsigned comparison. 
72     }
73   }
74
75
76   FunctionPass *createPIC16ISelDag(PIC16TargetMachine &TM);
77   FunctionPass *createPIC16CodePrinterPass(raw_ostream &OS, 
78                                            PIC16TargetMachine &TM,
79                                            CodeGenOpt::Level OptLevel,
80                                            bool Verbose);
81 } // end namespace llvm;
82
83 // Defines symbolic names for PIC16 registers.  This defines a mapping from
84 // register name to register number.
85 #include "PIC16GenRegisterNames.inc"
86
87 // Defines symbolic names for the PIC16 instructions.
88 #include "PIC16GenInstrNames.inc"
89
90 #endif