[llvm-commits] CVS: llvm/include/llvm/CodeGen/AsmPrinter.h

Chris Lattner lattner at cs.uiuc.edu
Mon Aug 16 16:15:33 PDT 2004



Changes in directory llvm/include/llvm/CodeGen:

AsmPrinter.h added (r1.1)
---
Log message:

Initial implementation of the asmprinter base class


---
Diffs of the changes:  (+65 -0)

Index: llvm/include/llvm/CodeGen/AsmPrinter.h
diff -c /dev/null llvm/include/llvm/CodeGen/AsmPrinter.h:1.1
*** /dev/null	Mon Aug 16 18:15:31 2004
--- llvm/include/llvm/CodeGen/AsmPrinter.h	Mon Aug 16 18:15:20 2004
***************
*** 0 ****
--- 1,65 ----
+ //===-- llvm/CodeGen/AsmPrinter.h - AsmPrinter Framework --------*- 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.
+ // 
+ //===----------------------------------------------------------------------===//
+ //
+ // This class is intended to be used as a base class for target-specific
+ // asmwriters.  This class primarily takes care of printing global constants,
+ // which are printed in a very similar way across all targets.
+ //
+ //===----------------------------------------------------------------------===//
+ 
+ #ifndef LLVM_CODEGEN_ASMPRINTER_H
+ #define LLVM_CODEGEN_ASMPRINTER_H
+ 
+ #include "llvm/CodeGen/MachineFunctionPass.h"
+ 
+ namespace llvm {
+   class Constant;
+   class Mangler;
+ 
+   class AsmPrinter : public MachineFunctionPass {
+   protected:
+     /// Output stream on which we're printing assembly code.
+     ///
+     std::ostream &O;
+ 
+     /// Target machine description.
+     ///
+     TargetMachine &TM;
+ 
+     /// Name-mangler for global names.
+     ///
+     Mangler *Mang;
+ 
+     /// Cache of mangled name for current function. This is recalculated at the
+     /// beginning of each call to runOnMachineFunction().
+     ///
+     std::string CurrentFnName;
+ 
+     AsmPrinter(std::ostream &o, TargetMachine &tm) : O(o), TM(tm) { }
+ 
+     /// doInitialization - Set up the AsmPrinter when we are working on a new
+     /// module.  If your pass overrides this, it must make sure to explicitly
+     /// call this implementation.
+     bool doInitialization(Module &M);
+ 
+     /// doFinalization - Shut down the asmprinter.  If you override this in your
+     /// pass, you must make sure to call it explicitly.
+     bool doFinalization(Module &M);
+ 
+     /// setupMachineFunction - This should be called when a new MachineFunction
+     /// is being processed from runOnMachineFunction.
+     void setupMachineFunction(MachineFunction &MF);
+ 
+     /// emitConstantValueOnly - Print out the specified constant, without a
+     /// storage class.  Only constants of first-class type are allowed here.
+     void emitConstantValueOnly(const Constant *CV);
+   };
+ }
+ 
+ #endif






More information about the llvm-commits mailing list