2005-12-16 22:45:29 +00:00
|
|
|
//===-- llvm/CodeGen/MachineDebugInfo.h -------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by James M. Laskey and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Collect debug information for a module. This information should be in a
|
|
|
|
// neutral form that can be used by different debugging schemes.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CODEGEN_MACHINEDEBUGINFO_H
|
|
|
|
#define LLVM_CODEGEN_MACHINEDEBUGINFO_H
|
|
|
|
|
2006-01-04 13:46:37 +00:00
|
|
|
#include "llvm/Pass.h"
|
2005-12-16 22:45:29 +00:00
|
|
|
#include <string>
|
|
|
|
#include <map>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
/// MachineDebugInfo - This class contains debug information specific to a
|
|
|
|
/// module. Queries can be made by different debugging schemes and reformated
|
|
|
|
/// for specific use.
|
|
|
|
///
|
2006-01-04 13:46:37 +00:00
|
|
|
class MachineDebugInfo : public ImmutablePass {
|
2005-12-16 22:45:29 +00:00
|
|
|
private:
|
2006-01-04 22:28:25 +00:00
|
|
|
std::map<std::string, unsigned> SourceMap; // Map of source file path to id
|
2005-12-16 22:45:29 +00:00
|
|
|
unsigned SourceCount; // Number of source files (used to
|
|
|
|
// generate id)
|
2006-01-04 13:46:37 +00:00
|
|
|
unsigned UniqueID; // Number used to unique labels used
|
|
|
|
// by debugger.
|
2005-12-16 22:45:29 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
// Ctor.
|
2006-01-04 13:46:37 +00:00
|
|
|
MachineDebugInfo()
|
|
|
|
: SourceMap()
|
|
|
|
, SourceCount(0)
|
|
|
|
, UniqueID(1)
|
|
|
|
{}
|
|
|
|
~MachineDebugInfo() { }
|
2005-12-16 22:45:29 +00:00
|
|
|
|
2006-01-04 14:29:26 +00:00
|
|
|
/// hasInfo - Returns true if debug info is present.
|
|
|
|
///
|
|
|
|
// FIXME - need scheme to suppress debug output.
|
2006-01-04 22:28:25 +00:00
|
|
|
bool hasInfo() const { return SourceCount != 0; }
|
2006-01-04 14:29:26 +00:00
|
|
|
|
2006-01-04 22:28:25 +00:00
|
|
|
/// getNextUniqueID - Returns a unique number for labels used by debugger.
|
2005-12-16 22:45:29 +00:00
|
|
|
///
|
2006-01-04 22:28:25 +00:00
|
|
|
unsigned getNextUniqueID() { return UniqueID++; }
|
2006-01-04 13:46:37 +00:00
|
|
|
|
|
|
|
bool doInitialization();
|
|
|
|
bool doFinalization();
|
2006-01-04 22:28:25 +00:00
|
|
|
|
|
|
|
/// getUniqueSourceID - Register a source file with debug info. Returns an id.
|
|
|
|
///
|
|
|
|
unsigned getUniqueSourceID(const std::string &fname,
|
|
|
|
const std::string &dirname);
|
|
|
|
|
|
|
|
/// getSourceFiles - Return a vector of files. Vector index + 1 equals id.
|
|
|
|
///
|
|
|
|
std::vector<std::string> getSourceFiles() const;
|
2005-12-16 22:45:29 +00:00
|
|
|
|
|
|
|
}; // End class MachineDebugInfo
|
|
|
|
|
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|