From 4862a6612b18ac90c1b4f43d160f2d0af9f91f14 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Thu, 30 Jul 2015 23:29:36 -0400 Subject: [PATCH] Add placeholder implementations of a couple more methods. At this point, I can "compile": int theAnswer(void) { return 42; } It compiles in the sense that clang executes to the end without crashing but the .s file it produces is useless. But another small step forward. --- lib/Target/WDC65816/WDC65816AsmPrinter.cpp | 9 ++--- lib/Target/WDC65816/WDC65816FrameLowering.cpp | 6 ++-- lib/Target/WDC65816/WDC65816ISelDAGToDAG.cpp | 13 +++---- lib/Target/WDC65816/WDC65816ISelLowering.cpp | 34 +++++++++++++------ lib/Target/WDC65816/WDC65816ISelLowering.h | 29 ++++++++-------- lib/Target/WDC65816/WDC65816RegisterInfo.cpp | 3 +- 6 files changed, 51 insertions(+), 43 deletions(-) diff --git a/lib/Target/WDC65816/WDC65816AsmPrinter.cpp b/lib/Target/WDC65816/WDC65816AsmPrinter.cpp index 446a1452..fab94cb0 100644 --- a/lib/Target/WDC65816/WDC65816AsmPrinter.cpp +++ b/lib/Target/WDC65816/WDC65816AsmPrinter.cpp @@ -86,22 +86,19 @@ namespace { void WDC65816AsmPrinter::printOperand(const MachineInstr *MI, int opNum, raw_ostream &O) { - // WDC_TODO - print the operand here... - WDC_LOG("Unimplemented method called"); + WDC_LOG("WDC_TODO - Unimplemented method called"); } void WDC65816AsmPrinter::printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O, const char *Modifier) { - // WDC_TODO - print the memory operand here... - WDC_LOG("Unimplemented method called"); + WDC_LOG("WDC_TODO - Unimplemented method called"); } bool WDC65816AsmPrinter::printGetPCX(const MachineInstr *MI, unsigned opNum, raw_ostream &O) { - // WDC_TODO - print whatever this is here... - WDC_LOG("Unimplemented method called"); + WDC_LOG("WDC_TODO - Unimplemented method called"); return true; } diff --git a/lib/Target/WDC65816/WDC65816FrameLowering.cpp b/lib/Target/WDC65816/WDC65816FrameLowering.cpp index bb0d96a3..e4cfe812 100644 --- a/lib/Target/WDC65816/WDC65816FrameLowering.cpp +++ b/lib/Target/WDC65816/WDC65816FrameLowering.cpp @@ -27,19 +27,19 @@ using namespace llvm; // hasFP - Whether or not there is a frame pointer. // WDC_TODO - for now we will say we always have a frame pointer. bool WDC65816FrameLowering::hasFP(const MachineFunction &MF) const { - WDC_LOG("Unimplemented method called"); + WDC_LOG("WDC_TODO - Unimplemented method called"); return true; } void WDC65816FrameLowering::emitPrologue(MachineFunction &MF) const { - WDC_LOG("Unimplemented method called"); + WDC_LOG("WDC_TODO - Unimplemented method called"); } void WDC65816FrameLowering::emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const { - WDC_LOG("Unimplemented method called"); + WDC_LOG("WDC_TODO - Unimplemented method called"); } diff --git a/lib/Target/WDC65816/WDC65816ISelDAGToDAG.cpp b/lib/Target/WDC65816/WDC65816ISelDAGToDAG.cpp index 6519835f..aa25bf76 100644 --- a/lib/Target/WDC65816/WDC65816ISelDAGToDAG.cpp +++ b/lib/Target/WDC65816/WDC65816ISelDAGToDAG.cpp @@ -70,7 +70,7 @@ namespace { SDNode* WDC65816DAGToDAGISel::getGlobalBaseReg() { unsigned GlobalBaseReg = TM.getInstrInfo()->getGlobalBaseReg(MF); - WDC_LOG("This method is probably implemented wrong..."); + WDC_LOG("WDC_TODO - This method is probably implemented wrong..."); return CurDAG->getRegister(GlobalBaseReg, getTargetLowering()->getPointerTy()).getNode(); } @@ -79,22 +79,19 @@ SDNode* WDC65816DAGToDAGISel::getGlobalBaseReg() { bool WDC65816DAGToDAGISel::SelectAbs(SDValue N, SDValue &R1) { - // WDC_TODO - Write something here - WDC_LOG("Unimplemented method called"); + WDC_LOG("WDC_TODO - Unimplemented method called"); return false; } bool WDC65816DAGToDAGISel::SelectAbsLong(SDValue N, SDValue &R1) { - // WDC_TODO - Write something here - WDC_LOG("Unimplemented method called"); + WDC_LOG("WDC_TODO - Unimplemented method called"); return false; } bool WDC65816DAGToDAGISel::SelectDirectPage(SDValue N, SDValue &R1) { - // WDC_TODO - Write something here - WDC_LOG("Unimplemented method called"); + WDC_LOG("WDC_TODO - Unimplemented method called"); return false; } @@ -170,7 +167,7 @@ bool SparcDAGToDAGISel::SelectADDRrr(SDValue Addr, SDValue &R1, SDValue &R2) { #endif SDNode *WDC65816DAGToDAGISel::Select(SDNode *N) { - WDC_LOG("Unimplemented method called"); + WDC_LOG("WDC_TODO - Unimplemented method called"); return NULL; #if 0 // WDC_TODO - we will definitely need something here SDLoc dl(N); diff --git a/lib/Target/WDC65816/WDC65816ISelLowering.cpp b/lib/Target/WDC65816/WDC65816ISelLowering.cpp index 514c4631..e4d1bdfa 100644 --- a/lib/Target/WDC65816/WDC65816ISelLowering.cpp +++ b/lib/Target/WDC65816/WDC65816ISelLowering.cpp @@ -151,6 +151,30 @@ static bool CC_WDC6581664_Half(unsigned &ValNo, MVT &ValVT, #include "WDC65816GenCallingConv.inc" + +SDValue WDC65816TargetLowering::LowerFormalArguments(SDValue Chain, + CallingConv::ID CallConv, + bool IsVarArg, + const SmallVectorImpl &Ins, + SDLoc DL, + SelectionDAG &DAG, + SmallVectorImpl &InVals) const { + WDC_LOG("WDC_TODO - Not implemented yet!"); + return Chain; +} + + +SDValue +WDC65816TargetLowering::LowerReturn(SDValue Chain, + CallingConv::ID CallConv, bool IsVarArg, + const SmallVectorImpl &Outs, + const SmallVectorImpl &OutVals, + SDLoc DL, SelectionDAG &DAG) const { + WDC_LOG("WDC_TODO - Not implemented yet!"); + return Chain; +} + + #if 0 // WDC_TODO - Get rid of this? // The calling conventions in WDC65816CallingConv.td are described in terms of the // callee's register window. This function translates registers to the @@ -164,16 +188,6 @@ static unsigned toCallerWindow(unsigned Reg) { #endif #if 0 // WDC_TODO - Disable more stuff -SDValue -WDC65816TargetLowering::LowerReturn(SDValue Chain, - CallingConv::ID CallConv, bool IsVarArg, - const SmallVectorImpl &Outs, - const SmallVectorImpl &OutVals, - SDLoc DL, SelectionDAG &DAG) const { - if (Subtarget->is64Bit()) - return LowerReturn_64(Chain, CallConv, IsVarArg, Outs, OutVals, DL, DAG); - return LowerReturn_32(Chain, CallConv, IsVarArg, Outs, OutVals, DL, DAG); -} SDValue WDC65816TargetLowering::LowerReturn_32(SDValue Chain, diff --git a/lib/Target/WDC65816/WDC65816ISelLowering.h b/lib/Target/WDC65816/WDC65816ISelLowering.h index 1fc252f6..1c45323f 100644 --- a/lib/Target/WDC65816/WDC65816ISelLowering.h +++ b/lib/Target/WDC65816/WDC65816ISelLowering.h @@ -57,6 +57,21 @@ namespace llvm { public: WDC65816TargetLowering(TargetMachine &TM); + virtual SDValue + LowerFormalArguments(SDValue Chain, + CallingConv::ID CallConv, + bool isVarArg, + const SmallVectorImpl &Ins, + SDLoc dl, SelectionDAG &DAG, + SmallVectorImpl &InVals) const; + + virtual SDValue + LowerReturn(SDValue Chain, + CallingConv::ID CallConv, bool isVarArg, + const SmallVectorImpl &Outs, + const SmallVectorImpl &OutVals, + SDLoc dl, SelectionDAG &DAG) const; + #if 0 // WDC_TODO - Do I need any of this? virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const; @@ -84,14 +99,6 @@ namespace llvm { /// getSetCCResultType - Return the ISD::SETCC ValueType virtual EVT getSetCCResultType(LLVMContext &Context, EVT VT) const; - - virtual SDValue - LowerFormalArguments(SDValue Chain, - CallingConv::ID CallConv, - bool isVarArg, - const SmallVectorImpl &Ins, - SDLoc dl, SelectionDAG &DAG, - SmallVectorImpl &InVals) const; SDValue LowerFormalArguments_32(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, @@ -113,12 +120,6 @@ namespace llvm { SDValue LowerCall_64(TargetLowering::CallLoweringInfo &CLI, SmallVectorImpl &InVals) const; - virtual SDValue - LowerReturn(SDValue Chain, - CallingConv::ID CallConv, bool isVarArg, - const SmallVectorImpl &Outs, - const SmallVectorImpl &OutVals, - SDLoc dl, SelectionDAG &DAG) const; SDValue LowerReturn_32(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg, const SmallVectorImpl &Outs, diff --git a/lib/Target/WDC65816/WDC65816RegisterInfo.cpp b/lib/Target/WDC65816/WDC65816RegisterInfo.cpp index f0bd8a23..481c9021 100644 --- a/lib/Target/WDC65816/WDC65816RegisterInfo.cpp +++ b/lib/Target/WDC65816/WDC65816RegisterInfo.cpp @@ -85,8 +85,7 @@ void WDC65816RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj, unsigned FIOperandNum, RegScavenger *RS) const { - // WDC_TODO - Write something here... - WDC_LOG("Unimplemented method called"); + WDC_LOG("WDC_TODO - Unimplemented method called"); } #if 0 // TODO - How much of this stuff do I need?