forked from OSchip/llvm-project
Make the AsmPrinter keep track of the notion of a function number.
llvm-svn: 24460
This commit is contained in:
parent
dd3bf8e4a2
commit
462263274f
|
@ -27,6 +27,14 @@ namespace llvm {
|
||||||
/// CurrentSection - The current section we are emitting to. This is
|
/// CurrentSection - The current section we are emitting to. This is
|
||||||
/// controlled and used by the SwitchSection method.
|
/// controlled and used by the SwitchSection method.
|
||||||
std::string CurrentSection;
|
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:
|
protected:
|
||||||
/// Output stream on which we're printing assembly code.
|
/// Output stream on which we're printing assembly code.
|
||||||
///
|
///
|
||||||
|
@ -112,7 +120,7 @@ namespace llvm {
|
||||||
bool AlignmentIsInBytes; // Defaults to true
|
bool AlignmentIsInBytes; // Defaults to true
|
||||||
|
|
||||||
AsmPrinter(std::ostream &o, TargetMachine &tm)
|
AsmPrinter(std::ostream &o, TargetMachine &tm)
|
||||||
: O(o), TM(tm),
|
: FunctionNumber(0), O(o), TM(tm),
|
||||||
CommentString("#"),
|
CommentString("#"),
|
||||||
GlobalPrefix(""),
|
GlobalPrefix(""),
|
||||||
PrivateGlobalPrefix("."),
|
PrivateGlobalPrefix("."),
|
||||||
|
@ -141,6 +149,15 @@ namespace llvm {
|
||||||
///
|
///
|
||||||
void SwitchSection(const char *NewSection, const GlobalValue *GV);
|
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
|
/// doInitialization - Set up the AsmPrinter when we are working on a new
|
||||||
/// module. If your pass overrides this, it must make sure to explicitly
|
/// module. If your pass overrides this, it must make sure to explicitly
|
||||||
/// call this implementation.
|
/// call this implementation.
|
||||||
|
|
Loading…
Reference in New Issue