mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-18 06:38:41 +00:00
implement minimal versions of
ARMAsmPrinter::runOnMachineFunction LowerFORMAL_ARGUMENTS ARMInstrInfo::isMoveInstr git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28431 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
eb82da891c
commit
4b442b528a
@ -85,8 +85,50 @@ FunctionPass *llvm::createARMCodePrinterPass(std::ostream &o,
|
|||||||
/// method to print assembly for each instruction.
|
/// method to print assembly for each instruction.
|
||||||
///
|
///
|
||||||
bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||||
assert(0 && "not implemented");
|
SetupMachineFunction(MF);
|
||||||
// We didn't modify anything.
|
O << "\n\n";
|
||||||
|
|
||||||
|
// Print out constants referenced by the function
|
||||||
|
EmitConstantPool(MF.getConstantPool());
|
||||||
|
|
||||||
|
// Print out jump tables referenced by the function
|
||||||
|
EmitJumpTableInfo(MF.getJumpTableInfo());
|
||||||
|
|
||||||
|
// Print out labels for the function.
|
||||||
|
const Function *F = MF.getFunction();
|
||||||
|
switch (F->getLinkage()) {
|
||||||
|
default: assert(0 && "Unknown linkage type!");
|
||||||
|
case Function::InternalLinkage:
|
||||||
|
SwitchToTextSection("\t.text", F);
|
||||||
|
break;
|
||||||
|
case Function::ExternalLinkage:
|
||||||
|
SwitchToTextSection("\t.text", F);
|
||||||
|
O << "\t.globl\t" << CurrentFnName << "\n";
|
||||||
|
break;
|
||||||
|
case Function::WeakLinkage:
|
||||||
|
case Function::LinkOnceLinkage:
|
||||||
|
assert(0 && "Not implemented");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
EmitAlignment(4, F);
|
||||||
|
O << CurrentFnName << ":\n";
|
||||||
|
|
||||||
|
// Print out code for the function.
|
||||||
|
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
||||||
|
I != E; ++I) {
|
||||||
|
// Print a label for the basic block.
|
||||||
|
if (I != MF.begin()) {
|
||||||
|
printBasicBlockLabel(I, true);
|
||||||
|
O << '\n';
|
||||||
|
}
|
||||||
|
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
||||||
|
II != E; ++II) {
|
||||||
|
// Print the assembly for the instruction.
|
||||||
|
O << "\t";
|
||||||
|
printInstruction(II);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +151,6 @@ bool ARMAsmPrinter::doInitialization(Module &M) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ARMAsmPrinter::doFinalization(Module &M) {
|
bool ARMAsmPrinter::doFinalization(Module &M) {
|
||||||
assert(0 && "not implemented");
|
|
||||||
AsmPrinter::doFinalization(M);
|
AsmPrinter::doFinalization(M);
|
||||||
return false; // success
|
return false; // success
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,42 @@ static SDOperand LowerRET(SDOperand Op, SelectionDAG &DAG) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static SDOperand LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG) {
|
static SDOperand LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG) {
|
||||||
assert(0 && "Not implemented");
|
MachineFunction &MF = DAG.getMachineFunction();
|
||||||
|
SSARegMap *RegMap = MF.getSSARegMap();
|
||||||
|
std::vector<SDOperand> ArgValues;
|
||||||
|
SDOperand Root = Op.getOperand(0);
|
||||||
|
|
||||||
|
unsigned reg_idx = 0;
|
||||||
|
unsigned num_regs = 4;
|
||||||
|
|
||||||
|
static const unsigned REGS[] = {
|
||||||
|
ARM::R0, ARM::R1, ARM::R2, ARM::R3
|
||||||
|
};
|
||||||
|
|
||||||
|
for (unsigned ArgNo = 0, e = Op.Val->getNumValues()-1; ArgNo != e; ++ArgNo) {
|
||||||
|
SDOperand ArgVal;
|
||||||
|
|
||||||
|
MVT::ValueType ObjectVT = Op.getValue(ArgNo).getValueType();
|
||||||
|
assert (ObjectVT == MVT::i32);
|
||||||
|
|
||||||
|
assert(reg_idx < num_regs);
|
||||||
|
unsigned VReg = RegMap->createVirtualRegister(&ARM::IntRegsRegClass);
|
||||||
|
MF.addLiveIn(REGS[reg_idx], VReg);
|
||||||
|
ArgVal = DAG.getCopyFromReg(Root, VReg, MVT::i32);
|
||||||
|
++reg_idx;
|
||||||
|
|
||||||
|
ArgValues.push_back(ArgVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isVarArg = cast<ConstantSDNode>(Op.getOperand(2))->getValue() != 0;
|
||||||
|
assert(!isVarArg);
|
||||||
|
|
||||||
|
ArgValues.push_back(Root);
|
||||||
|
|
||||||
|
// Return the new list of results.
|
||||||
|
std::vector<MVT::ValueType> RetVT(Op.Val->value_begin(),
|
||||||
|
Op.Val->value_end());
|
||||||
|
return DAG.getNode(ISD::MERGE_VALUES, RetVT, ArgValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDOperand ARMTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
SDOperand ARMTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
|
||||||
|
@ -27,11 +27,6 @@ ARMInstrInfo::ARMInstrInfo()
|
|||||||
///
|
///
|
||||||
bool ARMInstrInfo::isMoveInstr(const MachineInstr &MI,
|
bool ARMInstrInfo::isMoveInstr(const MachineInstr &MI,
|
||||||
unsigned &SrcReg, unsigned &DstReg) const {
|
unsigned &SrcReg, unsigned &DstReg) const {
|
||||||
// We look for 3 kinds of patterns here:
|
|
||||||
// or with G0 or 0
|
|
||||||
// add with G0 or 0
|
|
||||||
// fmovs or FpMOVD (pseudo double move).
|
|
||||||
assert(0 && "not implemented");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user