OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
llvm::GeneratedTCEPlugin Class Reference
Inheritance diagram for llvm::GeneratedTCEPlugin:
Inheritance graph
Collaboration diagram for llvm::GeneratedTCEPlugin:
Collaboration graph

Public Member Functions

 GeneratedTCEPlugin ()
 
virtual ~GeneratedTCEPlugin ()
 
virtual const TargetInstrInfo * getInstrInfo () const override
 
virtual const TargetRegisterInfo * getRegisterInfo () const override
 
virtual const TargetFrameLowering * getFrameLowering () const override
 
virtual TargetLowering * getTargetLowering () const override
 
virtual TargetTransformInfo getTargetTransformInfo (const Function &F) const override
 
virtual const TargetSubtargetInfo * getSubtarget () const override
 
virtual FunctionPass * createISelPass (TCETargetMachine *tm) override
 
virtual unsigned spDRegNum () override
 Returns ID number of the stack pointer register.
 
virtual unsigned fpDRegNum () override
 Returns ID number of the frame pointer register.
 
virtual unsigned rvDRegNum () override
 
virtual unsigned rvHighDRegNum () override
 
virtual std::vector< unsigned > getParamDRegNums () const override
 
virtual std::vector< unsigned > getVectorRVDRegNums () const override
 
virtual MVT::SimpleValueType getDefaultType () const override
 
virtual std::string rfName (unsigned dwarfRegNum) override
 
virtual unsigned registerIndex (unsigned dwarfRegNum) override
 
unsigned llvmRegisterId (const TCEString &ttaRegister) override
 
unsigned int extractElementLane (const llvm::MachineInstr &) const override
 
virtual std::string operationName (unsigned opc) const override
 
virtual bool validStackAccessOperation (const std::string &opName) const override
 Returns true if OSAL operation is valid for stack accesses.
 
virtual bool hasOperation (TCEString operationName) const override
 Returns true in case the target supports the given osal operation.
 
virtual unsigned opcode (TCEString operationName) const override
 Returns the opcode for the given osal operation, undefined if not found.
 
virtual int getTruePredicateOpcode (unsigned opc) const override
 
virtual int getFalsePredicateOpcode (unsigned opc) const override
 
unsigned int raPortDRegNum () override
 Returns ID number of the return address register.
 
std::string dataASName () override
 Returns name of the data address space.
 
virtual bool hasSDIV () const override
 
virtual bool hasUDIV () const override
 
virtual bool hasSREM () const override
 
virtual bool hasUREM () const override
 
virtual bool hasMUL () const override
 
virtual bool hasROTL () const override
 
virtual bool hasROTR () const override
 
virtual bool hasSXHW () const override
 
virtual bool hasSXQW () const override
 
virtual bool hasSQRTF () const override
 
virtual bool hasSHR () const override
 
virtual bool hasSHL () const override
 
virtual bool hasSHRU () const override
 
virtual bool has8bitLoads () const override
 
virtual bool has16bitLoads () const override
 
virtual int maxVectorSize () const override
 
virtual bool analyzeCCBranch (llvm::MachineInstr &i, llvm::SmallVectorImpl< llvm::MachineOperand > &cond) const override
 
virtual void registerTargetMachine (TCETargetMachine &tm) override
 Plugin needs target machine for TragetLowering generation.
 
virtual int getLoad (const TargetRegisterClass *rc) const override
 
virtual int getStore (const TargetRegisterClass *rc) const override
 
virtual int getMinOpcode (llvm::SDNode *n) const override
 
virtual int getMaxOpcode (llvm::SDNode *n) const override
 
virtual int getMinuOpcode (llvm::SDNode *n) const override
 
virtual int getMaxuOpcode (llvm::SDNode *n) const override
 
virtual const llvm::TargetRegisterClass * extrasRegClass (const llvm::TargetRegisterClass *current) const override
 
virtual const llvm::TargetRegisterClass * nodeRegClass (unsigned nodeId, const llvm::TargetRegisterClass *current) const override
 
virtual int getLoadOpcode (const EVT &vt) const override
 
virtual int getAddOpcode (const EVT &vt) const override
 
virtual int getShlOpcode (const EVT &vt) const override
 
virtual int getIorOpcode (const EVT &vt) const override
 
virtual bool isLittleEndian () const override
 
virtual bool is64bit () const override
 
virtual bool canMaterializeConstant (const ConstantInt &ci) const override
 
virtual std::tuple< int, int > getPointerAdjustment (int offset) const override
 
virtual void manualInitialize ()
 
- Public Member Functions inherited from llvm::TCETargetMachinePlugin
 TCETargetMachinePlugin ()
 
virtual ~TCETargetMachinePlugin ()
 
virtual unsigned int extractElementLane (const MachineInstr &mi) const =0
 
virtual int getLoadOpcode (const llvm::EVT &vt) const =0
 
virtual int getAddOpcode (const llvm::EVT &vt) const =0
 
virtual int getShlOpcode (const llvm::EVT &vt) const =0
 
virtual int getIorOpcode (const llvm::EVT &vt) const =0
 
virtual const DataLayout * getDataLayout () const
 
virtual DataLayout * getDataLayout ()
 
virtual TCETargetMachinegetCurrentTargetMachine ()
 
virtual const TCETargetMachinegetCurrentTargetMachine () const
 
virtual const SelectionDAGTargetInfo * getSelectionDAGInfo () const
 

Private Member Functions

void initialize ()
 

Private Attributes

std::map< unsigned, TCEStringopNames_
 
std::map< unsigned, unsigned > truePredOps_
 
std::map< unsigned, unsigned > falsePredOps_
 
std::map< unsigned, TCEStringregNames_
 
std::map< unsigned, unsigned > regIndices_
 
std::map< TCEString, unsigned > ttallvmRegMap_
 Map for TTA register to LLVM register id conversion.
 
TCETools::CIStringSet validStackAccessOperations_
 Set of valid LLVM opcodes for stack accesses.
 
std::string dataASName_
 

Additional Inherited Members

- Protected Attributes inherited from llvm::TCETargetMachinePlugin
TCEInstrInfoinstrInfo_
 Target machine instruction info for the llvm framework.
 
TargetLowering * lowering_
 
TargetFrameLowering * frameInfo_
 
TCETargetMachinetm_
 
TCESubtargetsubTarget_
 
DataLayout dl_
 
SelectionDAGTargetInfo tsInfo_
 

Detailed Description

Definition at line 56 of file TCETargetMachinePlugin.cc.

Constructor & Destructor Documentation

◆ GeneratedTCEPlugin()

GeneratedTCEPlugin::GeneratedTCEPlugin ( )

The Constructor.

Definition at line 223 of file TCETargetMachinePlugin.cc.

References llvm::TCETargetMachinePlugin::lowering_.

◆ ~GeneratedTCEPlugin()

GeneratedTCEPlugin::~GeneratedTCEPlugin ( )
virtual

The Destructor.

Definition at line 232 of file TCETargetMachinePlugin.cc.

232 {
233 delete instrInfo_;
234 if (lowering_ != NULL) {
235 delete lowering_;
236 lowering_ = NULL;
237 }
238}
TCEInstrInfo * instrInfo_
Target machine instruction info for the llvm framework.

References llvm::TCETargetMachinePlugin::instrInfo_, and llvm::TCETargetMachinePlugin::lowering_.

Member Function Documentation

◆ analyzeCCBranch()

virtual bool llvm::GeneratedTCEPlugin::analyzeCCBranch ( llvm::MachineInstr &  i,
llvm::SmallVectorImpl< llvm::MachineOperand > &  cond 
) const
overridevirtual

Reimplemented from llvm::TCETargetMachinePlugin.

◆ canMaterializeConstant()

virtual bool llvm::GeneratedTCEPlugin::canMaterializeConstant ( const ConstantInt &  ci) const
overridevirtual

◆ createISelPass()

FunctionPass * GeneratedTCEPlugin::createISelPass ( TCETargetMachine tm)
overridevirtual

Creates instruction selector for TCE target machine.

Implements llvm::TCETargetMachinePlugin.

Definition at line 320 of file TCETargetMachinePlugin.cc.

320 {
321 return createTCEISelDag(*tm);
322}
FunctionPass * createTCEISelDag(TCETargetMachine &tm)

References llvm::createTCEISelDag().

Here is the call graph for this function:

◆ dataASName()

std::string GeneratedTCEPlugin::dataASName ( )
overridevirtual

Returns name of the data address space.

Implements llvm::TCETargetMachinePlugin.

Definition at line 566 of file TCETargetMachinePlugin.cc.

566 {
567 return dataASName_;
568}

References dataASName_.

◆ extractElementLane()

unsigned int GeneratedTCEPlugin::extractElementLane ( const llvm::MachineInstr &  mi) const
override

Returns true in case the given opc is for an extract element operation.

Definition at line 329 of file TCETargetMachinePlugin.cc.

329 {
330 // TODO: use subregisters (extract_subreg) instead.
331 if (mi.getDesc().getOpcode() == TCE::COPY) {
332 assert(mi.getNumOperands() >= 2);
333 const MachineOperand& src = mi.getOperand(1);
334 int subreg = src.getSubReg();
335 if (subreg > 0 && subreg < 9) {
336 return subreg -1;
337 }
338 }
339 return UINT_MAX;
340}
#define assert(condition)

References assert.

◆ extrasRegClass()

const llvm::TargetRegisterClass * GeneratedTCEPlugin::extrasRegClass ( const llvm::TargetRegisterClass *  current) const
overridevirtual

Returns the specific register class representing registers belonging to the "extras node" inside a clustered-TTA.

Parameters
currentThe "more general" register class to replace.

Implements llvm::TCETargetMachinePlugin.

Definition at line 534 of file TCETargetMachinePlugin.cc.

535 {
536 const llvm::TargetRegisterInfo& TRI = *getRegisterInfo();
537
538 return NULL;
539}
virtual const TargetRegisterInfo * getRegisterInfo() const override

References getRegisterInfo().

Here is the call graph for this function:

◆ fpDRegNum()

virtual unsigned llvm::GeneratedTCEPlugin::fpDRegNum ( )
inlineoverridevirtual

Returns ID number of the frame pointer register.

Implements llvm::TCETargetMachinePlugin.

Definition at line 74 of file TCETargetMachinePlugin.cc.

74 {
75 return TCE::FP;
76 }

◆ getAddOpcode()

virtual int llvm::GeneratedTCEPlugin::getAddOpcode ( const EVT &  vt) const
overridevirtual

◆ getDefaultType()

virtual MVT::SimpleValueType llvm::GeneratedTCEPlugin::getDefaultType ( ) const
inlineoverridevirtual

Implements llvm::TCETargetMachinePlugin.

Definition at line 90 of file TCETargetMachinePlugin.cc.

90 {
91#ifdef TARGET64BIT
92 return MVT::i64;
93#else
94 return MVT::i32;
95#endif
96 }

◆ getFalsePredicateOpcode()

int GeneratedTCEPlugin::getFalsePredicateOpcode ( unsigned  opc) const
overridevirtual

Implements llvm::TCETargetMachinePlugin.

Definition at line 351 of file TCETargetMachinePlugin.cc.

351 {
352 std::map<unsigned int, unsigned int>::const_iterator i = falsePredOps_.find(opc);
353 if (i == falsePredOps_.end()) {
354 return -1;
355 } else {
356 return i->second;
357 }
358}
std::map< unsigned, unsigned > falsePredOps_

References falsePredOps_.

◆ getFrameLowering()

const TargetFrameLowering * GeneratedTCEPlugin::getFrameLowering ( ) const
overridevirtual

Returns TargetFrameInfo object for TCE target.

Implements llvm::TCETargetMachinePlugin.

Definition at line 293 of file TCETargetMachinePlugin.cc.

293 {
294 return frameInfo_;
295}

References llvm::TCETargetMachinePlugin::frameInfo_.

◆ getInstrInfo()

const TargetInstrInfo * GeneratedTCEPlugin::getInstrInfo ( ) const
overridevirtual

Returns TargetInstrInfo object for TCE target.

Implements llvm::TCETargetMachinePlugin.

Definition at line 277 of file TCETargetMachinePlugin.cc.

277 {
278 return instrInfo_;
279}

References llvm::TCETargetMachinePlugin::instrInfo_.

◆ getIorOpcode()

virtual int llvm::GeneratedTCEPlugin::getIorOpcode ( const EVT &  vt) const
overridevirtual

◆ getLoad()

virtual int llvm::GeneratedTCEPlugin::getLoad ( const TargetRegisterClass *  rc) const
overridevirtual

◆ getLoadOpcode()

virtual int llvm::GeneratedTCEPlugin::getLoadOpcode ( const EVT &  vt) const
overridevirtual

◆ getMaxOpcode()

virtual int llvm::GeneratedTCEPlugin::getMaxOpcode ( llvm::SDNode *  n) const
overridevirtual

◆ getMaxuOpcode()

virtual int llvm::GeneratedTCEPlugin::getMaxuOpcode ( llvm::SDNode *  n) const
overridevirtual

◆ getMinOpcode()

virtual int llvm::GeneratedTCEPlugin::getMinOpcode ( llvm::SDNode *  n) const
overridevirtual

◆ getMinuOpcode()

virtual int llvm::GeneratedTCEPlugin::getMinuOpcode ( llvm::SDNode *  n) const
overridevirtual

◆ getParamDRegNums()

virtual std::vector< unsigned > llvm::GeneratedTCEPlugin::getParamDRegNums ( ) const
overridevirtual

◆ getPointerAdjustment()

virtual std::tuple< int, int > llvm::GeneratedTCEPlugin::getPointerAdjustment ( int  offset) const
overridevirtual

◆ getRegisterInfo()

const TargetRegisterInfo * GeneratedTCEPlugin::getRegisterInfo ( ) const
overridevirtual

Returns TargetRegisterInfo object for TCE target.

Implements llvm::TCETargetMachinePlugin.

Definition at line 285 of file TCETargetMachinePlugin.cc.

285 {
286 return &(static_cast<TCEInstrInfo*>(instrInfo_))->getRegisterInfo();
287}

References llvm::TCEInstrInfo::getRegisterInfo(), and llvm::TCETargetMachinePlugin::instrInfo_.

Referenced by extrasRegClass(), and registerTargetMachine().

Here is the call graph for this function:

◆ getShlOpcode()

virtual int llvm::GeneratedTCEPlugin::getShlOpcode ( const EVT &  vt) const
overridevirtual

◆ getStore()

virtual int llvm::GeneratedTCEPlugin::getStore ( const TargetRegisterClass *  rc) const
overridevirtual

◆ getSubtarget()

const TargetSubtargetInfo * GeneratedTCEPlugin::getSubtarget ( ) const
overridevirtual

Implements llvm::TCETargetMachinePlugin.

Definition at line 312 of file TCETargetMachinePlugin.cc.

312 {
313 return subTarget_;
314}

References llvm::TCETargetMachinePlugin::subTarget_.

◆ getTargetLowering()

TargetLowering * GeneratedTCEPlugin::getTargetLowering ( ) const
overridevirtual

Returns TargetLowering object for TCE target.

Implements llvm::TCETargetMachinePlugin.

Definition at line 306 of file TCETargetMachinePlugin.cc.

306 {
307 assert(lowering_ != NULL && "TCETargetMachine has not registered to plugin.");
308 return lowering_;
309}

References assert, and llvm::TCETargetMachinePlugin::lowering_.

◆ getTargetTransformInfo()

TargetTransformInfo GeneratedTCEPlugin::getTargetTransformInfo ( const Function &  F) const
overridevirtual

Implements llvm::TCETargetMachinePlugin.

Definition at line 298 of file TCETargetMachinePlugin.cc.

298 {
299 return TargetTransformInfo(TCETTIImpl(tm_, F));
300}

References llvm::TCETargetMachinePlugin::tm_.

◆ getTruePredicateOpcode()

int GeneratedTCEPlugin::getTruePredicateOpcode ( unsigned  opc) const
overridevirtual

Implements llvm::TCETargetMachinePlugin.

Definition at line 342 of file TCETargetMachinePlugin.cc.

342 {
343 std::map<unsigned int, unsigned int>::const_iterator i = truePredOps_.find(opc);
344 if (i == truePredOps_.end()) {
345 return -1;
346 } else {
347 return i->second;
348 }
349}
std::map< unsigned, unsigned > truePredOps_

References truePredOps_.

◆ getVectorRVDRegNums()

virtual std::vector< unsigned > llvm::GeneratedTCEPlugin::getVectorRVDRegNums ( ) const
overridevirtual

◆ has16bitLoads()

virtual bool llvm::GeneratedTCEPlugin::has16bitLoads ( ) const
overridevirtual

◆ has8bitLoads()

virtual bool llvm::GeneratedTCEPlugin::has8bitLoads ( ) const
overridevirtual

◆ hasMUL()

virtual bool llvm::GeneratedTCEPlugin::hasMUL ( ) const
overridevirtual

◆ hasOperation()

virtual bool llvm::GeneratedTCEPlugin::hasOperation ( TCEString  operationName) const
inlineoverridevirtual

Returns true in case the target supports the given osal operation.

Implements llvm::TCETargetMachinePlugin.

Definition at line 113 of file TCETargetMachinePlugin.cc.

113 {
115 }
static bool containsValue(const MapType &aMap, const ValueType &aValue)
std::map< unsigned, TCEString > opNames_
virtual std::string operationName(unsigned opc) const override

References MapTools::containsValue(), operationName(), and opNames_.

Here is the call graph for this function:

◆ hasROTL()

virtual bool llvm::GeneratedTCEPlugin::hasROTL ( ) const
overridevirtual

◆ hasROTR()

virtual bool llvm::GeneratedTCEPlugin::hasROTR ( ) const
overridevirtual

◆ hasSDIV()

virtual bool llvm::GeneratedTCEPlugin::hasSDIV ( ) const
overridevirtual

◆ hasSHL()

virtual bool llvm::GeneratedTCEPlugin::hasSHL ( ) const
overridevirtual

◆ hasSHR()

virtual bool llvm::GeneratedTCEPlugin::hasSHR ( ) const
overridevirtual

◆ hasSHRU()

virtual bool llvm::GeneratedTCEPlugin::hasSHRU ( ) const
overridevirtual

◆ hasSQRTF()

virtual bool llvm::GeneratedTCEPlugin::hasSQRTF ( ) const
overridevirtual

◆ hasSREM()

virtual bool llvm::GeneratedTCEPlugin::hasSREM ( ) const
overridevirtual

◆ hasSXHW()

virtual bool llvm::GeneratedTCEPlugin::hasSXHW ( ) const
overridevirtual

◆ hasSXQW()

virtual bool llvm::GeneratedTCEPlugin::hasSXQW ( ) const
overridevirtual

◆ hasUDIV()

virtual bool llvm::GeneratedTCEPlugin::hasUDIV ( ) const
overridevirtual

◆ hasUREM()

virtual bool llvm::GeneratedTCEPlugin::hasUREM ( ) const
overridevirtual

◆ initialize()

void llvm::GeneratedTCEPlugin::initialize ( )
private

◆ is64bit()

virtual bool llvm::GeneratedTCEPlugin::is64bit ( ) const
overridevirtual

◆ isLittleEndian()

virtual bool llvm::GeneratedTCEPlugin::isLittleEndian ( ) const
overridevirtual

◆ llvmRegisterId()

unsigned llvm::GeneratedTCEPlugin::llvmRegisterId ( const TCEString ttaRegister)
inlineoverridevirtual

Returns LLVM register ID corresponding to TTA register name.

Parameters
ttaRegisterThe name of the TTA register. For example "RF.5".
Returns
The register number if it exists in the target. Otherwise, returns TCE::NoRegister.

Implements llvm::TCETargetMachinePlugin.

Definition at line 100 of file TCETargetMachinePlugin.cc.

100 {
101 if (ttallvmRegMap_.count(ttaRegister)) {
102 return ttallvmRegMap_[ttaRegister];
103 }
104 return TCE::NoRegister;
105 }
std::map< TCEString, unsigned > ttallvmRegMap_
Map for TTA register to LLVM register id conversion.

References ttallvmRegMap_.

◆ manualInitialize()

void GeneratedTCEPlugin::manualInitialize ( )
virtual

Definition at line 241 of file TCETargetMachinePlugin.cc.

241 {
242 initialize();
243}

References initialize().

Referenced by TCEPluginInitializer::TCEPluginInitializer().

Here is the call graph for this function:

◆ maxVectorSize()

virtual int llvm::GeneratedTCEPlugin::maxVectorSize ( ) const
overridevirtual

◆ nodeRegClass()

const llvm::TargetRegisterClass * GeneratedTCEPlugin::nodeRegClass ( unsigned  nodeId,
const llvm::TargetRegisterClass *  current 
) const
overridevirtual

Returns the specific register class representing registers belonging to a "computation node" inside a clustered-TTA.

This can be used to limit the registers to be allocated from a single node, thus also suggest scheduling the operations there. For data parallel code.

Parameters
nodeIdthe ID of the node (starting from 0)
currentThe "more general" register class to replace.

Implements llvm::TCETargetMachinePlugin.

Definition at line 520 of file TCETargetMachinePlugin.cc.

521 {
522
523 return NULL;
524}

◆ opcode()

virtual unsigned llvm::GeneratedTCEPlugin::opcode ( TCEString  operationName) const
inlineoverridevirtual

Returns the opcode for the given osal operation, undefined if not found.

Implements llvm::TCETargetMachinePlugin.

Definition at line 117 of file TCETargetMachinePlugin.cc.

117 {
119 }
static KeyType keyForValue(const MapType &aMap, const ValueType &aValue)

References MapTools::keyForValue(), operationName(), and opNames_.

Here is the call graph for this function:

◆ operationName()

std::string GeneratedTCEPlugin::operationName ( unsigned  opc) const
overridevirtual

Maps llvm target opcodes to target operation names.

Returns an empty string in case the operation code could not be mapped to an OSAL operation name. This is the case with pseudo ops, for example.

Implements llvm::TCETargetMachinePlugin.

Definition at line 368 of file TCETargetMachinePlugin.cc.

368 {
369
370 const std::string MOVE = "MOVE";
371 const std::string PSEUDO = "PSEUDO";
372 const std::string NOP = "NOP";
373 const std::string INLINEASM = "INLINEASM";
374 const std::string DEBUG_LABEL = "DEBUG_LABEL";
375 const std::string DEBUG_VALUE = "DEBUG_VALUE";
376 const std::string DEBUG_INSTR_REF = "DEBUG_INSTR_REF";
377 const std::string DEBUG_VALUE_LIST = "DEBUG_VALUE_LIST";
378 const std::string DEBUG_PHI = "DEBUG_PHI";
379
380 if (opc == TCE::IMPLICIT_DEF) return PSEUDO;
381 else if (opc == TCE::ADJCALLSTACKDOWN) return PSEUDO;
382 else if (opc == TCE::ADJCALLSTACKUP) return PSEUDO;
383 else if (opc == TCE::NOP) return NOP;
384 if (opc == TCE::DBG_VALUE) return DEBUG_VALUE;
385 if (opc == TCE::DBG_INSTR_REF) return DEBUG_INSTR_REF;
386 if (opc == TCE::DBG_LABEL) return DEBUG_LABEL;
387 if (opc == TCE::DBG_VALUE_LIST) return DEBUG_VALUE_LIST;
388 if (opc == TCE::DBG_PHI) return DEBUG_PHI;
389 // Moves
390 if (opc == TCE::COPY) return MOVE;
391 if (opc == TCE::MOVI1rr) return MOVE;
392 if (opc == TCE::PRED_TRUE_MOVI1rr) return "?MOVE";
393 if (opc == TCE::PRED_FALSE_MOVI1rr) return "!MOVE";
394 if (opc == TCE::MOVI1ri) return MOVE;
395 if (opc == TCE::PRED_TRUE_MOVI1ri) return "?MOVE";
396 if (opc == TCE::PRED_FALSE_MOVI1ri) return "!MOVE";
397 if (opc == TCE::MOVGri) return MOVE;
398 if (opc == TCE::MOVI32rr) return MOVE;
399 if (opc == TCE::PRED_TRUE_MOVI32rr) return "?MOVE";
400 if (opc == TCE::PRED_FALSE_MOVI32rr) return "!MOVE";
401 if (opc == TCE::MOVI32ri) return MOVE;
402 if (opc == TCE::PRED_TRUE_MOVI32ri) return "?MOVE";
403 if (opc == TCE::PRED_FALSE_MOVI32ri) return "!MOVE";
404 if (opc == TCE::MOVI64sa) return MOVE;
405 if (opc == TCE::PRED_TRUE_MOVI64sa) return "?MOVE";
406 if (opc == TCE::PRED_FALSE_MOVI64sa) return "!MOVE";
407 if (opc == TCE::MOV64ss) return MOVE;
408 if (opc == TCE::PRED_TRUE_MOV64ss) return "?MOVE";
409 if (opc == TCE::PRED_FALSE_MOV64ss) return "!MOVE";
410 if (opc == TCE::MOVI64I1ss) return MOVE;
411
412 // TODO: why no predicated version of this?
413 if (opc == TCE::MOVff) return MOVE;
414 if (opc == TCE::MOVfi) return MOVE;
415 if (opc == TCE::MOVfk) return MOVE;
416 if (opc == TCE::MOVI32I1rr) return MOVE;
417 if (opc == TCE::MOVFI32rf) return MOVE;
418 if (opc == TCE::MOVIF32fr) return MOVE;
419 if (opc == TCE::MOVGrr) return MOVE;
420 if (opc == TCE::MOVGI32rr) return MOVE;
421 if (opc == TCE::MOVI32Grr) return MOVE;
422 if (opc == TCE::MOVGI1rr) return MOVE;
423 if (opc == TCE::MOVI1Grr) return MOVE;
424 if (opc == TCE::MOVhh) return MOVE;
425 if (opc == TCE::MOVhk) return MOVE;
426 if (opc == TCE::MOVrh) return MOVE;
427 if (opc == TCE::MOVhr) return MOVE;
428 if (opc == TCE::MOVhi) return MOVE;
429 if (opc == TCE::MOVsd) return MOVE;
430 if (opc == TCE::MOVds) return MOVE;
431
432 // TODO: added as a spot fix for simd_operations_On,
433 // which selects this particular move operation.
434 // Most likely, the compiler can pick other moves not
435 // listed here, and subsequently crash.
436 if (opc == TCE::MOVI1I32rr) return MOVE;
437
438 if (opc == TCE::INLINEASM) return INLINEASM;
439
440/* TODO: 64-bit support missing here? */
441
442 if (opc == TCE::ADDfri || opc == TCE::ADDhri) return "add";
443
444 if (opc == TCE::SUBfir || opc == TCE::SUBfri || opc == TCE::SUBhir ||
445 opc == TCE::SUBhri) return "sub";
446
447 if (opc == TCE::SUBfir) return "sub";
448 if (opc == TCE::SUBfri) return "sub";
449
450#ifdef TARGET64BIT
451 if (opc == TCE::ANDext) return "and64";
452 if (opc == TCE::XORbicmp) return "xor64";
453#else
454 if (opc == TCE::ANDext) return "and";
455 if (opc == TCE::XORbicmp) return "xor";
456#endif
457
458
459 if (opc == TCE::STQBrb) return "stq";
460 if (opc == TCE::STQBib) return "stq";
461 if (opc == TCE::STQBrj) return "stq";
462 if (opc == TCE::STQBij) return "stq";
463
464 if (opc == TCE::ST8Brb) return "st8";
465 if (opc == TCE::ST8Bib) return "st8";
466 if (opc == TCE::ST8Brj) return "st8";
467 if (opc == TCE::ST8Bij) return "st8";
468
469 // temporary RA register store/loads
470#ifdef TARGET64BIT
471 if (opc == TCE::ST64RAss) return "st64";
472 if (opc == TCE::LD64RAs) return "ld64";
473#else
474 if (opc == TCE::STWRArr) return "stw";
475 if (opc == TCE::LDWRAr) return "ldw";
476 if (opc == TCE::ST32RArr) return "st32";
477 if (opc == TCE::LD32RAr) return "ld32";
478#endif
479 if (opc == TCE::TCEBR) return "jump";
480 if (opc == TCE::TCEBRIND) return "jump";
481 if (opc == TCE::CALL) return "call";
482 if (opc == TCE::CALL_MEMrr) return "call";
483 if (opc == TCE::CALL_MEMri) return "call";
484
485 std::map<unsigned int, TCEString>::const_iterator opNameIt;
486
487 std::map<unsigned int, TCEString>::const_iterator i = opNames_.find(opc);
488 if (i == opNames_.end()) {
489 std::cerr << "ERROR: Couldn't find operation with opc: " << opc
490 << std::endl;
491 std::cerr << "Total ops: " << opNames_.size() << std::endl;
492/*
493 abort();
494*/
495 return "";
496 } else {
497 return i->second;
498 }
499}
#define NOP
#define MOVE(SRC, DST)

References MOVE, NOP, and opNames_.

Referenced by hasOperation(), and opcode().

◆ raPortDRegNum()

unsigned GeneratedTCEPlugin::raPortDRegNum ( )
overridevirtual

Returns ID number of the return address register.

Implements llvm::TCETargetMachinePlugin.

Definition at line 571 of file TCETargetMachinePlugin.cc.

571 {
572 return TCE::RA;
573}

◆ registerIndex()

unsigned GeneratedTCEPlugin::registerIndex ( unsigned  dwarfRegNum)
overridevirtual

Maps llvm register numbers to target RF indices.

Implements llvm::TCETargetMachinePlugin.

Definition at line 557 of file TCETargetMachinePlugin.cc.

557 {
558 if (regIndices_.find(dwarfRegNum) == regIndices_.end()) {
559 return dwarfRegNum;
560 }
561 return regIndices_[dwarfRegNum];
562}
std::map< unsigned, unsigned > regIndices_

References regIndices_.

◆ registerTargetMachine()

void GeneratedTCEPlugin::registerTargetMachine ( TCETargetMachine tm)
overridevirtual

Plugin needs target machine for TragetLowering generation.

Implements llvm::TCETargetMachinePlugin.

Definition at line 246 of file TCETargetMachinePlugin.cc.

247 {
248 tm_ = &tm;
249 instrInfo_ = new TCEInstrInfo(this);
250 // Initialize register & opcode maps.
251 initialize();
252
253 TCERegisterInfo* ri =
254 const_cast<TCERegisterInfo*>(
255 static_cast<const TCERegisterInfo*>(getRegisterInfo()));
257
258 if (isLittleEndian()) {
259#ifndef TARGET64BIT
260 subTarget_ = new TCELESubtarget(this);
261#else
262 subTarget_ = new TCELE64Subtarget(this);
263#endif
264 } else {
265 subTarget_ = new TCESubtarget(this);
266 }
267
268 if (lowering_ == NULL) {
270 }
271}
virtual bool isLittleEndian() const override
unsigned stackAlignment() const

References llvm::TCETargetMachinePlugin::frameInfo_, getRegisterInfo(), initialize(), llvm::TCETargetMachinePlugin::instrInfo_, isLittleEndian(), llvm::TCETargetMachinePlugin::lowering_, llvm::TCETargetMachine::stackAlignment(), llvm::TCETargetMachinePlugin::subTarget_, and llvm::TCETargetMachinePlugin::tm_.

Here is the call graph for this function:

◆ rfName()

std::string GeneratedTCEPlugin::rfName ( unsigned  dwarfRegNum)
overridevirtual

Maps llvm register numbers to target RF names.

Implements llvm::TCETargetMachinePlugin.

Definition at line 546 of file TCETargetMachinePlugin.cc.

546 {
547 if (regNames_.find(dwarfRegNum) == regNames_.end()) {
548 return "BYPASS_PSEUDO";
549 }
550 return regNames_[dwarfRegNum];
551}
std::map< unsigned, TCEString > regNames_

References regNames_.

◆ rvDRegNum()

virtual unsigned llvm::GeneratedTCEPlugin::rvDRegNum ( )
inlineoverridevirtual

Implements llvm::TCETargetMachinePlugin.

Definition at line 78 of file TCETargetMachinePlugin.cc.

78 {
79 return TCE::IRES0;
80 }

◆ rvHighDRegNum()

virtual unsigned llvm::GeneratedTCEPlugin::rvHighDRegNum ( )
inlineoverridevirtual

Implements llvm::TCETargetMachinePlugin.

Definition at line 82 of file TCETargetMachinePlugin.cc.

82 {
83 return TCE::KLUDGE_REGISTER;
84 }

◆ spDRegNum()

virtual unsigned llvm::GeneratedTCEPlugin::spDRegNum ( )
inlineoverridevirtual

Returns ID number of the stack pointer register.

Implements llvm::TCETargetMachinePlugin.

Definition at line 70 of file TCETargetMachinePlugin.cc.

70 {
71 return TCE::SP;
72 }

◆ validStackAccessOperation()

bool GeneratedTCEPlugin::validStackAccessOperation ( const std::string &  opName) const
overridevirtual

Returns true if OSAL operation is valid for stack accesses.

Implements llvm::TCETargetMachinePlugin.

Definition at line 502 of file TCETargetMachinePlugin.cc.

502 {
503 return validStackAccessOperations_.count(opName);
504}
TCETools::CIStringSet validStackAccessOperations_
Set of valid LLVM opcodes for stack accesses.

References validStackAccessOperations_.

Member Data Documentation

◆ dataASName_

std::string llvm::GeneratedTCEPlugin::dataASName_
private

Definition at line 198 of file TCETargetMachinePlugin.cc.

Referenced by dataASName().

◆ falsePredOps_

std::map<unsigned, unsigned> llvm::GeneratedTCEPlugin::falsePredOps_
private

Definition at line 190 of file TCETargetMachinePlugin.cc.

Referenced by getFalsePredicateOpcode().

◆ opNames_

std::map<unsigned, TCEString> llvm::GeneratedTCEPlugin::opNames_
private

Definition at line 188 of file TCETargetMachinePlugin.cc.

Referenced by hasOperation(), opcode(), and operationName().

◆ regIndices_

std::map<unsigned, unsigned> llvm::GeneratedTCEPlugin::regIndices_
private

Definition at line 192 of file TCETargetMachinePlugin.cc.

Referenced by registerIndex().

◆ regNames_

std::map<unsigned, TCEString> llvm::GeneratedTCEPlugin::regNames_
private

Definition at line 191 of file TCETargetMachinePlugin.cc.

Referenced by rfName().

◆ truePredOps_

std::map<unsigned, unsigned> llvm::GeneratedTCEPlugin::truePredOps_
private

Definition at line 189 of file TCETargetMachinePlugin.cc.

Referenced by getTruePredicateOpcode().

◆ ttallvmRegMap_

std::map<TCEString, unsigned> llvm::GeneratedTCEPlugin::ttallvmRegMap_
private

Map for TTA register to LLVM register id conversion.

Definition at line 194 of file TCETargetMachinePlugin.cc.

Referenced by llvmRegisterId().

◆ validStackAccessOperations_

TCETools::CIStringSet llvm::GeneratedTCEPlugin::validStackAccessOperations_
private

Set of valid LLVM opcodes for stack accesses.

Definition at line 196 of file TCETargetMachinePlugin.cc.

Referenced by validStackAccessOperation().


The documentation for this class was generated from the following file: