[llvm] r195926 - The global prefix is always one char. Don't use a string for it.
Rafael Espindola
rafael.espindola at gmail.com
Thu Nov 28 09:00:50 PST 2013
Author: rafael
Date: Thu Nov 28 11:00:49 2013
New Revision: 195926
URL: http://llvm.org/viewvc/llvm-project?rev=195926&view=rev
Log:
The global prefix is always one char. Don't use a string for it.
Modified:
llvm/trunk/include/llvm/MC/MCAsmInfo.h
llvm/trunk/lib/MC/MCAsmInfo.cpp
llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp
llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp
llvm/trunk/lib/Target/Mangler.cpp
llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfo.h?rev=195926&r1=195925&r2=195926&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Thu Nov 28 11:00:49 2013
@@ -115,9 +115,9 @@ namespace llvm {
/// LabelSuffix - This is appended to emitted labels.
const char *DebugLabelSuffix; // Defaults to ":"
- /// GlobalPrefix - If this is set to a non-empty string, it is prepended
- /// onto all global symbols. This is often used for "_" or ".".
- const char *GlobalPrefix; // Defaults to ""
+ /// If this is set to anything other than '\0', it is prepended
+ /// onto all global symbols. This is often used for '_'.
+ char GlobalPrefix; // Defaults to '\0'
/// PrivateGlobalPrefix - This prefix is used for globals like constant
/// pool entries that are completely private to the .s file and should not
@@ -428,7 +428,7 @@ namespace llvm {
return DebugLabelSuffix;
}
- const char *getGlobalPrefix() const {
+ char getGlobalPrefix() const {
return GlobalPrefix;
}
const char *getPrivateGlobalPrefix() const {
Modified: llvm/trunk/lib/MC/MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfo.cpp?rev=195926&r1=195925&r2=195926&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfo.cpp Thu Nov 28 11:00:49 2013
@@ -41,7 +41,7 @@ MCAsmInfo::MCAsmInfo() {
CommentString = "#";
LabelSuffix = ":";
DebugLabelSuffix = ":";
- GlobalPrefix = "";
+ GlobalPrefix = '\0';
PrivateGlobalPrefix = ".";
LinkerPrivateGlobalPrefix = "";
InlineAsmStart = "APP";
Modified: llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp?rev=195926&r1=195925&r2=195926&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp Thu Nov 28 11:00:49 2013
@@ -18,7 +18,7 @@ using namespace llvm;
void MCAsmInfoCOFF::anchor() { }
MCAsmInfoCOFF::MCAsmInfoCOFF() {
- GlobalPrefix = "_";
+ GlobalPrefix = '_';
// MingW 4.5 and later support .comm with log2 alignment, but .lcomm uses byte
// alignment.
COMMDirectiveAlignmentIsInBytes = false;
Modified: llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp?rev=195926&r1=195925&r2=195926&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp Thu Nov 28 11:00:49 2013
@@ -23,7 +23,7 @@ void MCAsmInfoDarwin::anchor() { }
MCAsmInfoDarwin::MCAsmInfoDarwin() {
// Common settings for all Darwin targets.
// Syntax:
- GlobalPrefix = "_";
+ GlobalPrefix = '_';
PrivateGlobalPrefix = "L";
LinkerPrivateGlobalPrefix = "l";
HasSingleParameterDotFile = false;
Modified: llvm/trunk/lib/Target/Mangler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mangler.cpp?rev=195926&r1=195925&r2=195926&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mangler.cpp (original)
+++ llvm/trunk/lib/Target/Mangler.cpp Thu Nov 28 11:00:49 2013
@@ -47,14 +47,9 @@ void Mangler::getNameWithPrefix(SmallVec
}
- const char *Prefix = MAI->getGlobalPrefix();
- if (Prefix[0] == 0)
- ; // Common noop, no prefix.
- else if (Prefix[1] == 0)
- OutName.push_back(Prefix[0]); // Common, one character prefix.
- else
- // Arbitrary length prefix.
- OutName.append(Prefix, Prefix+strlen(Prefix));
+ char Prefix = MAI->getGlobalPrefix();
+ if (Prefix != '\0')
+ OutName.push_back(Prefix);
}
// If this is a simple string that doesn't need escaping, just append it.
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp?rev=195926&r1=195925&r2=195926&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp Thu Nov 28 11:00:49 2013
@@ -128,7 +128,7 @@ void X86MCAsmInfoMicrosoft::anchor() { }
X86MCAsmInfoMicrosoft::X86MCAsmInfoMicrosoft(const Triple &Triple) {
if (Triple.getArch() == Triple::x86_64) {
- GlobalPrefix = "";
+ GlobalPrefix = '\0';
PrivateGlobalPrefix = ".L";
}
@@ -143,7 +143,7 @@ void X86MCAsmInfoGNUCOFF::anchor() { }
X86MCAsmInfoGNUCOFF::X86MCAsmInfoGNUCOFF(const Triple &Triple) {
if (Triple.getArch() == Triple::x86_64) {
- GlobalPrefix = "";
+ GlobalPrefix = '\0';
PrivateGlobalPrefix = ".L";
}
More information about the llvm-commits
mailing list