LLVM  8.0.1
Macros | Functions
MSP430ISelLowering.cpp File Reference
#include "MSP430ISelLowering.h"
#include "MSP430.h"
#include "MSP430MachineFunctionInfo.h"
#include "MSP430Subtarget.h"
#include "MSP430TargetMachine.h"
#include "llvm/CodeGen/CallingConvLower.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/SelectionDAGISel.h"
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "MSP430GenCallingConv.inc"
Include dependency graph for MSP430ISelLowering.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "msp430-lower"
 

Functions

template<typename ArgT >
static void ParseFunctionArgs (const SmallVectorImpl< ArgT > &Args, SmallVectorImpl< unsigned > &Out)
 For each argument in a function store the number of pieces it is composed of. More...
 
static void AnalyzeVarArgs (CCState &State, const SmallVectorImpl< ISD::OutputArg > &Outs)
 
static void AnalyzeVarArgs (CCState &State, const SmallVectorImpl< ISD::InputArg > &Ins)
 
template<typename ArgT >
static void AnalyzeArguments (CCState &State, SmallVectorImpl< CCValAssign > &ArgLocs, const SmallVectorImpl< ArgT > &Args)
 Analyze incoming and outgoing function arguments. More...
 
static void AnalyzeRetResult (CCState &State, const SmallVectorImpl< ISD::InputArg > &Ins)
 
static void AnalyzeRetResult (CCState &State, const SmallVectorImpl< ISD::OutputArg > &Outs)
 
template<typename ArgT >
static void AnalyzeReturnValues (CCState &State, SmallVectorImpl< CCValAssign > &RVLocs, const SmallVectorImpl< ArgT > &Args)
 
static SDValue EmitCMP (SDValue &LHS, SDValue &RHS, SDValue &TargetCC, ISD::CondCode CC, const SDLoc &dl, SelectionDAG &DAG)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "msp430-lower"

Definition at line 39 of file MSP430ISelLowering.cpp.

Function Documentation

◆ AnalyzeArguments()

template<typename ArgT >
static void AnalyzeArguments ( CCState State,
SmallVectorImpl< CCValAssign > &  ArgLocs,
const SmallVectorImpl< ArgT > &  Args 
)
static

Analyze incoming and outgoing function arguments.

We need custom C++ code to handle special constraints in the ABI like reversing the order of the pieces of splitted arguments. In addition, all pieces of a certain argument have to be passed either using registers or the stack but never mixing both.

Definition at line 438 of file MSP430ISelLowering.cpp.

References llvm::CCState::addLoc(), llvm::CCValAssign::AExt, llvm::CCState::AllocateReg(), AnalyzeVarArgs(), llvm::array_lengthof(), assert(), llvm::CCValAssign::Full, llvm::CCState::getCallingConv(), llvm::CCValAssign::getReg(), llvm::CCState::HandleByVal(), llvm::MVT::i16, llvm::MVT::i8, llvm::ISD::ArgFlagsTy::isByVal(), llvm::ISD::ArgFlagsTy::isSExt(), llvm::CCState::isVarArg(), llvm::ISD::ArgFlagsTy::isZExt(), llvm::CallingConv::MSP430_BUILTIN, ParseFunctionArgs(), Reg, llvm::CCValAssign::SExt, llvm::SmallVectorBase::size(), and llvm::CCValAssign::ZExt.

Referenced by llvm::CCState::AnalyzeArgumentsSecondPass(), and AnalyzeReturnValues().

◆ AnalyzeRetResult() [1/2]

static void AnalyzeRetResult ( CCState State,
const SmallVectorImpl< ISD::InputArg > &  Ins 
)
static

Definition at line 532 of file MSP430ISelLowering.cpp.

References llvm::CCState::AnalyzeCallResult().

Referenced by AnalyzeReturnValues().

◆ AnalyzeRetResult() [2/2]

static void AnalyzeRetResult ( CCState State,
const SmallVectorImpl< ISD::OutputArg > &  Outs 
)
static

Definition at line 537 of file MSP430ISelLowering.cpp.

References llvm::CCState::AnalyzeReturn().

◆ AnalyzeReturnValues()

template<typename ArgT >
static void AnalyzeReturnValues ( CCState State,
SmallVectorImpl< CCValAssign > &  RVLocs,
const SmallVectorImpl< ArgT > &  Args 
)
static

Definition at line 543 of file MSP430ISelLowering.cpp.

References llvm::ISD::ADD, llvm::MachineRegisterInfo::addLiveIn(), llvm::CCValAssign::AExt, AnalyzeArguments(), AnalyzeRetResult(), llvm::ISD::ANY_EXTEND, Arg, assert(), llvm::ISD::AssertSext, llvm::ISD::AssertZext, llvm::CallingConv::C, llvm::MSP430ISD::CALL, llvm::TargetLowering::CallLoweringInfo::CallConv, Callee, llvm::TargetLowering::CallLoweringInfo::Callee, llvm::TargetLowering::CallLoweringInfo::Chain, llvm::CCState::CheckReturn(), Context, llvm::MachineFrameInfo::CreateFixedObject(), llvm::MachineRegisterInfo::createVirtualRegister(), llvm::TargetLowering::CallLoweringInfo::DAG, llvm::TargetLowering::CallLoweringInfo::DL, E, llvm::SmallVectorBase::empty(), llvm::errs(), llvm::CallingConv::Fast, first, llvm::CCValAssign::Full, G, llvm::ISD::ArgFlagsTy::getByValAlign(), llvm::ISD::ArgFlagsTy::getByValSize(), llvm::SelectionDAG::getCALLSEQ_END(), llvm::SelectionDAG::getCALLSEQ_START(), llvm::SelectionDAG::getConstant(), llvm::SelectionDAG::getContext(), llvm::SelectionDAG::getCopyFromReg(), llvm::SelectionDAG::getCopyToReg(), llvm::SelectionDAG::getDataLayout(), llvm::SelectionDAG::getEntryNode(), llvm::EVT::getEVTString(), llvm::MachinePointerInfo::getFixedStack(), llvm::SelectionDAG::getFrameIndex(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getInfo(), llvm::SelectionDAG::getIntPtrConstant(), llvm::SelectionDAG::getLoad(), llvm::CCValAssign::getLocInfo(), llvm::CCValAssign::getLocMemOffset(), llvm::CCValAssign::getLocReg(), llvm::CCValAssign::getLocVT(), llvm::SelectionDAG::getMachineFunction(), llvm::SelectionDAG::getMemcpy(), llvm::SDValue::getNode(), llvm::SelectionDAG::getNode(), llvm::TargetLoweringBase::getPointerTy(), llvm::TargetLoweringBase::getRegClassFor(), llvm::MachineFunction::getRegInfo(), llvm::SelectionDAG::getRegister(), llvm::EVT::getSimpleVT(), llvm::MVT::getSizeInBits(), llvm::MSP430MachineFunctionInfo::getSRetReturnReg(), llvm::SelectionDAG::getStore(), llvm::SelectionDAG::getTargetExternalSymbol(), llvm::SelectionDAG::getTargetGlobalAddress(), llvm::SDValue::getValue(), llvm::SelectionDAG::getValueType(), llvm::CCValAssign::getValVT(), llvm::SelectionDAG::getVTList(), llvm::MVT::Glue, llvm::Function::hasStructRetAttr(), llvm::MVT::i16, llvm::MipsISD::Ins, llvm::TargetLowering::CallLoweringInfo::Ins, llvm::ISD::ArgFlagsTy::isByVal(), llvm::CCValAssign::isMemLoc(), llvm::CCValAssign::isRegLoc(), llvm::TargetLowering::CallLoweringInfo::IsTailCall, llvm::TargetLowering::CallLoweringInfo::IsVarArg, llvm_unreachable, llvm::CallingConv::MSP430_BUILTIN, llvm::CallingConv::MSP430_INTR, llvm::MVT::Other, llvm::TargetLowering::CallLoweringInfo::Outs, llvm::TargetLowering::CallLoweringInfo::OutVals, llvm::SmallVectorTemplateBase< T >::push_back(), Reg, llvm::report_fatal_error(), llvm::MSP430ISD::RET_FLAG, llvm::MSP430ISD::RETI_FLAG, second, llvm::MSP430MachineFunctionInfo::setSRetReturnReg(), llvm::MSP430MachineFunctionInfo::setVarArgsFrameIndex(), llvm::CCValAssign::SExt, llvm::ISD::SIGN_EXTEND, llvm::MVT::SimpleTy, llvm::SmallVectorBase::size(), llvm::ISD::TokenFactor, llvm::ISD::TRUNCATE, llvm::ISD::ZERO_EXTEND, and llvm::CCValAssign::ZExt.

◆ AnalyzeVarArgs() [1/2]

static void AnalyzeVarArgs ( CCState State,
const SmallVectorImpl< ISD::OutputArg > &  Outs 
)
static

Definition at line 423 of file MSP430ISelLowering.cpp.

References llvm::CCState::AnalyzeCallOperands().

Referenced by AnalyzeArguments().

◆ AnalyzeVarArgs() [2/2]

static void AnalyzeVarArgs ( CCState State,
const SmallVectorImpl< ISD::InputArg > &  Ins 
)
static

Definition at line 428 of file MSP430ISelLowering.cpp.

References llvm::CCState::AnalyzeFormalArguments().

◆ EmitCMP()

static SDValue EmitCMP ( SDValue LHS,
SDValue RHS,
SDValue TargetCC,
ISD::CondCode  CC,
const SDLoc dl,
SelectionDAG DAG 
)
static

◆ ParseFunctionArgs()

template<typename ArgT >
static void ParseFunctionArgs ( const SmallVectorImpl< ArgT > &  Args,
SmallVectorImpl< unsigned > &  Out 
)
static

For each argument in a function store the number of pieces it is composed of.

Definition at line 403 of file MSP430ISelLowering.cpp.

References Arg, llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorBase::empty(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().

Referenced by AnalyzeArguments().