X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FSparcV9%2FSparcV9CodeEmitter.h;h=b5e3e2175455b91a50e71175669cc3db634bf86c;hb=4548a0ed32949ab38310e103af5d85650ecd2a5d;hp=d9a03e5b2314f6d62965c68cddcf54918095c162;hpb=f47d9c28d9b395a0c0b14ceb07124c39ab13e493;p=oota-llvm.git diff --git a/lib/Target/SparcV9/SparcV9CodeEmitter.h b/lib/Target/SparcV9/SparcV9CodeEmitter.h index d9a03e5b231..b5e3e217545 100644 --- a/lib/Target/SparcV9/SparcV9CodeEmitter.h +++ b/lib/Target/SparcV9/SparcV9CodeEmitter.h @@ -1,5 +1,16 @@ //===-- SparcV9CodeEmitter.h ------------------------------------*- C++ -*-===// -// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Target-specific portions of the machine code emitter for the SparcV9. +// This class interfaces with the JIT's Emitter in order to turn MachineInstrs +// into words of binary machine code. Its code is partially generated by +// TableGen's CodeEmitterGenerator. // //===----------------------------------------------------------------------===// @@ -11,6 +22,8 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/Target/TargetMachine.h" +namespace llvm { + class GlobalValue; class MachineInstr; class MachineOperand; @@ -18,39 +31,57 @@ class MachineOperand; class SparcV9CodeEmitter : public MachineFunctionPass { TargetMachine &TM; MachineCodeEmitter &MCE; - BasicBlock *currBB; + const BasicBlock *currBB; // Tracks which instruction references which BasicBlock - std::vector > > BBRefs; // Tracks where each BasicBlock starts - std::map 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 ConstantMap; + std::map BBLocations; public: SparcV9CodeEmitter(TargetMachine &T, MachineCodeEmitter &M); - ~SparcV9CodeEmitter(); + ~SparcV9CodeEmitter() {} + + const char *getPassName() const { return "SparcV9 Machine Code Emitter"; } + /// runOnMachineFunction - emits the given machine function to memory. + /// bool runOnMachineFunction(MachineFunction &F); + + /// emitWord - writes out the given 32-bit value to memory at the current PC. + /// void emitWord(unsigned Val); - - /// Function generated by the CodeEmitterGenerator using TableGen + + /// getBinaryCodeForInstr - This function, generated by the + /// CodeEmitterGenerator using TableGen, produces the binary encoding for + /// machine instructions. /// unsigned getBinaryCodeForInstr(MachineInstr &MI); -private: +private: + /// getMachineOpValue - + /// int64_t getMachineOpValue(MachineInstr &MI, MachineOperand &MO); - unsigned getValueBit(int64_t Val, unsigned bit); + + /// emitBasicBlock - + /// void emitBasicBlock(MachineBasicBlock &MBB); + + /// getValueBit - + /// + unsigned getValueBit(int64_t Val, unsigned bit); + + /// getGlobalAddress - + /// void* getGlobalAddress(GlobalValue *V, MachineInstr &MI, bool isPCRelative); - bool isFPInstr(MachineInstr &MI); - unsigned getRealRegNum(unsigned fakeReg, unsigned regClass, - MachineInstr &MI); + /// emitFarCall - + /// + unsigned getRealRegNum(unsigned fakeReg, MachineInstr &MI); }; +} // End llvm namespace + #endif