2008-05-13 09:02:57 +00:00
|
|
|
//===-- PIC16ISelLowering.h - PIC16 DAG Lowering Interface ------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines the interfaces that PIC16 uses to lower LLVM code into a
|
|
|
|
// selection DAG.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef PIC16ISELLOWERING_H
|
|
|
|
#define PIC16ISELLOWERING_H
|
|
|
|
|
|
|
|
#include "PIC16.h"
|
|
|
|
#include "PIC16Subtarget.h"
|
2008-05-14 11:31:39 +00:00
|
|
|
#include "llvm/CodeGen/SelectionDAG.h"
|
|
|
|
#include "llvm/Target/TargetLowering.h"
|
2009-04-06 10:54:50 +00:00
|
|
|
#include <map>
|
2008-05-13 09:02:57 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace PIC16ISD {
|
|
|
|
enum NodeType {
|
|
|
|
// Start the numbering from where ISD NodeType finishes.
|
2008-09-23 18:42:32 +00:00
|
|
|
FIRST_NUMBER = ISD::BUILTIN_OP_END,
|
2008-05-13 09:02:57 +00:00
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
Lo, // Low 8-bits of GlobalAddress.
|
|
|
|
Hi, // High 8-bits of GlobalAddress.
|
|
|
|
PIC16Load,
|
2009-04-02 17:42:00 +00:00
|
|
|
PIC16LdArg, // This is replica of PIC16Load but used to load function
|
|
|
|
// arguments and is being used for facilitating for some
|
|
|
|
// store removal optimizations.
|
|
|
|
|
2009-01-13 19:18:47 +00:00
|
|
|
PIC16LdWF,
|
2008-11-19 11:00:54 +00:00
|
|
|
PIC16Store,
|
2009-01-13 19:18:47 +00:00
|
|
|
PIC16StWF,
|
2008-11-19 11:00:54 +00:00
|
|
|
Banksel,
|
2009-04-08 05:38:48 +00:00
|
|
|
MTLO, // Move to low part of FSR
|
|
|
|
MTHI, // Move to high part of FSR
|
|
|
|
MTPCLATH, // Move to PCLATCH
|
|
|
|
PIC16Connect, // General connector for PIC16 nodes
|
2008-11-19 11:00:54 +00:00
|
|
|
BCF,
|
|
|
|
LSLF, // PIC16 Logical shift left
|
|
|
|
LRLF, // PIC16 Logical shift right
|
|
|
|
RLF, // Rotate left through carry
|
|
|
|
RRF, // Rotate right through carry
|
2009-01-13 19:18:47 +00:00
|
|
|
CALL, // PIC16 Call instruction
|
2009-04-08 05:38:48 +00:00
|
|
|
CALLW, // PIC16 CALLW instruction
|
2009-05-30 01:09:53 +00:00
|
|
|
SUBCC, // Compare for equality or inequality.
|
2009-01-13 19:18:47 +00:00
|
|
|
SELECT_ICC, // Psuedo to be caught in schedular and expanded to brcond.
|
|
|
|
BRCOND, // Conditional branch.
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
RET, // Return.
|
2008-11-19 11:00:54 +00:00
|
|
|
Dummy
|
|
|
|
};
|
|
|
|
|
|
|
|
// Keep track of different address spaces.
|
|
|
|
enum AddressSpace {
|
|
|
|
RAM_SPACE = 0, // RAM address space
|
|
|
|
ROM_SPACE = 1 // ROM address space number is 1
|
2008-05-13 09:02:57 +00:00
|
|
|
};
|
2009-01-21 05:44:05 +00:00
|
|
|
enum PIC16Libcall {
|
2009-05-11 08:52:04 +00:00
|
|
|
MUL_I8 = RTLIB::UNKNOWN_LIBCALL + 1,
|
2009-01-13 19:18:47 +00:00
|
|
|
SRA_I8,
|
|
|
|
SLL_I8,
|
|
|
|
SRL_I8,
|
|
|
|
PIC16UnknownCall
|
|
|
|
};
|
2008-05-13 09:02:57 +00:00
|
|
|
}
|
|
|
|
|
2009-01-13 19:18:47 +00:00
|
|
|
|
2008-05-13 09:02:57 +00:00
|
|
|
//===--------------------------------------------------------------------===//
|
|
|
|
// TargetLowering Implementation
|
|
|
|
//===--------------------------------------------------------------------===//
|
2008-11-19 11:00:54 +00:00
|
|
|
class PIC16TargetLowering : public TargetLowering {
|
2008-05-13 09:02:57 +00:00
|
|
|
public:
|
|
|
|
explicit PIC16TargetLowering(PIC16TargetMachine &TM);
|
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
/// getTargetNodeName - This method returns the name of a target specific
|
|
|
|
/// DAG node.
|
2008-05-13 09:02:57 +00:00
|
|
|
virtual const char *getTargetNodeName(unsigned Opcode) const;
|
2009-01-13 19:18:47 +00:00
|
|
|
/// getSetCCResultType - Return the ISD::SETCC ValueType
|
2009-08-11 20:47:22 +00:00
|
|
|
virtual MVT::SimpleValueType getSetCCResultType(EVT ValType) const;
|
2009-12-28 02:40:33 +00:00
|
|
|
virtual MVT::SimpleValueType getCmpLibcallReturnType() const;
|
2010-04-17 15:26:15 +00:00
|
|
|
SDValue LowerShift(SDValue Op, SelectionDAG &DAG) const;
|
|
|
|
SDValue LowerMUL(SDValue Op, SelectionDAG &DAG) const;
|
|
|
|
SDValue LowerADD(SDValue Op, SelectionDAG &DAG) const;
|
|
|
|
SDValue LowerSUB(SDValue Op, SelectionDAG &DAG) const;
|
|
|
|
SDValue LowerBinOp(SDValue Op, SelectionDAG &DAG) const;
|
2009-04-08 05:38:48 +00:00
|
|
|
// Call returns
|
|
|
|
SDValue
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
LowerDirectCallReturn(SDValue RetLabel, SDValue Chain, SDValue InFlag,
|
|
|
|
const SmallVectorImpl<ISD::InputArg> &Ins,
|
|
|
|
DebugLoc dl, SelectionDAG &DAG,
|
2010-04-17 15:26:15 +00:00
|
|
|
SmallVectorImpl<SDValue> &InVals) const;
|
2009-04-08 05:38:48 +00:00
|
|
|
SDValue
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
LowerIndirectCallReturn(SDValue Chain, SDValue InFlag,
|
|
|
|
SDValue DataAddr_Lo, SDValue DataAddr_Hi,
|
|
|
|
const SmallVectorImpl<ISD::InputArg> &Ins,
|
|
|
|
DebugLoc dl, SelectionDAG &DAG,
|
2010-04-17 15:26:15 +00:00
|
|
|
SmallVectorImpl<SDValue> &InVals) const;
|
2009-04-08 05:38:48 +00:00
|
|
|
|
|
|
|
// Call arguments
|
|
|
|
SDValue
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
LowerDirectCallArguments(SDValue ArgLabel, SDValue Chain, SDValue InFlag,
|
|
|
|
const SmallVectorImpl<ISD::OutputArg> &Outs,
|
2010-07-07 15:54:55 +00:00
|
|
|
const SmallVectorImpl<SDValue> &OutVals,
|
2010-04-17 15:26:15 +00:00
|
|
|
DebugLoc dl, SelectionDAG &DAG) const;
|
2009-04-08 05:38:48 +00:00
|
|
|
|
|
|
|
SDValue
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
LowerIndirectCallArguments(SDValue Chain, SDValue InFlag,
|
2009-04-08 05:38:48 +00:00
|
|
|
SDValue DataAddr_Lo, SDValue DataAddr_Hi,
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
const SmallVectorImpl<ISD::OutputArg> &Outs,
|
2010-07-07 15:54:55 +00:00
|
|
|
const SmallVectorImpl<SDValue> &OutVals,
|
2009-08-11 01:51:55 +00:00
|
|
|
const SmallVectorImpl<ISD::InputArg> &Ins,
|
2010-04-17 15:26:15 +00:00
|
|
|
DebugLoc dl, SelectionDAG &DAG) const;
|
2009-04-08 05:38:48 +00:00
|
|
|
|
2010-04-17 15:26:15 +00:00
|
|
|
SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG) const;
|
|
|
|
SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
|
2009-01-13 19:18:47 +00:00
|
|
|
SDValue getPIC16Cmp(SDValue LHS, SDValue RHS, unsigned OrigCC, SDValue &CC,
|
2010-04-17 15:26:15 +00:00
|
|
|
SelectionDAG &DAG, DebugLoc dl) const;
|
2010-05-01 00:01:06 +00:00
|
|
|
virtual MachineBasicBlock *
|
|
|
|
EmitInstrWithCustomInserter(MachineInstr *MI,
|
|
|
|
MachineBasicBlock *MBB) const;
|
2009-01-13 19:18:47 +00:00
|
|
|
|
2010-04-17 15:26:15 +00:00
|
|
|
virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
|
2009-01-13 19:18:47 +00:00
|
|
|
virtual void ReplaceNodeResults(SDNode *N,
|
|
|
|
SmallVectorImpl<SDValue> &Results,
|
2010-04-17 15:26:15 +00:00
|
|
|
SelectionDAG &DAG) const;
|
2009-01-21 09:00:29 +00:00
|
|
|
virtual void LowerOperationWrapper(SDNode *N,
|
|
|
|
SmallVectorImpl<SDValue> &Results,
|
2010-04-17 15:26:15 +00:00
|
|
|
SelectionDAG &DAG) const;
|
2009-01-21 05:44:05 +00:00
|
|
|
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
virtual SDValue
|
|
|
|
LowerFormalArguments(SDValue Chain,
|
2009-09-02 08:44:58 +00:00
|
|
|
CallingConv::ID CallConv,
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
bool isVarArg,
|
|
|
|
const SmallVectorImpl<ISD::InputArg> &Ins,
|
|
|
|
DebugLoc dl, SelectionDAG &DAG,
|
2010-04-17 15:26:15 +00:00
|
|
|
SmallVectorImpl<SDValue> &InVals) const;
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
|
|
|
|
virtual SDValue
|
2010-02-02 23:55:14 +00:00
|
|
|
LowerCall(SDValue Chain, SDValue Callee,
|
2010-01-27 00:07:07 +00:00
|
|
|
CallingConv::ID CallConv, bool isVarArg, bool &isTailCall,
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
const SmallVectorImpl<ISD::OutputArg> &Outs,
|
2010-07-07 15:54:55 +00:00
|
|
|
const SmallVectorImpl<SDValue> &OutVals,
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
const SmallVectorImpl<ISD::InputArg> &Ins,
|
|
|
|
DebugLoc dl, SelectionDAG &DAG,
|
2010-04-17 15:26:15 +00:00
|
|
|
SmallVectorImpl<SDValue> &InVals) const;
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
|
|
|
|
virtual SDValue
|
|
|
|
LowerReturn(SDValue Chain,
|
2009-09-02 08:44:58 +00:00
|
|
|
CallingConv::ID CallConv, bool isVarArg,
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
const SmallVectorImpl<ISD::OutputArg> &Outs,
|
2010-07-07 15:54:55 +00:00
|
|
|
const SmallVectorImpl<SDValue> &OutVals,
|
2010-04-17 15:26:15 +00:00
|
|
|
DebugLoc dl, SelectionDAG &DAG) const;
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
|
2010-04-17 15:26:15 +00:00
|
|
|
SDValue ExpandStore(SDNode *N, SelectionDAG &DAG) const;
|
|
|
|
SDValue ExpandLoad(SDNode *N, SelectionDAG &DAG) const;
|
|
|
|
SDValue ExpandGlobalAddress(SDNode *N, SelectionDAG &DAG) const;
|
|
|
|
SDValue ExpandExternalSymbol(SDNode *N, SelectionDAG &DAG) const;
|
|
|
|
SDValue ExpandFrameIndex(SDNode *N, SelectionDAG &DAG) const;
|
2008-11-19 11:00:54 +00:00
|
|
|
|
|
|
|
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const;
|
|
|
|
SDValue PerformPIC16LoadCombine(SDNode *N, DAGCombinerInfo &DCI) const;
|
2009-04-02 17:42:00 +00:00
|
|
|
SDValue PerformStoreCombine(SDNode *N, DAGCombinerInfo &DCI) const;
|
2008-11-19 11:00:54 +00:00
|
|
|
|
2009-04-06 10:54:50 +00:00
|
|
|
// This function returns the Tmp Offset for FrameIndex. If any TmpOffset
|
|
|
|
// already exists for the FI then it returns the same else it creates the
|
|
|
|
// new offset and returns.
|
2010-04-17 14:41:14 +00:00
|
|
|
unsigned GetTmpOffsetForFI(unsigned FI, unsigned slot_size,
|
2010-04-17 15:26:15 +00:00
|
|
|
MachineFunction &MF) const;
|
|
|
|
void ResetTmpOffsetMap(SelectionDAG &DAG) const;
|
2010-04-17 14:41:14 +00:00
|
|
|
void InitReservedFrameCount(const Function *F,
|
2010-04-17 15:26:15 +00:00
|
|
|
SelectionDAG &DAG) const;
|
2009-04-06 10:54:50 +00:00
|
|
|
|
2009-07-01 18:50:55 +00:00
|
|
|
/// getFunctionAlignment - Return the Log2 alignment of this function.
|
2009-06-30 22:38:32 +00:00
|
|
|
virtual unsigned getFunctionAlignment(const Function *) const {
|
|
|
|
// FIXME: The function never seems to be aligned.
|
|
|
|
return 1;
|
|
|
|
}
|
2010-07-21 06:09:07 +00:00
|
|
|
protected:
|
|
|
|
std::pair<const TargetRegisterClass*, uint8_t>
|
|
|
|
findRepresentativeClass(EVT VT) const;
|
2008-11-19 11:00:54 +00:00
|
|
|
private:
|
2009-04-02 17:42:00 +00:00
|
|
|
// If the Node is a BUILD_PAIR representing a direct Address,
|
|
|
|
// then this function will return true.
|
2010-04-17 15:26:15 +00:00
|
|
|
bool isDirectAddress(const SDValue &Op) const;
|
2008-11-19 11:00:54 +00:00
|
|
|
|
|
|
|
// If the Node is a DirectAddress in ROM_SPACE then this
|
|
|
|
// function will return true
|
2010-04-17 15:26:15 +00:00
|
|
|
bool isRomAddress(const SDValue &Op) const;
|
2008-11-19 11:00:54 +00:00
|
|
|
|
|
|
|
// Extract the Lo and Hi component of Op.
|
|
|
|
void GetExpandedParts(SDValue Op, SelectionDAG &DAG, SDValue &Lo,
|
2010-04-17 15:26:15 +00:00
|
|
|
SDValue &Hi) const;
|
2008-11-19 11:00:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Load pointer can be a direct or indirect address. In PIC16 direct
|
|
|
|
// addresses need Banksel and Indirect addresses need to be loaded to
|
|
|
|
// FSR first. Handle address specific cases here.
|
|
|
|
void LegalizeAddress(SDValue Ptr, SelectionDAG &DAG, SDValue &Chain,
|
2010-04-17 15:26:15 +00:00
|
|
|
SDValue &NewPtr, unsigned &Offset, DebugLoc dl) const;
|
2008-11-19 11:00:54 +00:00
|
|
|
|
2009-01-13 19:18:47 +00:00
|
|
|
// FrameIndex should be broken down into ExternalSymbol and FrameOffset.
|
|
|
|
void LegalizeFrameIndex(SDValue Op, SelectionDAG &DAG, SDValue &ES,
|
2010-04-17 15:26:15 +00:00
|
|
|
int &Offset) const;
|
2009-01-13 19:18:47 +00:00
|
|
|
|
2009-04-08 05:38:48 +00:00
|
|
|
// For indirect calls data address of the callee frame need to be
|
|
|
|
// extracted. This function fills the arguments DataAddr_Lo and
|
|
|
|
// DataAddr_Hi with the address of the callee frame.
|
|
|
|
void GetDataAddress(DebugLoc dl, SDValue Callee, SDValue &Chain,
|
|
|
|
SDValue &DataAddr_Lo, SDValue &DataAddr_Hi,
|
2010-04-17 15:26:15 +00:00
|
|
|
SelectionDAG &DAG) const;
|
2009-04-08 05:38:48 +00:00
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
// We can not have both operands of a binary operation in W.
|
|
|
|
// This function is used to put one operand on stack and generate a load.
|
2010-04-17 15:26:15 +00:00
|
|
|
SDValue ConvertToMemOperand(SDValue Op, SelectionDAG &DAG,
|
|
|
|
DebugLoc dl) const;
|
2008-11-19 11:00:54 +00:00
|
|
|
|
2009-01-13 19:18:47 +00:00
|
|
|
// This function checks if we need to put an operand of an operation on
|
|
|
|
// stack and generate a load or not.
|
2009-12-23 11:19:09 +00:00
|
|
|
// DAG parameter is required to access DAG information during
|
|
|
|
// analysis.
|
2010-04-17 15:26:15 +00:00
|
|
|
bool NeedToConvertToMemOp(SDValue Op, unsigned &MemOp,
|
|
|
|
SelectionDAG &DAG) const;
|
2009-01-13 19:18:47 +00:00
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
/// Subtarget - Keep a pointer to the PIC16Subtarget around so that we can
|
|
|
|
/// make the right decision when generating code for different targets.
|
|
|
|
const PIC16Subtarget *Subtarget;
|
2009-01-13 19:18:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Extending the LIB Call framework of LLVM
|
2009-04-02 17:42:00 +00:00
|
|
|
// to hold the names of PIC16Libcalls.
|
2009-01-21 05:44:05 +00:00
|
|
|
const char *PIC16LibcallNames[PIC16ISD::PIC16UnknownCall];
|
2009-01-13 19:18:47 +00:00
|
|
|
|
2009-04-02 17:42:00 +00:00
|
|
|
// To set and retrieve the lib call names.
|
2009-01-21 05:44:05 +00:00
|
|
|
void setPIC16LibcallName(PIC16ISD::PIC16Libcall Call, const char *Name);
|
2010-04-17 15:26:15 +00:00
|
|
|
const char *getPIC16LibcallName(PIC16ISD::PIC16Libcall Call) const;
|
2009-01-13 19:18:47 +00:00
|
|
|
|
2009-04-02 17:42:00 +00:00
|
|
|
// Make PIC16 Libcall.
|
2009-08-10 22:56:29 +00:00
|
|
|
SDValue MakePIC16Libcall(PIC16ISD::PIC16Libcall Call, EVT RetVT,
|
2009-01-13 19:18:47 +00:00
|
|
|
const SDValue *Ops, unsigned NumOps, bool isSigned,
|
2010-04-17 15:26:15 +00:00
|
|
|
SelectionDAG &DAG, DebugLoc dl) const;
|
2009-01-13 19:18:47 +00:00
|
|
|
|
|
|
|
// Check if operation has a direct load operand.
|
2010-04-17 15:26:15 +00:00
|
|
|
inline bool isDirectLoad(const SDValue Op) const;
|
2008-05-13 09:02:57 +00:00
|
|
|
};
|
|
|
|
} // namespace llvm
|
|
|
|
|
|
|
|
#endif // PIC16ISELLOWERING_H
|