mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Add section switching to common code generator code. Add a couple of
asserts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24445 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -19,8 +19,27 @@
|
|||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
using namespace llvm;
|
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) {
|
bool AsmPrinter::doInitialization(Module &M) {
|
||||||
Mang = new Mangler(M, GlobalPrefix);
|
Mang = new Mangler(M, GlobalPrefix);
|
||||||
|
SwitchSection("", 0); // Reset back to no section.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,10 +278,11 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
MachineOperand &MO = MI->getOperand(i);
|
MachineOperand &MO = MI->getOperand(i);
|
||||||
if (!MO.getVRegValueOrNull()) {
|
if (!MO.getVRegValueOrNull()) {
|
||||||
VarInfo &VRInfo = getVarInfo(MO.getReg());
|
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);
|
MarkVirtRegAliveInBlock(VRInfo, MBB);
|
||||||
break; // Found the PHI entry for this block...
|
break; // Found the PHI entry for this block.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -547,6 +547,7 @@ void RA::assignRegOrStackSlotAtInterval(LiveInterval* cur)
|
|||||||
minReg = reg;
|
minReg = reg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assert(minReg && "Didn't find any reg!");
|
||||||
DEBUG(std::cerr << "\t\tregister with min weight: "
|
DEBUG(std::cerr << "\t\tregister with min weight: "
|
||||||
<< mri_->getName(minReg) << " (" << minWeight << ")\n");
|
<< mri_->getName(minReg) << " (" << minWeight << ")\n");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user