Use MachineConstantPoolEntry getOffset() and getType() accessors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30326 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2006-09-14 07:35:00 +00:00
parent f379924287
commit d5a99d7810

View File

@ -129,8 +129,7 @@ void AsmPrinter::EmitConstantPool(MachineConstantPool *MCP) {
std::vector<std::pair<MachineConstantPoolEntry,unsigned> > TargetCPs; std::vector<std::pair<MachineConstantPoolEntry,unsigned> > TargetCPs;
for (unsigned i = 0, e = CP.size(); i != e; ++i) { for (unsigned i = 0, e = CP.size(); i != e; ++i) {
MachineConstantPoolEntry CPE = CP[i]; MachineConstantPoolEntry CPE = CP[i];
const Type *Ty = CPE.isMachineConstantPoolEntry() const Type *Ty = CPE.getType();
? CPE.Val.MachineCPVal->getType() : CPE.Val.ConstVal->getType();
if (TAI->getFourByteConstantSection() && if (TAI->getFourByteConstantSection() &&
TM.getTargetData()->getTypeSize(Ty) == 4) TM.getTargetData()->getTypeSize(Ty) == 4)
FourByteCPs.push_back(std::make_pair(CPE, i)); FourByteCPs.push_back(std::make_pair(CPE, i));
@ -161,23 +160,18 @@ void AsmPrinter::EmitConstantPool(unsigned Alignment, const char *Section,
for (unsigned i = 0, e = CP.size(); i != e; ++i) { for (unsigned i = 0, e = CP.size(); i != e; ++i) {
O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << '_' O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << '_'
<< CP[i].second << ":\t\t\t\t\t" << TAI->getCommentString() << " "; << CP[i].second << ":\t\t\t\t\t" << TAI->getCommentString() << " ";
if (CP[i].first.isMachineConstantPoolEntry()) { WriteTypeSymbolic(O, CP[i].first.getType(), 0) << '\n';
WriteTypeSymbolic(O, CP[i].first.Val.MachineCPVal->getType(), 0) << '\n'; if (CP[i].first.isMachineConstantPoolEntry())
printDataDirective(CP[i].first.Val.MachineCPVal->getType());
EmitMachineConstantPoolValue(CP[i].first.Val.MachineCPVal); EmitMachineConstantPoolValue(CP[i].first.Val.MachineCPVal);
} else { else
WriteTypeSymbolic(O, CP[i].first.Val.ConstVal->getType(), 0) << '\n';
EmitGlobalConstant(CP[i].first.Val.ConstVal); EmitGlobalConstant(CP[i].first.Val.ConstVal);
}
if (i != e-1) { if (i != e-1) {
const Type *Ty = CP[i].first.isMachineConstantPoolEntry() const Type *Ty = CP[i].first.getType();
? CP[i].first.Val.MachineCPVal->getType()
: CP[i].first.Val.ConstVal->getType();
unsigned EntSize = unsigned EntSize =
TM.getTargetData()->getTypeSize(Ty); TM.getTargetData()->getTypeSize(Ty);
unsigned ValEnd = CP[i].first.Offset + EntSize; unsigned ValEnd = CP[i].first.getOffset() + EntSize;
// Emit inter-object padding for alignment. // Emit inter-object padding for alignment.
EmitZeros(CP[i+1].first.Offset-ValEnd); EmitZeros(CP[i+1].first.getOffset()-ValEnd);
} }
} }
} }