#include "llvm/Module.h"
#include "llvm/Type.h"
#include "llvm/Assembly/Writer.h"
-#include "llvm/CodeGen/MachineConstantPool.h"
-#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/Mangler.h"
#include "llvm/ADT/Statistic.h"
-
+#include <iostream>
using namespace llvm;
namespace {
}
bool printInstruction(const MachineInstr *MI);
void printOp(const MachineOperand &MO, bool IsCallOp = false);
- void printConstantPool(MachineConstantPool *MCP);
- void printOperand(const MachineInstr *MI, int opNum, MVT::ValueType VT);
+ void printOperand(const MachineInstr *MI, int opNum);
void printBaseOffsetPair (const MachineInstr *MI, int i, bool brackets=true);
void printMachineInstruction(const MachineInstr *MI);
bool runOnMachineFunction(MachineFunction &F);
#include "AlphaGenAsmWriter.inc"
-void AlphaAsmPrinter::printOperand(const MachineInstr *MI, int opNum, MVT::ValueType VT)
+void AlphaAsmPrinter::printOperand(const MachineInstr *MI, int opNum)
{
const MachineOperand &MO = MI->getOperand(opNum);
if (MO.getType() == MachineOperand::MO_MachineRegister) {
}
case MachineOperand::MO_ConstantPoolIndex:
- O << PrivateGlobalPrefix << "CPI" << CurrentFnName << "_"
+ O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_"
<< MO.getConstantPoolIndex();
return;
case MachineOperand::MO_GlobalAddress:
//Abuse PCrel to specify pcrel calls
//calls are the only thing that use this flag
- if (MO.isPCRelative())
- O << PrivateGlobalPrefix << Mang->getValueName(MO.getGlobal()) << "..ng";
- else
+// if (MO.isPCRelative())
+// O << PrivateGlobalPrefix << Mang->getValueName(MO.getGlobal()) << "..ng";
+// else
O << Mang->getValueName(MO.getGlobal());
return;
/// method to print assembly for each instruction.
///
bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
- setupMachineFunction(MF);
+ SetupMachineFunction(MF);
O << "\n\n";
// Print out constants referenced by the function
- printConstantPool(MF.getConstantPool());
+ EmitConstantPool(MF.getConstantPool());
// Print out labels for the function.
SwitchSection("\t.section .text", MF.getFunction());
- emitAlignment(4);
+ EmitAlignment(4);
O << "\t.globl " << CurrentFnName << "\n";
O << "\t.ent " << CurrentFnName << "\n";
return false;
}
-
-/// printConstantPool - Print to the current output stream assembly
-/// representations of the constants in the constant pool MCP. This is
-/// used to print out constants which have been "spilled to memory" by
-/// the code generator.
-///
-void AlphaAsmPrinter::printConstantPool(MachineConstantPool *MCP) {
- const std::vector<Constant*> &CP = MCP->getConstants();
- const TargetData &TD = TM.getTargetData();
-
- if (CP.empty()) return;
-
- SwitchSection("\t.section .rodata", 0);
- for (unsigned i = 0, e = CP.size(); i != e; ++i) {
- emitAlignment(TD.getTypeAlignmentShift(CP[i]->getType()));
- O << PrivateGlobalPrefix << "CPI" << CurrentFnName << "_" << i
- << ":\t\t\t\t\t" << CommentString << *CP[i] << "\n";
- emitGlobalConstant(CP[i]);
- }
-}
-
bool AlphaAsmPrinter::doInitialization(Module &M)
{
AsmPrinter::doInitialization(M);
abort();
}
- emitAlignment(Align);
+ EmitAlignment(Align);
O << "\t.type " << name << ",@object\n";
O << "\t.size " << name << "," << Size << "\n";
O << name << ":\t\t\t\t# ";
O << " = ";
WriteAsOperand(O, C, false, false, &M);
O << "\n";
- emitGlobalConstant(C);
+ EmitGlobalConstant(C);
}
}