[llvm-commits] CVS: llvm/lib/Reoptimizer/Inst/PhaseInfo.h ElfReader.cpp ElfReader.h Makefile Phases.cpp
Joel Stanley
jstanley at cs.uiuc.edu
Wed Apr 30 16:22:05 PDT 2003
Changes in directory llvm/lib/Reoptimizer/Inst:
PhaseInfo.h added (r1.1)
ElfReader.cpp updated: 1.6 -> 1.7
ElfReader.h updated: 1.5 -> 1.6
Makefile updated: 1.1 -> 1.2
Phases.cpp updated: 1.19 -> 1.20
---
Log message:
---
Diffs of the changes:
Index: llvm/lib/Reoptimizer/Inst/PhaseInfo.h
diff -c /dev/null llvm/lib/Reoptimizer/Inst/PhaseInfo.h:1.1
*** /dev/null Wed Apr 30 16:28:17 2003
--- llvm/lib/Reoptimizer/Inst/PhaseInfo.h Wed Apr 30 16:28:07 2003
***************
*** 0 ****
--- 1,102 ----
+ ////////////////
+ // programmer: Joel Stanley
+ // date: Tue Apr 29 23:02:12 CDT 2003
+ // fileid: PhaseInfo.h
+ // purpose: Describes the classes that are used to carry information between
+ // phases.
+
+ #ifndef _INCLUDED_PHASEINFO_H
+ #define _INCLUDED_PHASEINFO_H
+
+ #include "InstManip.h"
+
+ class TraceCache;
+ class InstManip;
+
+ typedef std::pair<uint64_t, uint64_t> AddressRange;
+
+ class Phase3Info
+ {
+ public:
+ Phase3Info(const AddressRange& addressRange,
+ unsigned origInst,
+ uint64_t replaceAddr,
+ uint64_t slotDescriptor,
+ unsigned slotSize,
+ TraceCache* pTC,
+ InstManip* pIM):
+ m_addrRange(addressRange),
+ m_origInst(origInst),
+ m_replaceAddr(replaceAddr),
+ m_slotDescriptor(slotDescriptor),
+ m_slotSize(slotSize),
+ m_pTC(pTC),
+ m_pIM(pIM)
+ {
+ }
+
+ void print(std::ostream& ostr)
+ {
+ ostr << std::hex << "Phase3Info instance: {" << std::endl
+ << " Function address range: [" << m_addrRange.first << ", "
+ << m_addrRange.second << "]" << std::endl
+ << " To replace: [" << m_origInst << " @ "
+ << m_replaceAddr << "]" << std::endl
+ << "}" << std::endl;
+ }
+
+ uint64_t getStartAddr() const { return m_addrRange.first; }
+ uint64_t getEndAddr() const { return m_addrRange.second; }
+ uint64_t getOrigInst() const { return m_origInst; }
+ uint64_t getReplaceAddr() const { return m_replaceAddr; }
+ uint64_t getSlot() const { return m_slotDescriptor; }
+ uint64_t getSlotSize() const { return m_slotSize; }
+ TraceCache* getTraceCache() { return m_pTC; }
+ InstManip* getIM() { return m_pIM; }
+
+ private:
+ Phase3Info() {}
+
+ AddressRange m_addrRange; // Range of function for phase 3 to examine
+ unsigned m_origInst; // Instruction replaced by phase 2
+ uint64_t m_replaceAddr; // Address at which to restore original inst
+ uint64_t m_slotDescriptor; // Slot created by phase 2
+ unsigned m_slotSize; // Size of slot created by phase 2
+ TraceCache* m_pTC; // TraceCache instance used by phase 2
+ InstManip* m_pIM; // The InstManip instance to pass to the next phase
+ };
+
+ class Phase4Info
+ {
+ public:
+ Phase4Info(const InstCandidate& candidate,
+ uint64_t slotDescriptor,
+ uint64_t slotSize,
+ TraceCache* pTC,
+ InstManip* pIM):
+ m_candidate(candidate),
+ m_slotDescriptor(slotDescriptor),
+ m_slotSize(slotSize),
+ m_pTC(pTC),
+ m_pIM(pIM)
+ {
+ }
+
+ const InstCandidate& getCandidate() const { return m_candidate; }
+ uint64_t getSlot() const { return m_slotDescriptor; }
+ uint64_t getSlotSize() const { return m_slotSize; }
+ TraceCache* getTraceCache() { return m_pTC; }
+ InstManip* getIM() { return m_pIM; }
+
+ private:
+ Phase4Info() {}
+
+ InstCandidate m_candidate; // Candidate responsible for this instance's creation
+ uint64_t m_slotDescriptor; // Slot created by phase 3
+ unsigned m_slotSize; // Size of slot created by phase 3
+ TraceCache* m_pTC; // TraceCache instance used by phases 2 and 3
+ InstManip* m_pIM; // The InstManip instance to pass to the next phase
+ };
+
+
+ #endif // _INCLUDED_PHASEINFO_H
Index: llvm/lib/Reoptimizer/Inst/ElfReader.cpp
diff -u llvm/lib/Reoptimizer/Inst/ElfReader.cpp:1.6 llvm/lib/Reoptimizer/Inst/ElfReader.cpp:1.7
--- llvm/lib/Reoptimizer/Inst/ElfReader.cpp:1.6 Wed Apr 30 14:21:06 2003
+++ llvm/lib/Reoptimizer/Inst/ElfReader.cpp Wed Apr 30 16:28:07 2003
@@ -24,7 +24,6 @@
#include <iostream>
#include "ElfReader.h"
-#include "InstManip.h"
using std::cerr;
using std::endl;
@@ -70,7 +69,7 @@
bool ElfReader::GetNextFunction(std::string& fname,
std::pair<uint64_t, uint64_t>& range,
- InstManip* im)
+ unsigned instWidth)
{
// Locate next function (skipping non-function entries) in the symbol table if
// possible. If found, return true, yielding name & extents by reference. Return
@@ -94,7 +93,7 @@
if(sym.st_shndx == m_codeSectionIdx) {
fname = m_strTab + sym.st_name;
range.first = sym.st_value;
- range.second = sym.st_value + sym.st_size - im->getInstWidth();
+ range.second = sym.st_value + sym.st_size - instWidth;
return true;
}
}
Index: llvm/lib/Reoptimizer/Inst/ElfReader.h
diff -u llvm/lib/Reoptimizer/Inst/ElfReader.h:1.5 llvm/lib/Reoptimizer/Inst/ElfReader.h:1.6
--- llvm/lib/Reoptimizer/Inst/ElfReader.h:1.5 Wed Apr 30 14:21:06 2003
+++ llvm/lib/Reoptimizer/Inst/ElfReader.h Wed Apr 30 16:28:07 2003
@@ -10,8 +10,6 @@
#include <libelf.h>
-class InstManip;
-
class ElfReader
{
public:
@@ -20,7 +18,7 @@
bool GetNextFunction(std::string& string,
std::pair<uint64_t, uint64_t>& range,
- InstManip* im);
+ unsigned instWidth);
private:
ElfReader() {}
Index: llvm/lib/Reoptimizer/Inst/Makefile
diff -u llvm/lib/Reoptimizer/Inst/Makefile:1.1 llvm/lib/Reoptimizer/Inst/Makefile:1.2
--- llvm/lib/Reoptimizer/Inst/Makefile:1.1 Wed Mar 5 15:23:56 2003
+++ llvm/lib/Reoptimizer/Inst/Makefile Wed Apr 30 16:28:07 2003
@@ -1,4 +1,6 @@
LEVEL = ../../..
-
+PARALLEL_DIRS := mkexcl
LIBRARYNAME = perfinst
+BUILD_ARCHIVE = 1
+
include $(LEVEL)/Makefile.common
Index: llvm/lib/Reoptimizer/Inst/Phases.cpp
diff -u llvm/lib/Reoptimizer/Inst/Phases.cpp:1.19 llvm/lib/Reoptimizer/Inst/Phases.cpp:1.20
--- llvm/lib/Reoptimizer/Inst/Phases.cpp:1.19 Wed Apr 30 14:21:06 2003
+++ llvm/lib/Reoptimizer/Inst/Phases.cpp Wed Apr 30 16:28:07 2003
@@ -176,7 +176,7 @@
// functions here -- this could be quite large.
vector<std::pair<std::string, AddressRange> > funcs;
- while(elfReader.GetNextFunction(funcName, range, m_pIM))
+ while(elfReader.GetNextFunction(funcName, range, m_pIM->getInstWidth()))
funcs.push_back(std::make_pair(funcName, range));
cerr << "There are " << funcs.size() << " functions to process." << endl << endl;
More information about the llvm-commits
mailing list