Go to the documentation of this file.
60 virtual const TargetInstrInfo*
getInstrInfo()
const override;
65 const Function& F)
const override;
66 virtual const TargetSubtargetInfo*
getSubtarget()
const override;
83 return TCE::KLUDGE_REGISTER;
90 virtual const std::string*
adfXML()
override {
101 virtual std::string
rfName(
unsigned dwarfRegNum)
override;
102 virtual unsigned registerIndex(
unsigned dwarfRegNum)
override;
108 return TCE::NoRegister;
113 virtual std::string
operationName(
unsigned opc)
const override;
115 const std::string& opName)
const override;
131 virtual bool hasSDIV()
const override;
132 virtual bool hasUDIV()
const override;
133 virtual bool hasSREM()
const override;
134 virtual bool hasUREM()
const override;
135 virtual bool hasMUL()
const override;
136 virtual bool hasROTL()
const override;
137 virtual bool hasROTR()
const override;
138 virtual bool hasSXHW()
const override;
139 virtual bool hasSXQW()
const override;
140 virtual bool hasSQRTF()
const override;
141 virtual bool hasSHR()
const override;
142 virtual bool hasSHL()
const override;
143 virtual bool hasSHRU()
const override;
150 llvm::MachineInstr& i,
151 llvm::SmallVectorImpl<llvm::MachineOperand>& cond)
const override;
155 virtual int getLoad(
const TargetRegisterClass *rc)
const override;
156 virtual int getStore(
const TargetRegisterClass *rc)
const override;
158 virtual int getMinOpcode(llvm::SDNode* n)
const override;
159 virtual int getMaxOpcode(llvm::SDNode* n)
const override;
164 const llvm::TargetRegisterClass* current)
const override;
167 const llvm::TargetRegisterClass* current)
const override;
179 virtual bool is64bit()
const override;
186 int offset)
const override;
207 #include "Backend.inc"
283 const TargetInstrInfo*
291 const TargetRegisterInfo*
299 const TargetFrameLowering*
314 assert(
lowering_ != NULL &&
"TCETargetMachine has not registered to plugin.");
318 const TargetSubtargetInfo*
338 if (mi.getDesc().getOpcode() == TCE::COPY) {
339 assert(mi.getNumOperands() >= 2);
340 const MachineOperand& src = mi.getOperand(1);
341 int subreg = src.getSubReg();
342 if (subreg > 0 && subreg < 9) {
350 std::map<unsigned int, unsigned int>::const_iterator i =
truePredOps_.find(opc);
359 std::map<unsigned int, unsigned int>::const_iterator i =
falsePredOps_.find(opc);
377 const std::string
MOVE =
"MOVE";
378 const std::string PSEUDO =
"PSEUDO";
379 const std::string
NOP =
"NOP";
380 const std::string INLINEASM =
"INLINEASM";
381 const std::string DEBUG_LABEL =
"DEBUG_LABEL";
382 const std::string DEBUG_VALUE =
"DEBUG_VALUE";
383 const std::string DEBUG_INSTR_REF =
"DEBUG_INSTR_REF";
384 const std::string DEBUG_VALUE_LIST =
"DEBUG_VALUE_LIST";
385 const std::string DEBUG_PHI =
"DEBUG_PHI";
387 if (opc == TCE::IMPLICIT_DEF)
return PSEUDO;
388 else if (opc == TCE::ADJCALLSTACKDOWN)
return PSEUDO;
389 else if (opc == TCE::ADJCALLSTACKUP)
return PSEUDO;
391 if (opc == TCE::DBG_VALUE)
return DEBUG_VALUE;
392 if (opc == TCE::DBG_INSTR_REF)
return DEBUG_INSTR_REF;
393 if (opc == TCE::DBG_LABEL)
return DEBUG_LABEL;
394 if (opc == TCE::DBG_VALUE_LIST)
return DEBUG_VALUE_LIST;
395 if (opc == TCE::DBG_PHI)
return DEBUG_PHI;
397 if (opc == TCE::COPY)
return MOVE;
398 if (opc == TCE::MOVI1rr)
return MOVE;
399 if (opc == TCE::PRED_TRUE_MOVI1rr)
return "?MOVE";
400 if (opc == TCE::PRED_FALSE_MOVI1rr)
return "!MOVE";
401 if (opc == TCE::MOVI1ri)
return MOVE;
402 if (opc == TCE::PRED_TRUE_MOVI1ri)
return "?MOVE";
403 if (opc == TCE::PRED_FALSE_MOVI1ri)
return "!MOVE";
404 if (opc == TCE::MOVGri)
return MOVE;
405 if (opc == TCE::MOVI32rr)
return MOVE;
406 if (opc == TCE::PRED_TRUE_MOVI32rr)
return "?MOVE";
407 if (opc == TCE::PRED_FALSE_MOVI32rr)
return "!MOVE";
408 if (opc == TCE::MOVI32ri)
return MOVE;
409 if (opc == TCE::PRED_TRUE_MOVI32ri)
return "?MOVE";
410 if (opc == TCE::PRED_FALSE_MOVI32ri)
return "!MOVE";
411 if (opc == TCE::MOVI64sa)
return MOVE;
412 if (opc == TCE::PRED_TRUE_MOVI64sa)
return "?MOVE";
413 if (opc == TCE::PRED_FALSE_MOVI64sa)
return "!MOVE";
414 if (opc == TCE::MOV64ss)
return MOVE;
415 if (opc == TCE::PRED_TRUE_MOV64ss)
return "?MOVE";
416 if (opc == TCE::PRED_FALSE_MOV64ss)
return "!MOVE";
417 if (opc == TCE::MOVI64I1ss)
return MOVE;
420 if (opc == TCE::MOVff)
return MOVE;
421 if (opc == TCE::MOVfi)
return MOVE;
422 if (opc == TCE::MOVfk)
return MOVE;
423 if (opc == TCE::MOVI32I1rr)
return MOVE;
424 if (opc == TCE::MOVFI32rf)
return MOVE;
425 if (opc == TCE::MOVIF32fr)
return MOVE;
426 if (opc == TCE::MOVGrr)
return MOVE;
427 if (opc == TCE::MOVGI32rr)
return MOVE;
428 if (opc == TCE::MOVI32Grr)
return MOVE;
429 if (opc == TCE::MOVGI1rr)
return MOVE;
430 if (opc == TCE::MOVI1Grr)
return MOVE;
431 if (opc == TCE::MOVhh)
return MOVE;
432 if (opc == TCE::MOVhk)
return MOVE;
433 if (opc == TCE::MOVrh)
return MOVE;
434 if (opc == TCE::MOVhr)
return MOVE;
435 if (opc == TCE::MOVhi)
return MOVE;
436 if (opc == TCE::MOVsd)
return MOVE;
437 if (opc == TCE::MOVds)
return MOVE;
443 if (opc == TCE::MOVI1I32rr)
return MOVE;
445 if (opc == TCE::INLINEASM)
return INLINEASM;
449 if (opc == TCE::ADDfri || opc == TCE::ADDhri)
return "add";
451 if (opc == TCE::SUBfir || opc == TCE::SUBfri || opc == TCE::SUBhir ||
452 opc == TCE::SUBhri)
return "sub";
454 if (opc == TCE::SUBfir)
return "sub";
455 if (opc == TCE::SUBfri)
return "sub";
458 if (opc == TCE::ANDext)
return "and64";
459 if (opc == TCE::XORbicmp)
return "xor64";
461 if (opc == TCE::ANDext)
return "and";
462 if (opc == TCE::XORbicmp)
return "xor";
466 if (opc == TCE::STQBrb)
return "stq";
467 if (opc == TCE::STQBib)
return "stq";
468 if (opc == TCE::STQBrj)
return "stq";
469 if (opc == TCE::STQBij)
return "stq";
471 if (opc == TCE::ST8Brb)
return "st8";
472 if (opc == TCE::ST8Bib)
return "st8";
473 if (opc == TCE::ST8Brj)
return "st8";
474 if (opc == TCE::ST8Bij)
return "st8";
478 if (opc == TCE::ST64RAss)
return "st64";
479 if (opc == TCE::LD64RAs)
return "ld64";
481 if (opc == TCE::STWRArr)
return "stw";
482 if (opc == TCE::LDWRAr)
return "ldw";
483 if (opc == TCE::ST32RArr)
return "st32";
484 if (opc == TCE::LD32RAr)
return "ld32";
486 if (opc == TCE::TCEBR)
return "jump";
487 if (opc == TCE::TCEBRIND)
return "jump";
489 if (opc == TCE::CALL_MEMrr)
return "call";
490 if (opc == TCE::CALL_MEMri)
return "call";
492 std::map<unsigned int, TCEString>::const_iterator opNameIt;
494 std::map<unsigned int, TCEString>::const_iterator i =
opNames_.find(opc);
496 std::cerr <<
"ERROR: Couldn't find operation with opc: " << opc
498 std::cerr <<
"Total ops: " <<
opNames_.size() << std::endl;
513 #include "TCEGenRegisterInfo.inc"
526 const llvm::TargetRegisterClass*
528 unsigned nodeId,
const llvm::TargetRegisterClass* current)
const {
540 const llvm::TargetRegisterClass*
542 const llvm::TargetRegisterClass* current)
const {
555 return "BYPASS_PSEUDO";
virtual unsigned spDRegNum() override
Returns ID number of the stack pointer register.
virtual bool hasUDIV() const override
virtual unsigned registerIndex(unsigned dwarfRegNum) override
TCESubtarget * subTarget_
virtual bool validStackAccessOperation(const std::string &opName) const override
Returns true if OSAL operation is valid for stack accesses.
virtual bool hasSXQW() const override
virtual bool has16bitLoads() const override
virtual ~GeneratedTCEPlugin()
virtual bool hasSREM() const override
virtual int getAddOpcode(const EVT &vt) const override
virtual bool hasSHR() const override
virtual int getStore(const TargetRegisterClass *rc) const override
static void setADFString(std::string adfXML)
virtual TargetLowering * getTargetLowering() const override
virtual void registerTargetMachine(TCETargetMachine &tm) override
Plugin needs target machine for TragetLowering generation.
virtual bool hasUREM() const override
virtual const TargetInstrInfo * getInstrInfo() const override
virtual bool hasSQRTF() const override
virtual bool hasSHL() const override
virtual int getTruePredicateOpcode(unsigned opc) const override
void LLVMInitializeTCEStubTarget()
virtual bool hasOperation(TCEString operationName) const override
Returns true in case the target supports the given osal operation.
virtual int getMaxOpcode(llvm::SDNode *n) const override
void delete_tce_backend_plugin(TCETargetMachinePlugin *target)
std::map< unsigned, TCEString > regNames_
virtual std::string operationName(unsigned opc) const override
#define assert(condition)
std::map< unsigned, TCEString > opNames_
virtual int getMaxuOpcode(llvm::SDNode *n) const override
virtual unsigned opcode(TCEString operationName) const override
Returns the opcode for the given osal operation, undefined if not found.
class TCEPluginInitializer myPlugin
virtual bool hasROTL() const override
virtual bool isLittleEndian() const override
virtual bool hasSDIV() const override
std::map< TCEString, unsigned > ttallvmRegMap_
Map for TTA register to LLVM register id conversion.
virtual void manualInitialize()
FunctionPass * createTCEISelDag(TCETargetMachine &tm)
virtual const std::string * adfXML() override
Returns pointer to xml string of the target machine .adf.
virtual const TargetRegisterInfo * getRegisterInfo() const override
TargetFrameLowering * frameInfo_
virtual unsigned rvHighDRegNum() override
virtual int getIorOpcode(const EVT &vt) const override
std::string dataASName() override
Returns name of the data address space.
virtual TargetTransformInfo getTargetTransformInfo(const Function &F) const override
virtual unsigned fpDRegNum() override
Returns ID number of the frame pointer register.
virtual FunctionPass * createISelPass(TCETargetMachine *tm) override
virtual int getFalsePredicateOpcode(unsigned opc) const override
std::map< unsigned, unsigned > truePredOps_
virtual MVT::SimpleValueType getDefaultType() const override
unsigned llvmRegisterId(const TCEString &ttaRegister) override
virtual int getLoadOpcode(const EVT &vt) const override
TargetLowering * lowering_
virtual unsigned rvDRegNum() override
virtual const TargetSubtargetInfo * getSubtarget() const override
virtual std::vector< unsigned > getParamDRegNums() const override
virtual int getMinOpcode(llvm::SDNode *n) const override
TCETargetMachinePlugin * create_tce_backend_plugin()
virtual int maxVectorSize() const override
virtual std::tuple< int, int > getPointerAdjustment(int offset) const override
virtual int getLoad(const TargetRegisterClass *rc) const override
virtual bool analyzeCCBranch(llvm::MachineInstr &i, llvm::SmallVectorImpl< llvm::MachineOperand > &cond) const override
unsigned int raPortDRegNum() override
Returns ID number of the return address register.
virtual bool hasSXHW() const override
void LLVMInitializeTCETargetInfo()
virtual std::vector< unsigned > getVectorRVDRegNums() const override
virtual const llvm::TargetRegisterClass * nodeRegClass(unsigned nodeId, const llvm::TargetRegisterClass *current) const override
virtual std::string rfName(unsigned dwarfRegNum) override
virtual bool canMaterializeConstant(const ConstantInt &ci) const override
virtual bool hasMUL() const override
unsigned stackAlignment() const
virtual int getShlOpcode(const EVT &vt) const override
virtual int getMinuOpcode(llvm::SDNode *n) const override
TCETools::CIStringSet validStackAccessOperations_
Set of valid LLVM opcodes for stack accesses.
std::map< unsigned, unsigned > regIndices_
std::map< unsigned, unsigned > falsePredOps_
virtual bool hasROTR() const override
virtual const TargetFrameLowering * getFrameLowering() const override
virtual bool has8bitLoads() const override
unsigned int extractElementLane(const llvm::MachineInstr &) const override
virtual bool is64bit() const override
TCEInstrInfo * instrInfo_
Target machine instruction info for the llvm framework.
virtual bool hasSHRU() const override
virtual const llvm::TargetRegisterClass * extrasRegClass(const llvm::TargetRegisterClass *current) const override