Misha Brukman | a9f7f6e | 2003-05-30 20:17:33 +0000 | [diff] [blame^] | 1 | //===-- SparcV9CodeEmitter.h ------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // |
| 4 | //===----------------------------------------------------------------------===// |
Misha Brukman | 0cc640e | 2003-05-27 21:45:05 +0000 | [diff] [blame] | 5 | |
| 6 | #ifndef SPARCV9CODEEMITTER_H |
| 7 | #define SPARCV9CODEEMITTER_H |
| 8 | |
Misha Brukman | 0d60345 | 2003-05-27 22:41:44 +0000 | [diff] [blame] | 9 | #include "llvm/BasicBlock.h" |
Misha Brukman | 0cc640e | 2003-05-27 21:45:05 +0000 | [diff] [blame] | 10 | #include "llvm/CodeGen/MachineCodeEmitter.h" |
| 11 | #include "llvm/CodeGen/MachineFunctionPass.h" |
| 12 | #include "llvm/CodeGen/MachineInstr.h" |
Misha Brukman | a9f7f6e | 2003-05-30 20:17:33 +0000 | [diff] [blame^] | 13 | #include "llvm/Target/TargetMachine.h" |
Misha Brukman | 0cc640e | 2003-05-27 21:45:05 +0000 | [diff] [blame] | 14 | |
| 15 | class SparcV9CodeEmitter : public MachineFunctionPass { |
Misha Brukman | a9f7f6e | 2003-05-30 20:17:33 +0000 | [diff] [blame^] | 16 | static MachineCodeEmitter *MCE; |
| 17 | static TargetMachine *TM; |
Misha Brukman | f2ef767 | 2003-05-27 22:48:28 +0000 | [diff] [blame] | 18 | BasicBlock *currBB; |
Misha Brukman | 0cc640e | 2003-05-27 21:45:05 +0000 | [diff] [blame] | 19 | |
| 20 | public: |
Misha Brukman | a9f7f6e | 2003-05-30 20:17:33 +0000 | [diff] [blame^] | 21 | SparcV9CodeEmitter(TargetMachine *tm, MachineCodeEmitter &M) { |
| 22 | MCE = &M; |
| 23 | TM = tm; |
| 24 | } |
| 25 | |
Misha Brukman | 0cc640e | 2003-05-27 21:45:05 +0000 | [diff] [blame] | 26 | bool runOnMachineFunction(MachineFunction &F); |
| 27 | |
| 28 | /// Function generated by the CodeEmitterGenerator using TableGen |
| 29 | /// |
| 30 | static unsigned getBinaryCodeForInstr(MachineInstr &MI); |
| 31 | |
| 32 | private: |
Misha Brukman | a9f7f6e | 2003-05-30 20:17:33 +0000 | [diff] [blame^] | 33 | static int64_t getMachineOpValue(MachineInstr &MI, MachineOperand &MO); |
Misha Brukman | 0cc640e | 2003-05-27 21:45:05 +0000 | [diff] [blame] | 34 | static unsigned getValueBit(int64_t Val, unsigned bit); |
| 35 | |
| 36 | void emitConstant(unsigned Val, unsigned Size); |
| 37 | |
| 38 | void emitBasicBlock(MachineBasicBlock &MBB); |
| 39 | void emitInstruction(MachineInstr &MI); |
| 40 | |
| 41 | }; |
| 42 | |
| 43 | #endif |