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; |
Jyotsna Verma | 7503a62 | 2013-02-20 16:13:27 +0000 | [diff] [blame] | 24 | class ModulePass; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 25 | class TargetMachine; |
Evandro Menezes | 5cee621 | 2012-04-12 17:55:53 +0000 | [diff] [blame] | 26 | class MachineInstr; |
Jyotsna Verma | 7503a62 | 2013-02-20 16:13:27 +0000 | [diff] [blame] | 27 | class HexagonMCInst; |
Evandro Menezes | 5cee621 | 2012-04-12 17:55:53 +0000 | [diff] [blame] | 28 | class HexagonAsmPrinter; |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 29 | class HexagonTargetMachine; |
| 30 | class raw_ostream; |
| 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 | |
Krzysztof Parzyszek | d500747 | 2013-05-06 18:38:37 +0000 | [diff] [blame] | 39 | FunctionPass *createHexagonSplitTFRCondSets(const HexagonTargetMachine &TM); |
Jyotsna Verma | 5eb5980 | 2013-05-07 19:53:00 +0000 | [diff] [blame] | 40 | FunctionPass *createHexagonSplitConst32AndConst64( |
| 41 | const HexagonTargetMachine &TM); |
Eric Christopher | 6ff7ed6 | 2015-02-02 18:46:31 +0000 | [diff] [blame^] | 42 | FunctionPass *createHexagonExpandPredSpillCode(); |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 43 | FunctionPass *createHexagonHardwareLoops(); |
Sirish Pande | 30804c2 | 2012-02-15 18:52:27 +0000 | [diff] [blame] | 44 | FunctionPass *createHexagonPeephole(); |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 45 | FunctionPass *createHexagonFixupHwLoops(); |
Jyotsna Verma | 803e506 | 2013-05-14 18:54:06 +0000 | [diff] [blame] | 46 | FunctionPass *createHexagonNewValueJump(); |
| 47 | FunctionPass *createHexagonCopyToCombine(); |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 48 | FunctionPass *createHexagonPacketizer(); |
Sirish Pande | 4bd20c5 | 2012-05-12 05:10:30 +0000 | [diff] [blame] | 49 | FunctionPass *createHexagonNewValueJump(); |
| 50 | |
Evandro Menezes | 5cee621 | 2012-04-12 17:55:53 +0000 | [diff] [blame] | 51 | /* TODO: object output. |
| 52 | MCCodeEmitter *createHexagonMCCodeEmitter(const Target &, |
Krzysztof Parzyszek | d500747 | 2013-05-06 18:38:37 +0000 | [diff] [blame] | 53 | const TargetMachine &TM, |
Evandro Menezes | 5cee621 | 2012-04-12 17:55:53 +0000 | [diff] [blame] | 54 | MCContext &Ctx); |
| 55 | */ |
| 56 | /* TODO: assembler input. |
Sirish Pande | 4bd20c5 | 2012-05-12 05:10:30 +0000 | [diff] [blame] | 57 | TargetAsmBackend *createHexagonAsmBackend(const Target &, |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 58 | const std::string &); |
Evandro Menezes | 5cee621 | 2012-04-12 17:55:53 +0000 | [diff] [blame] | 59 | */ |
Jyotsna Verma | 7503a62 | 2013-02-20 16:13:27 +0000 | [diff] [blame] | 60 | void HexagonLowerToMC(const MachineInstr *MI, HexagonMCInst &MCI, |
Evandro Menezes | 5cee621 | 2012-04-12 17:55:53 +0000 | [diff] [blame] | 61 | HexagonAsmPrinter &AP); |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 62 | } // end namespace llvm; |
| 63 | |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 64 | #define Hexagon_POINTER_SIZE 4 |
| 65 | |
| 66 | #define Hexagon_PointerSize (Hexagon_POINTER_SIZE) |
| 67 | #define Hexagon_PointerSize_Bits (Hexagon_POINTER_SIZE * 8) |
| 68 | #define Hexagon_WordSize Hexagon_PointerSize |
| 69 | #define Hexagon_WordSize_Bits Hexagon_PointerSize_Bits |
| 70 | |
| 71 | // allocframe saves LR and FP on stack before allocating |
| 72 | // a new stack frame. This takes 8 bytes. |
| 73 | #define HEXAGON_LRFP_SIZE 8 |
| 74 | |
Evandro Menezes | 5cee621 | 2012-04-12 17:55:53 +0000 | [diff] [blame] | 75 | // Normal instruction size (in bytes). |
| 76 | #define HEXAGON_INSTR_SIZE 4 |
| 77 | |
Sirish Pande | f8e5e3c | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 78 | // Maximum number of words and instructions in a packet. |
Evandro Menezes | 5cee621 | 2012-04-12 17:55:53 +0000 | [diff] [blame] | 79 | #define HEXAGON_PACKET_SIZE 4 |
| 80 | |
Tony Linthicum | 1213a7a | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 81 | #endif |