2014-01-07 22:19:40 +01:00
|
|
|
//===-- llvm/IR/Mangler.h - Self-contained name mangler ---------*- C++ -*-===//
|
2005-04-21 22:48:15 +02:00
|
|
|
//
|
2003-10-20 22:19:47 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:59:42 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 22:48:15 +02:00
|
|
|
//
|
2003-10-20 22:19:47 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
2003-07-24 22:20:58 +02:00
|
|
|
//
|
2004-02-14 01:30:31 +01:00
|
|
|
// Unified name mangler for various backends.
|
2003-07-24 22:20:58 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-13 18:26:38 +02:00
|
|
|
#ifndef LLVM_IR_MANGLER_H
|
|
|
|
#define LLVM_IR_MANGLER_H
|
2003-07-24 22:20:58 +02:00
|
|
|
|
2008-06-26 19:20:16 +02:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2015-12-30 04:56:17 +01:00
|
|
|
#include "llvm/IR/GlobalValue.h"
|
2003-07-24 22:20:58 +02:00
|
|
|
|
2003-11-11 23:41:34 +01:00
|
|
|
namespace llvm {
|
2013-05-29 22:37:19 +02:00
|
|
|
|
2014-01-03 20:21:54 +01:00
|
|
|
class DataLayout;
|
2013-05-29 22:37:19 +02:00
|
|
|
template <typename T> class SmallVectorImpl;
|
|
|
|
class Twine;
|
2016-04-16 09:51:28 +02:00
|
|
|
class raw_ostream;
|
2003-11-11 23:41:34 +01:00
|
|
|
|
2003-07-24 22:20:58 +02:00
|
|
|
class Mangler {
|
2015-06-23 14:29:52 +02:00
|
|
|
/// We need to give global values the same name every time they are mangled.
|
|
|
|
/// This keeps track of the number we give to anonymous ones.
|
2014-02-10 22:25:13 +01:00
|
|
|
mutable DenseMap<const GlobalValue*, unsigned> AnonGlobalIDs;
|
2003-08-11 21:34:29 +02:00
|
|
|
|
2009-07-20 03:03:30 +02:00
|
|
|
public:
|
2014-01-29 03:30:38 +01:00
|
|
|
/// Print the appropriate prefix and the specified global variable's name.
|
|
|
|
/// If the global variable doesn't have a name, this fills in a unique name
|
|
|
|
/// for the global.
|
2014-02-19 18:23:20 +01:00
|
|
|
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
|
2015-03-17 21:40:21 +01:00
|
|
|
bool CannotUsePrivateLabel) const;
|
2014-02-19 18:23:20 +01:00
|
|
|
void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
|
2015-03-17 21:40:21 +01:00
|
|
|
bool CannotUsePrivateLabel) const;
|
2012-10-09 03:56:07 +02:00
|
|
|
|
2014-01-29 03:30:38 +01:00
|
|
|
/// Print the appropriate prefix and the specified name as the global variable
|
|
|
|
/// name. GVName must not be empty.
|
2015-06-23 15:59:29 +02:00
|
|
|
static void getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
|
2015-06-23 16:11:09 +02:00
|
|
|
const DataLayout &DL);
|
2015-06-23 15:59:29 +02:00
|
|
|
static void getNameWithPrefix(SmallVectorImpl<char> &OutName,
|
2015-06-23 16:11:09 +02:00
|
|
|
const Twine &GVName, const DataLayout &DL);
|
2003-07-24 22:20:58 +02:00
|
|
|
};
|
|
|
|
|
2015-06-23 11:49:53 +02:00
|
|
|
} // End llvm namespace
|
2003-11-11 23:41:34 +01:00
|
|
|
|
2014-08-13 18:26:38 +02:00
|
|
|
#endif
|