mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-16 14:31:59 +00:00
Eliminate special case handling for CPR's
Fix some problem cases where I was building the slot calculator in bytecode writer mode instead of asmwriter mode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10911 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
655c8d6f6a
commit
2ff95b6b4e
@ -368,18 +368,7 @@ static void WriteConstantInt(std::ostream &Out, const Constant *CV,
|
|||||||
Out << "null";
|
Out << "null";
|
||||||
|
|
||||||
} else if (const ConstantPointerRef *PR = dyn_cast<ConstantPointerRef>(CV)) {
|
} else if (const ConstantPointerRef *PR = dyn_cast<ConstantPointerRef>(CV)) {
|
||||||
const GlobalValue *V = PR->getValue();
|
WriteAsOperandInternal(Out, PR->getValue(), true, TypeTable, Table);
|
||||||
if (V->hasName()) {
|
|
||||||
Out << getLLVMName(V->getName());
|
|
||||||
} else if (Table) {
|
|
||||||
int Slot = Table->getSlot(V);
|
|
||||||
if (Slot >= 0)
|
|
||||||
Out << "%" << Slot;
|
|
||||||
else
|
|
||||||
Out << "<pointer reference badref>";
|
|
||||||
} else {
|
|
||||||
Out << "<pointer reference without context info>";
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
|
} else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
|
||||||
Out << CE->getOpcodeName() << " (";
|
Out << CE->getOpcodeName() << " (";
|
||||||
@ -969,26 +958,26 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
void Module::print(std::ostream &o, AssemblyAnnotationWriter *AAW) const {
|
void Module::print(std::ostream &o, AssemblyAnnotationWriter *AAW) const {
|
||||||
SlotCalculator SlotTable(this, true);
|
SlotCalculator SlotTable(this, false);
|
||||||
AssemblyWriter W(o, SlotTable, this, AAW);
|
AssemblyWriter W(o, SlotTable, this, AAW);
|
||||||
W.write(this);
|
W.write(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalVariable::print(std::ostream &o) const {
|
void GlobalVariable::print(std::ostream &o) const {
|
||||||
SlotCalculator SlotTable(getParent(), true);
|
SlotCalculator SlotTable(getParent(), false);
|
||||||
AssemblyWriter W(o, SlotTable, getParent(), 0);
|
AssemblyWriter W(o, SlotTable, getParent(), 0);
|
||||||
W.write(this);
|
W.write(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Function::print(std::ostream &o, AssemblyAnnotationWriter *AAW) const {
|
void Function::print(std::ostream &o, AssemblyAnnotationWriter *AAW) const {
|
||||||
SlotCalculator SlotTable(getParent(), true);
|
SlotCalculator SlotTable(getParent(), false);
|
||||||
AssemblyWriter W(o, SlotTable, getParent(), AAW);
|
AssemblyWriter W(o, SlotTable, getParent(), AAW);
|
||||||
|
|
||||||
W.write(this);
|
W.write(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasicBlock::print(std::ostream &o, AssemblyAnnotationWriter *AAW) const {
|
void BasicBlock::print(std::ostream &o, AssemblyAnnotationWriter *AAW) const {
|
||||||
SlotCalculator SlotTable(getParent(), true);
|
SlotCalculator SlotTable(getParent(), false);
|
||||||
AssemblyWriter W(o, SlotTable,
|
AssemblyWriter W(o, SlotTable,
|
||||||
getParent() ? getParent()->getParent() : 0, AAW);
|
getParent() ? getParent()->getParent() : 0, AAW);
|
||||||
W.write(this);
|
W.write(this);
|
||||||
@ -996,7 +985,7 @@ void BasicBlock::print(std::ostream &o, AssemblyAnnotationWriter *AAW) const {
|
|||||||
|
|
||||||
void Instruction::print(std::ostream &o, AssemblyAnnotationWriter *AAW) const {
|
void Instruction::print(std::ostream &o, AssemblyAnnotationWriter *AAW) const {
|
||||||
const Function *F = getParent() ? getParent()->getParent() : 0;
|
const Function *F = getParent() ? getParent()->getParent() : 0;
|
||||||
SlotCalculator SlotTable(F, true);
|
SlotCalculator SlotTable(F, false);
|
||||||
AssemblyWriter W(o, SlotTable, F ? F->getParent() : 0, AAW);
|
AssemblyWriter W(o, SlotTable, F ? F->getParent() : 0, AAW);
|
||||||
|
|
||||||
W.write(this);
|
W.write(this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user