Miscellaneous cleanups:

* Convert post to pre-increment for for loops
  * Use generic programming more
  * Use new Value::cast* instructions
  * Use new Module, Method, & BasicBlock forwarding methods
  * Use new facilities in STLExtras.h
  * Use new Instruction::isPHINode() method


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2001-06-27 23:41:11 +00:00
parent 138a124f09
commit 7fc9fe3439
28 changed files with 230 additions and 207 deletions

View File

@ -178,7 +178,7 @@ bool AssemblyWriter::processInstruction(const Instruction *I) {
writeOperand(I->getOperand(op+1), true);
}
Out << "\n\t]";
} else if (I->getInstType() == Instruction::PHINode) {
} else if (I->isPHINode()) {
Out << " " << Operand->getType();
Out << " ["; writeOperand(Operand, false); Out << ",";
@ -262,7 +262,7 @@ void AssemblyWriter::writeOperand(const Value *Operand, bool PrintType,
} else {
int Slot = Table.getValSlot(Operand);
if (Operand->getValueType() == Value::ConstantVal) {
if (Operand->isConstant()) {
Out << " " << ((ConstPoolVal*)Operand)->getStrValue();
} else {
if (Slot >= 0) Out << " %" << Slot;
@ -313,12 +313,11 @@ void WriteToAssembly(const ConstPoolVal *CPV, ostream &o) {
// A Constant pool value may have a parent that is either a method or a
// module. Untangle this now...
//
if (CPV->getParent() == 0 ||
CPV->getParent()->getValueType() == Value::MethodVal) {
if (CPV->getParent() == 0 || CPV->getParent()->isMethod()) {
SlotTable = new SlotCalculator((Method*)CPV->getParent(), true);
} else {
assert(CPV->getParent()->getValueType() == Value::ModuleVal);
SlotTable = new SlotCalculator((Module*)CPV->getParent(), true);
SlotTable =
new SlotCalculator(CPV->getParent()->castModuleAsserting(), true);
}
AssemblyWriter W(o, *SlotTable);