mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-26 14:15:53 +00:00
07d4516f92
allow, i.e. make a sequence of instructions to enable an indirect call using jump-and-link and 2 temporary registers (which we save and ultimately restore). Warning: if the delay slot of a function call is used to do meaningful work and not just a NOP, this behavior is incorrect. However, the Sparc backend does not yet utilize the delay slots effectively, so it is not necessary to make an overly complicated algorithm for something that's not used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7178 91177308-0d34-0410-b5e6-96231b3b80d8
57 lines
1.7 KiB
C++
57 lines
1.7 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 {
|
|
TargetMachine &TM;
|
|
MachineCodeEmitter &MCE;
|
|
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)
|
|
// But we also need to map Constants to ConstantPool indices
|
|
std::map<const Constant*, unsigned> ConstantMap;
|
|
|
|
public:
|
|
SparcV9CodeEmitter(TargetMachine &T, MachineCodeEmitter &M);
|
|
~SparcV9CodeEmitter();
|
|
|
|
bool runOnMachineFunction(MachineFunction &F);
|
|
void emitWord(unsigned Val);
|
|
|
|
/// Function generated by the CodeEmitterGenerator using TableGen
|
|
///
|
|
unsigned getBinaryCodeForInstr(MachineInstr &MI);
|
|
|
|
private:
|
|
int64_t getMachineOpValue(MachineInstr &MI, MachineOperand &MO);
|
|
inline unsigned getValueBit(int64_t Val, unsigned bit);
|
|
void emitBasicBlock(MachineBasicBlock &MBB);
|
|
void* getGlobalAddress(GlobalValue *V, MachineInstr &MI,
|
|
bool isPCRelative);
|
|
bool isFPInstr(MachineInstr &MI);
|
|
unsigned getRealRegNum(unsigned fakeReg, MachineInstr &MI);
|
|
inline void emitFarCall(uint64_t Addr);
|
|
|
|
};
|
|
|
|
#endif
|