* Use the MachineConstantPool for storing constants instead of a hash_set;
[oota-llvm.git] / lib / Target / SparcV9 / SparcV9CodeEmitter.h
index 86f74c14c831bd4007f43bbdbeeae357f1ca0325..48bb6734dd54302308b558d6006ee0ced7b8ad2e 100644 (file)
@@ -1,5 +1,13 @@
 //===-- 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.
+// 
+//===----------------------------------------------------------------------===//
+// 
+// TODO: Need a description here.
 //
 //===----------------------------------------------------------------------===//
 
@@ -18,13 +26,13 @@ class MachineOperand;
 class SparcV9CodeEmitter : public MachineFunctionPass {
   TargetMachine &TM;
   MachineCodeEmitter &MCE;
-  BasicBlock *currBB;
+  const BasicBlock *currBB;
 
   // Tracks which instruction references which BasicBlock
-  std::vector<std::pair<BasicBlock*,
+  std::vector<std::pair<const BasicBlock*,
                         std::pair<unsigned*,MachineInstr*> > > BBRefs;
   // Tracks where each BasicBlock starts
-  std::map<BasicBlock*, long> BBLocations;
+  std::map<const 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
@@ -34,21 +42,47 @@ public:
   SparcV9CodeEmitter(TargetMachine &T, MachineCodeEmitter &M);
   ~SparcV9CodeEmitter();
 
+  /// 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);
 
+  /// emitFarCall - produces a code sequence to make a call to a destination
+  /// that does not fit in the 30 bits that a call instruction allows.
+  /// If the function F is non-null, this also saves the return address in
+  /// the LazyResolver map of the JITResolver.
+  void emitFarCall(uint64_t Addr, Function *F = 0);
+
 private:    
+  /// getMachineOpValue - 
+  ///
   int64_t getMachineOpValue(MachineInstr &MI, MachineOperand &MO);
-  inline 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);
+  /// emitFarCall - 
+  ///
   unsigned getRealRegNum(unsigned fakeReg, MachineInstr &MI);
+
 };
 
 #endif