From 8e0f67dcec577760e3bdc36f0377c6f43e1894d8 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 3 Jan 2014 19:21:54 +0000 Subject: Make the llvm mangler depend only on DataLayout. Before this patch any program that wanted to know the final symbol name of a GlobalValue had to link with Target. This patch implements a compromise solution where the mangler uses DataLayout. This way, any tool that already links with Target (llc, clang) gets the exact behavior as before and new IR files can be mangled without linking with Target. With this patch the mangler is constructed with just a DataLayout and DataLayout is extended to include the information the Mangler needs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198438 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Target/Mangler.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/llvm/Target/Mangler.h') diff --git a/include/llvm/Target/Mangler.h b/include/llvm/Target/Mangler.h index 3a8f32646f..78ce264b5e 100644 --- a/include/llvm/Target/Mangler.h +++ b/include/llvm/Target/Mangler.h @@ -18,10 +18,10 @@ namespace llvm { +class DataLayout; class GlobalValue; class MCContext; template class SmallVectorImpl; -class TargetMachine; class Twine; class Mangler { @@ -33,7 +33,7 @@ public: }; private: - const TargetMachine *TM; + const DataLayout *DL; /// AnonGlobalIDs - We need to give global values the same name every time /// they are mangled. This keeps track of the number we give to anonymous @@ -46,7 +46,7 @@ private: unsigned NextAnonGlobalID; public: - Mangler(const TargetMachine *TM) : TM(TM), NextAnonGlobalID(1) {} + Mangler(const DataLayout *DL) : DL(DL), NextAnonGlobalID(1) {} /// getNameWithPrefix - Fill OutName with the name of the appropriate prefix /// and the specified global variable's name. If the global variable doesn't -- cgit v1.2.3