mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 18:04:59 +00:00
a8c409ad9b
in Emitter.cpp, just convert the Sparc version of the constant pool into what's already supported and inter-operate. * Implemented a first pass at lazy function resolution in the JITResolver. That required adding a SparcV9CodeEmitter pointer to simplify generating bit-patterns of the instructions. * SparcV9CodeEmitter now creates and destroys static TheJITResolver, which makes sense because the SparcV9CodeEmitter is the only user of TheJITResolver, and lives for the entire duration of the JIT (via PassManager which lives in VM). * Changed all return values in the JITResolver to uint64_t because of the 64-bit Sparc architecture. * Added a new version of getting the value of a GlobalValue in the SparcV9CodeEmitter, which now works for already-generated functions (JITted or library functions). * Removed little-used and unused functions, cleaning up the internal view of the SparcV9CodeEmitter. llvm-svn: 6612
53 lines
1.6 KiB
C++
53 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 {
|
|
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);
|
|
unsigned getValueBit(int64_t Val, unsigned bit);
|
|
void emitBasicBlock(MachineBasicBlock &MBB);
|
|
void* getGlobalAddress(GlobalValue *V, MachineInstr &MI,
|
|
bool isPCRelative);
|
|
};
|
|
|
|
#endif
|