diff options
author | Chris Lattner <sabre@nondot.org> | 2005-11-21 08:12:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-11-21 08:12:47 +0000 |
commit | 462263274fae626968ec94c49e48fb60e7f8faa9 (patch) | |
tree | 28884e59ffce1e8565b12f1d1cc145f0f7154d82 | |
parent | dd3bf8e4a2952082c5cd26d5e99f43a6e8d0fddc (diff) | |
download | bcm5719-llvm-462263274fae626968ec94c49e48fb60e7f8faa9.tar.gz bcm5719-llvm-462263274fae626968ec94c49e48fb60e7f8faa9.zip |
Make the AsmPrinter keep track of the notion of a function number.
llvm-svn: 24460
-rw-r--r-- | llvm/include/llvm/CodeGen/AsmPrinter.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h b/llvm/include/llvm/CodeGen/AsmPrinter.h index c63669ffb44..6a8333857cd 100644 --- a/llvm/include/llvm/CodeGen/AsmPrinter.h +++ b/llvm/include/llvm/CodeGen/AsmPrinter.h @@ -27,6 +27,14 @@ namespace llvm { /// CurrentSection - The current section we are emitting to. This is /// controlled and used by the SwitchSection method. std::string CurrentSection; + + /// FunctionNumber - This provides a unique ID for each function emitted in + /// this translation unit. It is autoincremented by SetupMachineFunction, + /// and can be accessed with getFunctionNumber() and + /// IncrementFunctionNumber(). + /// + unsigned FunctionNumber; + protected: /// Output stream on which we're printing assembly code. /// @@ -112,7 +120,7 @@ namespace llvm { bool AlignmentIsInBytes; // Defaults to true AsmPrinter(std::ostream &o, TargetMachine &tm) - : O(o), TM(tm), + : FunctionNumber(0), O(o), TM(tm), CommentString("#"), GlobalPrefix(""), PrivateGlobalPrefix("."), @@ -140,7 +148,16 @@ namespace llvm { /// current section is, but does not emit a .section directive. /// void SwitchSection(const char *NewSection, const GlobalValue *GV); - + + /// getFunctionNumber - Return a unique ID for the current function. + /// + unsigned getFunctionNumber() const { return FunctionNumber; } + + /// IncrementFunctionNumber - Increase Function Number. AsmPrinters should + /// not normally call this, as the counter is automatically bumped by + /// SetupMachineFunction. + void IncrementFunctionNumber() { FunctionNumber++; } + /// 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. |