Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1 | //=-- Hexagon.h - Top-level interface for Hexagon 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 the LLVM |
| 11 | // Hexagon back-end. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 15 | #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGON_H |
| 16 | #define LLVM_LIB_TARGET_HEXAGON_HEXAGON_H |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 17 | |
Tony Linthicum | b3705e0 | 2011-12-15 22:29:08 +0000 | [diff] [blame] | 18 | #include "MCTargetDesc/HexagonMCTargetDesc.h" |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 19 | #include "llvm/Target/TargetLowering.h" |
Evandro Menezes | 5cee621 | 2012-04-12 17:55:53 +0000 | [diff] [blame] | 20 | #include "llvm/Target/TargetMachine.h" |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 21 | |
| 22 | namespace llvm { |
| 23 | class FunctionPass; |
Evandro Menezes | 5cee621 | 2012-04-12 17:55:53 +0000 | [diff] [blame] | 24 | class HexagonAsmPrinter; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 25 | class HexagonTargetMachine; |
Colin LeMahieu | 1174fea | 2015-02-19 21:10:50 +0000 | [diff] [blame] | 26 | class MachineInstr; |
| 27 | class MCInst; |
| 28 | class ModulePass; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 29 | class raw_ostream; |
Colin LeMahieu | 1174fea | 2015-02-19 21:10:50 +0000 | [diff] [blame] | 30 | class TargetMachine; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 31 | |
Bill Wendling | a3cd350 | 2013-06-19 21:36:55 +0000 | [diff] [blame] | 32 | FunctionPass *createHexagonISelDag(HexagonTargetMachine &TM, |
Jyotsna Verma | d922524 | 2013-02-13 21:38:46 +0000 | [diff] [blame] | 33 | CodeGenOpt::Level OptLevel); |
Krzysztof Parzyszek | d500747 | 2013-05-06 18:38:37 +0000 | [diff] [blame] | 34 | FunctionPass *createHexagonDelaySlotFillerPass(const TargetMachine &TM); |
| 35 | FunctionPass *createHexagonFPMoverPass(const TargetMachine &TM); |
| 36 | FunctionPass *createHexagonRemoveExtendArgs(const HexagonTargetMachine &TM); |
Eric Christopher | 5c3376a | 2015-02-02 18:46:27 +0000 | [diff] [blame] | 37 | FunctionPass *createHexagonCFGOptimizer(); |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 38 | |
Eric Christopher | 01f875e | 2015-02-02 22:11:43 +0000 | [diff] [blame] | 39 | FunctionPass *createHexagonSplitConst32AndConst64(); |
Eric Christopher | 6ff7ed6 | 2015-02-02 18:46:31 +0000 | [diff] [blame] | 40 | FunctionPass *createHexagonExpandPredSpillCode(); |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 41 | FunctionPass *createHexagonHardwareLoops(); |
Sirish Pande | 30804c2 | 2012-02-15 18:52:27 +0000 | [diff] [blame] | 42 | FunctionPass *createHexagonPeephole(); |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 43 | FunctionPass *createHexagonFixupHwLoops(); |
Jyotsna Verma | 803e506 | 2013-05-14 18:54:06 +0000 | [diff] [blame] | 44 | FunctionPass *createHexagonNewValueJump(); |
| 45 | FunctionPass *createHexagonCopyToCombine(); |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 46 | FunctionPass *createHexagonPacketizer(); |
Sirish Pande | 4bd20c5 | 2012-05-12 05:10:30 +0000 | [diff] [blame] | 47 | FunctionPass *createHexagonNewValueJump(); |
| 48 | |
Evandro Menezes | 5cee621 | 2012-04-12 17:55:53 +0000 | [diff] [blame] | 49 | /* TODO: object output. |
| 50 | MCCodeEmitter *createHexagonMCCodeEmitter(const Target &, |
Krzysztof Parzyszek | d500747 | 2013-05-06 18:38:37 +0000 | [diff] [blame] | 51 | const TargetMachine &TM, |
Evandro Menezes | 5cee621 | 2012-04-12 17:55:53 +0000 | [diff] [blame] | 52 | MCContext &Ctx); |
| 53 | */ |
| 54 | /* TODO: assembler input. |
Sirish Pande | 4bd20c5 | 2012-05-12 05:10:30 +0000 | [diff] [blame] | 55 | TargetAsmBackend *createHexagonAsmBackend(const Target &, |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 56 | const std::string &); |
Evandro Menezes | 5cee621 | 2012-04-12 17:55:53 +0000 | [diff] [blame] | 57 | */ |
Colin LeMahieu | 1174fea | 2015-02-19 21:10:50 +0000 | [diff] [blame] | 58 | void HexagonLowerToMC(MachineInstr const *MI, MCInst &MCI, |
Evandro Menezes | 5cee621 | 2012-04-12 17:55:53 +0000 | [diff] [blame] | 59 | HexagonAsmPrinter &AP); |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 60 | } // end namespace llvm; |
| 61 | |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 62 | #define Hexagon_POINTER_SIZE 4 |
| 63 | |
| 64 | #define Hexagon_PointerSize (Hexagon_POINTER_SIZE) |
| 65 | #define Hexagon_PointerSize_Bits (Hexagon_POINTER_SIZE * 8) |
| 66 | #define Hexagon_WordSize Hexagon_PointerSize |
| 67 | #define Hexagon_WordSize_Bits Hexagon_PointerSize_Bits |
| 68 | |
| 69 | // allocframe saves LR and FP on stack before allocating |
| 70 | // a new stack frame. This takes 8 bytes. |
| 71 | #define HEXAGON_LRFP_SIZE 8 |
| 72 | |
Evandro Menezes | 5cee621 | 2012-04-12 17:55:53 +0000 | [diff] [blame] | 73 | // Normal instruction size (in bytes). |
| 74 | #define HEXAGON_INSTR_SIZE 4 |
| 75 | |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 76 | // Maximum number of words and instructions in a packet. |
Evandro Menezes | 5cee621 | 2012-04-12 17:55:53 +0000 | [diff] [blame] | 77 | #define HEXAGON_PACKET_SIZE 4 |
| 78 | |
Colin LeMahieu | 68d967d | 2015-05-29 14:44:13 +0000 | [diff] [blame] | 79 | // Minimum number of instructions in an end-loop packet. |
| 80 | #define HEXAGON_PACKET_INNER_SIZE 2 |
| 81 | #define HEXAGON_PACKET_OUTER_SIZE 3 |
Colin LeMahieu | b23c47b | 2015-05-31 21:57:09 +0000 | [diff] [blame^] | 82 | // Maximum number of instructions in a packet before shuffling, |
| 83 | // including a compound one or a duplex or an extender. |
| 84 | #define HEXAGON_PRESHUFFLE_PACKET_SIZE (HEXAGON_PACKET_SIZE + 3) |
Colin LeMahieu | 68d967d | 2015-05-29 14:44:13 +0000 | [diff] [blame] | 85 | |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 86 | #endif |