From f3e3783012dc7875ed37be8aaaefd96f98454781 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Tue, 21 Feb 2012 06:54:41 +0000 Subject: [PATCH] In generated RegisterInfo files, replace a pointer to the end of an array with just the size of the array to avoid relocations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151041 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCRegisterInfo.h | 7 ++++--- utils/TableGen/RegisterInfoEmitter.cpp | 6 ++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/llvm/MC/MCRegisterInfo.h b/include/llvm/MC/MCRegisterInfo.h index 2bf754ed9a9..c4c6ccf9b23 100644 --- a/include/llvm/MC/MCRegisterInfo.h +++ b/include/llvm/MC/MCRegisterInfo.h @@ -33,7 +33,8 @@ public: const unsigned RegSize, Alignment; // Size & Alignment of register in bytes const int CopyCost; const bool Allocatable; - const iterator RegsBegin, RegsEnd; + const iterator RegsBegin; + unsigned RegsSize; const unsigned char *const RegSet; const unsigned RegSetSize; @@ -48,11 +49,11 @@ public: /// begin/end - Return all of the registers in this class. /// iterator begin() const { return RegsBegin; } - iterator end() const { return RegsEnd; } + iterator end() const { return RegsBegin + RegsSize; } /// getNumRegs - Return the number of registers in this class. /// - unsigned getNumRegs() const { return (unsigned)(RegsEnd-RegsBegin); } + unsigned getNumRegs() const { return RegsSize; } /// getRegister - Return the specified register in the class. /// diff --git a/utils/TableGen/RegisterInfoEmitter.cpp b/utils/TableGen/RegisterInfoEmitter.cpp index c98a76cde3d..7e41a110e73 100644 --- a/utils/TableGen/RegisterInfoEmitter.cpp +++ b/utils/TableGen/RegisterInfoEmitter.cpp @@ -391,10 +391,8 @@ RegisterInfoEmitter::runMCDesc(raw_ostream &OS, CodeGenTarget &Target, << RC.SpillAlignment/8 << ", " << RC.CopyCost << ", " << RC.Allocatable << ", " - << RC.getName() << ", " << RC.getName() << " + " - << RC.getOrder().size() << ", " - << RC.getName() << "Bits, sizeof(" << RC.getName() << "Bits)" - << " },\n"; + << RC.getName() << ", " << RC.getOrder().size() << ", " + << RC.getName() << "Bits, sizeof(" << RC.getName() << "Bits) },\n"; } OS << "};\n\n";