diff options
author | Chris Lattner <sabre@nondot.org> | 2004-08-16 23:15:22 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-08-16 23:15:22 +0000 |
commit | a80ba71efe5be5012128e2db0dd29b024e00105a (patch) | |
tree | a9786910dc25d5cbfd224810d04c592a98e3f0f2 /include/llvm/CodeGen | |
parent | 8b41cba86568a3ee4e6356ca07cf701595cd49b4 (diff) | |
download | external_llvm-a80ba71efe5be5012128e2db0dd29b024e00105a.zip external_llvm-a80ba71efe5be5012128e2db0dd29b024e00105a.tar.gz external_llvm-a80ba71efe5be5012128e2db0dd29b024e00105a.tar.bz2 |
Initial implementation of the asmprinter base class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15838 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r-- | include/llvm/CodeGen/AsmPrinter.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h new file mode 100644 index 0000000..932343d --- /dev/null +++ b/include/llvm/CodeGen/AsmPrinter.h @@ -0,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 |