[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp LiveVariables.cpp RegAllocLinearScan.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Nov 20 23:06:39 PST 2005
Changes in directory llvm/lib/CodeGen:
AsmPrinter.cpp updated: 1.25 -> 1.26
LiveVariables.cpp updated: 1.52 -> 1.53
RegAllocLinearScan.cpp updated: 1.114 -> 1.115
---
Log message:
Add section switching to common code generator code. Add a couple of
asserts.
---
Diffs of the changes: (+23 -2)
AsmPrinter.cpp | 19 +++++++++++++++++++
LiveVariables.cpp | 5 +++--
RegAllocLinearScan.cpp | 1 +
3 files changed, 23 insertions(+), 2 deletions(-)
Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.25 llvm/lib/CodeGen/AsmPrinter.cpp:1.26
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.25 Mon Nov 14 18:03:16 2005
+++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Nov 21 01:06:27 2005
@@ -19,8 +19,27 @@
#include "llvm/Target/TargetMachine.h"
using namespace llvm;
+/// SwitchSection - Switch to the specified section of the executable if we
+/// are not already in it!
+///
+void AsmPrinter::SwitchSection(const char *NewSection, const GlobalValue *GV) {
+ std::string NS;
+
+ if (GV && GV->hasSection())
+ NS = ".section " + GV->getSection();
+ else
+ NS = NewSection;
+
+ if (CurrentSection != NS) {
+ CurrentSection = NS;
+ if (!CurrentSection.empty())
+ O << "\t" << CurrentSection << "\n";
+ }
+}
+
bool AsmPrinter::doInitialization(Module &M) {
Mang = new Mangler(M, GlobalPrefix);
+ SwitchSection("", 0); // Reset back to no section.
return false;
}
Index: llvm/lib/CodeGen/LiveVariables.cpp
diff -u llvm/lib/CodeGen/LiveVariables.cpp:1.52 llvm/lib/CodeGen/LiveVariables.cpp:1.53
--- llvm/lib/CodeGen/LiveVariables.cpp:1.52 Tue Aug 23 19:09:33 2005
+++ llvm/lib/CodeGen/LiveVariables.cpp Mon Nov 21 01:06:27 2005
@@ -278,10 +278,11 @@
MachineOperand &MO = MI->getOperand(i);
if (!MO.getVRegValueOrNull()) {
VarInfo &VRInfo = getVarInfo(MO.getReg());
+ assert(VRInfo.DefInst && "Register use before def (or no def)!");
- // Only mark it alive only in the block we are representing...
+ // Only mark it alive only in the block we are representing.
MarkVirtRegAliveInBlock(VRInfo, MBB);
- break; // Found the PHI entry for this block...
+ break; // Found the PHI entry for this block.
}
}
}
Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp
diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.114 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.115
--- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.114 Tue Sep 20 23:19:09 2005
+++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Mon Nov 21 01:06:27 2005
@@ -547,6 +547,7 @@
minReg = reg;
}
}
+ assert(minReg && "Didn't find any reg!");
DEBUG(std::cerr << "\t\tregister with min weight: "
<< mri_->getName(minReg) << " (" << minWeight << ")\n");
More information about the llvm-commits
mailing list