diff options
author | Dan Gohman <gohman@apple.com> | 2008-03-25 21:45:14 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-03-25 21:45:14 +0000 |
commit | cfbb2f074da2842e42956d3b4c21e91b37f36f06 (patch) | |
tree | 189c62a04edbe3e10e114d655bb008c898ed7e20 /lib | |
parent | 62c7b8c3713f7178991fac299abcb04e3818ca65 (diff) |
A quick nm audit turned up several fixed tables and objects that were
marked read-write. Use const so that they can be allocated in a
read-only segment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48800 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/MachineModuleInfo.cpp | 6 | ||||
-rw-r--r-- | lib/CodeGen/PseudoSourceValue.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | 8 | ||||
-rw-r--r-- | lib/Support/APInt.cpp | 2 | ||||
-rw-r--r-- | lib/Support/CommandLine.cpp | 2 | ||||
-rw-r--r-- | lib/Target/ARM/ARMTargetAsmInfo.cpp | 3 | ||||
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 2 | ||||
-rw-r--r-- | lib/Target/PowerPC/PPCAsmPrinter.cpp | 2 | ||||
-rw-r--r-- | lib/Target/X86/X86TargetAsmInfo.cpp | 3 |
9 files changed, 16 insertions, 14 deletions
diff --git a/lib/CodeGen/MachineModuleInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp index 6d285bde04..2446bff293 100644 --- a/lib/CodeGen/MachineModuleInfo.cpp +++ b/lib/CodeGen/MachineModuleInfo.cpp @@ -670,7 +670,7 @@ const char *CompileUnitDesc::getTypeString() const { /// getAnchorString - Return a string used to label this descriptor's anchor. /// -const char *CompileUnitDesc::AnchorString = "llvm.dbg.compile_units"; +const char *const CompileUnitDesc::AnchorString = "llvm.dbg.compile_units"; const char *CompileUnitDesc::getAnchorString() const { return AnchorString; } @@ -1120,7 +1120,7 @@ const char *GlobalVariableDesc::getTypeString() const { /// getAnchorString - Return a string used to label this descriptor's anchor. /// -const char *GlobalVariableDesc::AnchorString = "llvm.dbg.global_variables"; +const char *const GlobalVariableDesc::AnchorString = "llvm.dbg.global_variables"; const char *GlobalVariableDesc::getAnchorString() const { return AnchorString; } @@ -1174,7 +1174,7 @@ const char *SubprogramDesc::getTypeString() const { /// getAnchorString - Return a string used to label this descriptor's anchor. /// -const char *SubprogramDesc::AnchorString = "llvm.dbg.subprograms"; +const char *const SubprogramDesc::AnchorString = "llvm.dbg.subprograms"; const char *SubprogramDesc::getAnchorString() const { return AnchorString; } diff --git a/lib/CodeGen/PseudoSourceValue.cpp b/lib/CodeGen/PseudoSourceValue.cpp index 5c5b1d6df9..c62e49a4b0 100644 --- a/lib/CodeGen/PseudoSourceValue.cpp +++ b/lib/CodeGen/PseudoSourceValue.cpp @@ -29,7 +29,7 @@ namespace llvm { const PseudoSourceValue *PseudoSourceValue::getJumpTable() { return &(*PSVs)[4]; } - static const char *PSVNames[] = { + static const char *const PSVNames[] = { "FixedStack", "Stack", "GOT", diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp index 94d3a6dbfc..048ee2c2bc 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp @@ -221,8 +221,8 @@ void ScheduleDAG::ComputeLatency(SUnit *SU) { if (SU->Node->isTargetOpcode()) { unsigned SchedClass = TII->get(SU->Node->getTargetOpcode()).getSchedClass(); - InstrStage *S = InstrItins.begin(SchedClass); - InstrStage *E = InstrItins.end(SchedClass); + const InstrStage *S = InstrItins.begin(SchedClass); + const InstrStage *E = InstrItins.end(SchedClass); for (; S != E; ++S) SU->Latency += S->Cycles; } @@ -230,8 +230,8 @@ void ScheduleDAG::ComputeLatency(SUnit *SU) { SDNode *FNode = SU->FlaggedNodes[i]; if (FNode->isTargetOpcode()) { unsigned SchedClass =TII->get(FNode->getTargetOpcode()).getSchedClass(); - InstrStage *S = InstrItins.begin(SchedClass); - InstrStage *E = InstrItins.end(SchedClass); + const InstrStage *S = InstrItins.begin(SchedClass); + const InstrStage *E = InstrItins.end(SchedClass); for (; S != E; ++S) SU->Latency += S->Cycles; } diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index a853b92ae4..cd9508537c 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -1971,7 +1971,7 @@ void APInt::fromString(uint32_t numbits, const char *str, uint32_t slen, std::string APInt::toString(uint8_t radix, bool wantSigned) const { assert((radix == 10 || radix == 8 || radix == 16 || radix == 2) && "Radix should be 2, 8, 10, or 16!"); - static const char *digits[] = { + static const char *const digits[] = { "0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F" }; std::string result; diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index 486875210f..b3f32e89fb 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -267,7 +267,7 @@ static bool EatsUnboundedNumberOfValues(const Option *O) { static void ParseCStringVector(std::vector<char *> &output, const char *input) { // Characters which will be treated as token separators: - static const char *delims = " \v\f\t\r\n"; + static const char *const delims = " \v\f\t\r\n"; std::string work (input); // Skip past any delims at head of input string. diff --git a/lib/Target/ARM/ARMTargetAsmInfo.cpp b/lib/Target/ARM/ARMTargetAsmInfo.cpp index 3e7b69f9fb..65947fb188 100644 --- a/lib/Target/ARM/ARMTargetAsmInfo.cpp +++ b/lib/Target/ARM/ARMTargetAsmInfo.cpp @@ -17,7 +17,8 @@ #include <cctype> using namespace llvm; -static const char* arm_asm_table[] = {"{r0}", "r0", +static const char *const arm_asm_table[] = { + "{r0}", "r0", "{r1}", "r1", "{r2}", "r2", "{r3}", "r3", diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index eb7d58517b..24ac8f9e5c 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -2825,7 +2825,7 @@ std::string CWriter::InterpretASMConstraint(InlineAsm::ConstraintInfo& c) { assert(c.Codes.size() == 1 && "Too many asm constraint codes to handle"); - const char** table = 0; + const char *const *table = 0; //Grab the translation table from TargetAsmInfo if it exists if (!TAsm) { diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp index 20b0d2adf4..0711313139 100644 --- a/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -860,7 +860,7 @@ bool DarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) { bool DarwinAsmPrinter::doInitialization(Module &M) { - static const char *CPUDirectives[] = { + static const char *const CPUDirectives[] = { "", "ppc", "ppc601", diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp index 43948ec8ef..390c5a6ff3 100644 --- a/lib/Target/X86/X86TargetAsmInfo.cpp +++ b/lib/Target/X86/X86TargetAsmInfo.cpp @@ -25,7 +25,8 @@ using namespace llvm; using namespace llvm::dwarf; -static const char* x86_asm_table[] = {"{si}", "S", +static const char *const x86_asm_table[] = { + "{si}", "S", "{di}", "D", "{ax}", "a", "{cx}", "c", |