mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-26 14:15:53 +00:00
f86aaa8eb7
from lib/Target/X86/X86CodeEmitter.cpp . git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6530 91177308-0d34-0410-b5e6-96231b3b80d8
59 lines
1.6 KiB
C++
59 lines
1.6 KiB
C++
//===-- SparcV9CodeEmitter.h ------------------------------------*- C++ -*-===//
|
|
//
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SPARCV9CODEEMITTER_H
|
|
#define SPARCV9CODEEMITTER_H
|
|
|
|
#include "llvm/BasicBlock.h"
|
|
#include "llvm/CodeGen/MachineCodeEmitter.h"
|
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
|
#include "llvm/Target/TargetMachine.h"
|
|
|
|
class GlobalValue;
|
|
class MachineInstr;
|
|
class MachineOperand;
|
|
|
|
class SparcV9CodeEmitter : public MachineFunctionPass {
|
|
MachineCodeEmitter *MCE;
|
|
TargetMachine *TM;
|
|
BasicBlock *currBB;
|
|
|
|
// Tracks which instruction references which BasicBlock
|
|
std::vector<std::pair<BasicBlock*,
|
|
std::pair<unsigned*,MachineInstr*> > > BBRefs;
|
|
// Tracks where each BasicBlock starts
|
|
std::map<BasicBlock*, long> BBLocations;
|
|
// Tracks locations of Constants which are laid out in memory (e.g. FP)
|
|
std::map<const Constant*, void*> ConstantMap;
|
|
|
|
public:
|
|
SparcV9CodeEmitter(TargetMachine *tm, MachineCodeEmitter &M) {
|
|
MCE = &M;
|
|
TM = tm;
|
|
}
|
|
|
|
bool runOnMachineFunction(MachineFunction &F);
|
|
|
|
/// Function generated by the CodeEmitterGenerator using TableGen
|
|
///
|
|
unsigned getBinaryCodeForInstr(MachineInstr &MI);
|
|
|
|
private:
|
|
int64_t getMachineOpValue(MachineInstr &MI, MachineOperand &MO);
|
|
unsigned getValueBit(int64_t Val, unsigned bit);
|
|
|
|
void emitConstant(unsigned Val, unsigned Size);
|
|
|
|
void emitBasicBlock(MachineBasicBlock &MBB);
|
|
void emitInstruction(MachineInstr &MI);
|
|
|
|
void* convertAddress(intptr_t Addr, bool isPCRelative);
|
|
void* getGlobalAddress(GlobalValue *V, MachineInstr &MI,
|
|
bool isPCRelative);
|
|
|
|
};
|
|
|
|
#endif
|