LLVM API Documentation

llvm::Mangler Class Reference

#include <Mangler.h>

Collaboration diagram for llvm::Mangler:
[legend]

List of all members.

Public Types

enum  ManglerPrefixTy { Default, Private, LinkerPrivate }

Public Member Functions

 Mangler (Module &M, const char *Prefix="", const char *privatePrefix="", const char *linkerPrivatePrefix="")
void setUseQuotes (bool Val)
void markCharAcceptable (unsigned char X)
void markCharUnacceptable (unsigned char X)
bool isCharAcceptable (unsigned char X) const
std::string getMangledName (const GlobalValue *V, const char *Suffix="", bool ForcePrivate=false)
std::string makeNameProper (const std::string &x, ManglerPrefixTy PrefixTy=Mangler::Default)


Detailed Description

Definition at line 27 of file Mangler.h.


Member Enumeration Documentation

Enumerator:
Default  Emit default string before each symbol.
Private  Emit "private" prefix before each symbol.
LinkerPrivate  Emit "linker private" prefix before each symbol.

Definition at line 29 of file Mangler.h.


Constructor & Destructor Documentation

Mangler::Mangler ( Module &  M,
const char *  Prefix = "",
const char *  privatePrefix = "",
const char *  linkerPrivatePrefix = "" 
)

Definition at line 161 of file Mangler.cpp.

References llvm::array_endof(), markCharAcceptable(), and llvm::X.


Member Function Documentation

void llvm::Mangler::setUseQuotes ( bool  Val  )  [inline]

setUseQuotes - If UseQuotes is set to true, this target accepts quoted strings for assembler labels.

Definition at line 75 of file Mangler.h.

Referenced by llvm::AsmPrinter::doInitialization().

void llvm::Mangler::markCharAcceptable ( unsigned char  X  )  [inline]

Acceptable Characters - This allows the target to specify which characters are acceptable to the assembler without being mangled. By default we allow letters, numbers, '_', '$', and '.', which is what GAS accepts.

Definition at line 80 of file Mangler.h.

Referenced by Mangler().

void llvm::Mangler::markCharUnacceptable ( unsigned char  X  )  [inline]

Definition at line 83 of file Mangler.h.

Referenced by llvm::X86IntelAsmPrinter::doInitialization().

bool llvm::Mangler::isCharAcceptable ( unsigned char  X  )  const [inline]

Definition at line 86 of file Mangler.h.

Referenced by makeNameProper().

std::string Mangler::getMangledName ( const GlobalValue *  GV,
const char *  Suffix = "",
bool  ForcePrivate = false 
)

getMangledName - Returns the mangled name of V, an LLVM Value, in the current module. If 'Suffix' is specified, the name ends with the specified suffix. If 'ForcePrivate' is specified, the label is specified to have a private label prefix.

getMangledName - Returns the mangled name of V, an LLVM Value, in the current module. If 'Suffix' is specified, the name ends with the specified suffix. If 'ForcePrivate' is specified, the label is specified to have a private label prefix.

Definition at line 140 of file Mangler.cpp.

References Default, llvm::Value::getNameStr(), llvm::GlobalValue::hasLinkerPrivateLinkage(), llvm::Value::hasName(), llvm::GlobalValue::hasPrivateLinkage(), ID, LinkerPrivate, makeNameProper(), Private, and llvm::utostr().

Referenced by llvm::X86ATTAsmPrinter::doFinalization(), llvm::AsmPrinter::doFinalization(), llvm::X86IntelAsmPrinter::doInitialization(), llvm::AsmPrinter::EmitConstantValueOnly(), llvm::AsmPrinter::getCurrentFunctionEHName(), llvm::AsmPrinter::getGlobalLinkName(), llvm::MSILWriter::getLabelName(), llvm::MSILWriter::getLibraryName(), llvm::MSILWriter::getValueName(), llvm::X86ATTAsmPrinter::LowerGlobalAddressOperand(), llvm::X86IntelAsmPrinter::print_pcrel_imm(), llvm::MSILWriter::printExternals(), llvm::X86IntelAsmPrinter::PrintGlobalVariable(), llvm::X86ATTAsmPrinter::PrintGlobalVariable(), llvm::X86IntelAsmPrinter::printOp(), llvm::X86ATTAsmPrinter::printSymbolOperand(), llvm::X86ATTAsmPrinter::runOnMachineFunction(), llvm::AsmPrinter::SetupMachineFunction(), llvm::TargetLoweringObjectFileMachO::shouldEmitUsedDirectiveFor(), and llvm::MachOCodeEmitter::startFunction().

std::string Mangler::makeNameProper ( const std::string &  X,
ManglerPrefixTy  PrefixTy = Mangler::Default 
)

makeNameProper - We don't want identifier names with ., space, or

  • in them, so we mangle these characters into the strings "d_", "s_", and "D_", respectively. This is a very simple mangling that doesn't guarantee unique names for values. getValueName already does this for you, so there's no point calling it on the result from getValueName.

makeNameProper - We don't want identifier names non-C-identifier characters in them, so mangle them as appropriate.

Definition at line 34 of file Mangler.cpp.

References E, isCharAcceptable(), LinkerPrivate, MangleLetter(), and Private.

Referenced by getMangledName(), llvm::X86ATTAsmPrinter::LowerExternalSymbolOperand(), llvm::X86ATTAsmPrinter::printSymbolOperand(), llvm::TargetLoweringObjectFileCOFF::SelectSectionForGlobal(), and llvm::TargetLoweringObjectFileELF::SelectSectionForGlobal().


The documentation for this class was generated from the following files: