OpenASIP  2.0
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
llvm::TCETargetMachine Class Reference

#include <TCETargetMachine.hh>

Inheritance diagram for llvm::TCETargetMachine:
Inheritance graph
Collaboration diagram for llvm::TCETargetMachine:
Collaboration graph

Public Member Functions

 TCETargetMachine (const Target &T, const Triple &TTriple, const llvm::StringRef &CPU, const llvm::StringRef &FS, const TargetOptions &Options, Optional< Reloc::Model > RM, Optional< CodeModel::Model > CM, CodeGenOpt::Level OL, bool isLittle)
 
virtual ~TCETargetMachine ()
 
virtual void setTargetMachinePlugin (TCETargetMachinePlugin &plugin, TTAMachine::Machine &target)
 
virtual TCETargetMachinePlugintargetPlugin () const
 
virtual void setEmulationModule (Module *mod)
 
virtual void setTTAMach (const TTAMachine::Machine *mach) override
 
virtual const TTAMachine::MachinettaMachine () const
 
virtual const TCESubtargetgetSubtargetImpl () const
 
virtual const TargetSubtargetInfo * getSubtargetImpl (const Function &) const override
 
virtual const TargetInstrInfo * getInstrInfo () const
 
virtual const TargetRegisterInfo * getRegisterInfo () const
 
virtual const DataLayout * getDataLayout () const
 
virtual const TargetFrameLowering * getFrameLowering () const
 
virtual TargetLowering * getTargetLowering () const
 
virtual TargetPassConfig * createPassConfig (PassManagerBase &PM) override
 
TargetTransformInfo getTargetTransformInfo (const Function &F) const override
 
std::string operationName (unsigned opc) const
 
bool validStackAccessOperation (const std::string &opName) const
 
bool hasOperation (TCEString operationName) const
 
std::string rfName (unsigned dwarfRegNum) const
 
unsigned registerIndex (unsigned dwarfRegNum) const
 
std::string registerName (unsigned dwarfRegNum) const
 
unsigned llvmRegisterId (const TCEString &ttaRegister)
 
TTAMachine::MachinecreateMachine ()
 
std::string dataASName ()
 
unsigned raPortDRegNum () const
 
void loadPlugin ()
 
unsigned spDRegNum () const
 
unsigned opcode (TCEString operationName) const
 
int getMinOpcode (llvm::SDNode *n)
 
int getMinuOpcode (llvm::SDNode *n)
 
int getMaxOpcode (llvm::SDNode *n)
 
int getMaxuOpcode (llvm::SDNode *n)
 
int getAddOpcode (const llvm::EVT &vt) const
 
int getShlOpcode (const llvm::EVT &vt) const
 
int getIorOpcode (const llvm::EVT &vt) const
 
void setStackAlignment (unsigned align)
 
unsigned stackAlignment () const
 
bool has8bitLoads () const
 
bool has16bitLoads () const
 
int bitness () const
 
const std::set< std::pair< unsigned, llvm::MVT::SimpleValueType > > * missingOperations ()
 
const std::set< std::pair< unsigned, llvm::MVT::SimpleValueType > > * promotedOperations ()
 
const std::set< std::pair< unsigned, llvm::MVT::SimpleValueType > > * customLegalizedOperations ()
 
int64_t smallestImmValue () const
 
uint64_t largestImmValue () const
 
bool canEncodeAsMOVI (const llvm::MVT &vt, int64_t val) const
 
bool canEncodeAsMOVF (const llvm::APFloat &fp) const
 
bool canMaterializeConstant (const ConstantInt &ci) const
 
int getLoadOpcode (int asid, int align, const llvm::EVT &vt) const
 
- Public Member Functions inherited from llvm::TCEBaseTargetMachine
 TCEBaseTargetMachine (const Target &T, const Triple &TT, const llvm::StringRef &CPU, const llvm::StringRef &FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL)
 
virtual bool isNoopAddrSpaceCast (unsigned SrcAS, unsigned DestAS) const override
 

Public Attributes

Module * emulationModule_
 
- Public Attributes inherited from llvm::TCEBaseTargetMachine
const TTAMachine::MachinettaMach_
 

Private Member Functions

void calculateSupportedImmediates ()
 

Private Attributes

TCETargetMachinePluginplugin_
 
PluginToolspluginTool_
 
std::set< std::pair< unsigned, llvm::MVT::SimpleValueType > > missingOps_
 llvm::ISD opcode list of operations that have to be expanded. More...
 
std::set< std::pair< unsigned, llvm::MVT::SimpleValueType > > promotedOps_
 
std::set< std::pair< unsigned, llvm::MVT::SimpleValueType > > customLegalizedOps_
 
int64_t smallestImm_ = std::numeric_limits<int64_t>::max()
 
uint64_t largestImm_ = std::numeric_limits<int64_t>::min()
 
int SupportedFPImmWidth_ = std::numeric_limits<int>::min()
 
unsigned stackAlignment_
 

Detailed Description

TCE Universal machine target description.

Definition at line 106 of file TCETargetMachine.hh.

Constructor & Destructor Documentation

◆ TCETargetMachine()

TCETargetMachine::TCETargetMachine ( const Target &  T,
const Triple &  TTriple,
const llvm::StringRef &  CPU,
const llvm::StringRef &  FS,
const TargetOptions &  Options,
Optional< Reloc::Model >  RM,
Optional< CodeModel::Model >  CM,
CodeGenOpt::Level  OL,
bool  isLittle 
)

Definition at line 144 of file TCETargetMachine.cc.

148  :
149  TCEBaseTargetMachine(T, TTriple, CPU, FS, Options,
150  RM?*RM:Reloc::Model::Static, CM?*CM:CodeModel::Small, OL),
151  // Note: Reloc::Model does not have "Default" named member. "Static" is ok?
152  // Note: CodeModel does not have "Default" named member. "Small" is ok?
153  plugin_(NULL), pluginTool_(NULL) {
154 }

◆ ~TCETargetMachine()

TCETargetMachine::~TCETargetMachine ( )
virtual

The Destructor.

Definition at line 159 of file TCETargetMachine.cc.

159  {
160  if (pluginTool_ != NULL) {
161  delete pluginTool_;
162  pluginTool_ = NULL;
163  }
164 }

References pluginTool_.

Member Function Documentation

◆ bitness()

int llvm::TCETargetMachine::bitness ( ) const
inline

Definition at line 294 of file TCETargetMachine.hh.

294  {
295  return plugin_->is64bit() ? 64 : 32;
296  }

References llvm::TCETargetMachinePlugin::is64bit(), and plugin_.

Here is the call graph for this function:

◆ calculateSupportedImmediates()

void TCETargetMachine::calculateSupportedImmediates ( )
private

Definition at line 389 of file TCETargetMachine.cc.

389  {
390  using MCC = MachineConnectivityCheck;
391 
392  // FIX ME: All 32 bit regs are assumed to be RF-connected.
393  std::pair<int64_t, uint64_t> moveImm{
394  std::numeric_limits<int64_t>::max(),
395  std::numeric_limits<uint64_t>::min() };
396  assert(ttaMach_);
397  for (auto& rf : ttaMach_->registerFileNavigator()) {
398  if (rf->width() != 32) continue;
399 
400  for (auto& bus : ttaMach_->busNavigator()) {
401  if (!MCC::busConnectedToRF(*bus, *rf)
402  || bus->immediateWidth() == 0) {
403  continue;
404  }
405 
406  if (bus->immediateWidth() >= 32) {
407  moveImm.first = -(1ll << (32-1));
408  moveImm.second = (1ll << 32)-1;
409  break;
410  } else {
411  std::pair<int64_t, uint64_t> imm =
412  MathTools::bitsToIntegerRange<int64_t, uint64_t>(
413  bus->immediateWidth(),
414  bus->signExtends());
415 
416  moveImm.first = std::min(moveImm.first, imm.first);
417  moveImm.second = std::max(moveImm.second, imm.second);
418  }
419  }
420  }
421 
422  for (auto& iu : ttaMach_->immediateUnitNavigator()) {
423  for (auto& it : ttaMach_->instructionTemplateNavigator()) {
424  int supportedWidth = it->supportedWidth(*iu);
425  if (supportedWidth >= 32) {
426  moveImm.first = -(1ll << (32-1));
427  moveImm.second = (1ll << 32)-1;
428  break;
429  } else {
430  std::pair<int64_t, uint64_t> imm =
431  MathTools::bitsToIntegerRange<int64_t, uint64_t>(
432  supportedWidth, iu->signExtends());
433 
434  moveImm.first = std::min(moveImm.first, imm.first);
435  moveImm.second = std::max(moveImm.second, imm.second);
436  }
437  }
438  }
439  smallestImm_ = moveImm.first;
440  largestImm_ = moveImm.second;
441 
442  for (auto* rf : ttaMach_->registerFileNavigator()) {
443  if (!MCC::rfConnected(*rf)) continue;
444 
445  SupportedFPImmWidth_ = std::max(
448  }
449 }

References assert, TTAMachine::Machine::busNavigator(), TTAMachine::Machine::immediateUnitNavigator(), TTAMachine::Machine::instructionTemplateNavigator(), largestImm_, TTAMachine::Machine::registerFileNavigator(), ImmInfo::registerImmediateLoadWidth(), smallestImm_, SupportedFPImmWidth_, and llvm::TCEBaseTargetMachine::ttaMach_.

Referenced by setTTAMach().

Here is the call graph for this function:

◆ canEncodeAsMOVF()

bool TCETargetMachine::canEncodeAsMOVF ( const llvm::APFloat &  fp) const

Returns true if the floating point value can be encoded as immediate to register.

Definition at line 382 of file TCETargetMachine.cc.

382  {
383  int fpBitWidth = static_cast<int>(
384  llvm::APFloat::getSizeInBits(fp.getSemantics()));
385  return fpBitWidth <= SupportedFPImmWidth_;
386 }

References SupportedFPImmWidth_.

Referenced by llvm::TCETargetLowering::isFPImmLegal().

◆ canEncodeAsMOVI()

bool TCETargetMachine::canEncodeAsMOVI ( const llvm::MVT &  vt,
int64_t  val 
) const

Returns true if the value can be encoded as immediate to register.

Definition at line 359 of file TCETargetMachine.cc.

359  {
360  // setTargetMachinePlugin() calls calculateSupportedImmediateLimits.
361  assert(ttaMach_ && "setTargetMachinePlugin() was not called");
362  switch (vt.SimpleTy) {
363  case MVT::i1:
364  return (1 <= largestImm_);
365  case MVT::i8:
366  case MVT::i16:
367  case MVT::i32:
368  case MVT::i64:
369  return smallestImm_ == INT64_MIN || largestImm_ == UINT64_MAX ||
370  ((int64_t)smallestImm_ <= val &&
371  (val < 0 || val <= (int64_t)largestImm_));
372  default: assert(false && "Not implemented or supported.");
373  }
374  return false;
375 }

References assert, largestImm_, smallestImm_, and llvm::TCEBaseTargetMachine::ttaMach_.

Referenced by llvm::TCETargetLowering::canEncodeImmediate(), and llvm::TCETargetLowering::LowerBuildVector().

◆ canMaterializeConstant()

bool llvm::TCETargetMachine::canMaterializeConstant ( const ConstantInt &  ci) const
inline

Definition at line 321 of file TCETargetMachine.hh.

321  {
322  return plugin_->canMaterializeConstant(ci);
323  }

References llvm::TCETargetMachinePlugin::canMaterializeConstant(), and plugin_.

Referenced by llvm::TCETargetLowering::canEncodeImmediate().

Here is the call graph for this function:

◆ createMachine()

TTAMachine::Machine * TCETargetMachine::createMachine ( )

Creates a TTAMachine::Machine object of the target architecture.

Definition at line 305 of file TCETargetMachine.cc.

305  {
306  ADFSerializer serializer;
307  serializer.setSourceString(*plugin_->adfXML());
308  return serializer.readMachine();
309 }

References llvm::TCETargetMachinePlugin::adfXML(), plugin_, ADFSerializer::readMachine(), and XMLSerializer::setSourceString().

Here is the call graph for this function:

◆ createPassConfig()

TargetPassConfig * TCETargetMachine::createPassConfig ( PassManagerBase &  PM)
overridevirtual

Definition at line 345 of file TCETargetMachine.cc.

346  {
347  TCEPassConfig *tpc;
348  tpc = new TCEPassConfig(this, PM, plugin_);
349  // TODO: is this false by default if not set?
350  // false seems to give slightly better performance than true.
351  tpc->setEnableTailMerge(false);
352  return tpc;
353 }

References plugin_.

◆ customLegalizedOperations()

const std::set< std::pair< unsigned, llvm::MVT::SimpleValueType > > * TCETargetMachine::customLegalizedOperations ( )

Returns list of llvm::ISD SelectionDAG opcodes for operations that are not supported in the target architecture but will be custom-selected.

Definition at line 340 of file TCETargetMachine.cc.

340  {
341  return &customLegalizedOps_;
342 }

References customLegalizedOps_.

Referenced by llvm::TCETargetLowering::TCETargetLowering().

◆ dataASName()

std::string llvm::TCETargetMachine::dataASName ( )
inline

Definition at line 227 of file TCETargetMachine.hh.

227  {
228  return plugin_->dataASName();
229  }

References llvm::TCETargetMachinePlugin::dataASName(), and plugin_.

Here is the call graph for this function:

◆ getAddOpcode()

int llvm::TCETargetMachine::getAddOpcode ( const llvm::EVT &  vt) const
inline

Definition at line 261 of file TCETargetMachine.hh.

261  {
262  return plugin_->getAddOpcode(vt);
263  }

References llvm::TCETargetMachinePlugin::getAddOpcode(), and plugin_.

Here is the call graph for this function:

◆ getDataLayout()

virtual const DataLayout* llvm::TCETargetMachine::getDataLayout ( ) const
inlinevirtual

Definition at line 162 of file TCETargetMachine.hh.

162  {
163  return plugin_->getDataLayout();
164  }

References llvm::TCETargetMachinePlugin::getDataLayout(), and plugin_.

Here is the call graph for this function:

◆ getFrameLowering()

virtual const TargetFrameLowering* llvm::TCETargetMachine::getFrameLowering ( ) const
inlinevirtual

Definition at line 166 of file TCETargetMachine.hh.

166  {
167  return plugin_->getFrameLowering();
168  }

References llvm::TCETargetMachinePlugin::getFrameLowering(), and plugin_.

Here is the call graph for this function:

◆ getInstrInfo()

virtual const TargetInstrInfo* llvm::TCETargetMachine::getInstrInfo ( ) const
inlinevirtual

Definition at line 154 of file TCETargetMachine.hh.

154  {
155  return plugin_->getInstrInfo();
156  }

References llvm::TCETargetMachinePlugin::getInstrInfo(), and plugin_.

Here is the call graph for this function:

◆ getIorOpcode()

int llvm::TCETargetMachine::getIorOpcode ( const llvm::EVT &  vt) const
inline

Definition at line 269 of file TCETargetMachine.hh.

269  {
270  return plugin_->getIorOpcode(vt);
271  }

References llvm::TCETargetMachinePlugin::getIorOpcode(), and plugin_.

Here is the call graph for this function:

◆ getLoadOpcode()

int TCETargetMachine::getLoadOpcode ( int  asid,
int  align,
const llvm::EVT &  vt 
) const

Definition at line 456 of file TCETargetMachine.cc.

456  {
457  int laneCount = vt.getVectorElementCount().getKnownMinValue();
458 
459  int laneSize = vt.getScalarSizeInBits();
460  int vecSize = laneCount * laneSize;
461  TCEString relaxedName = "LD"; relaxedName << laneSize << "X" << laneCount;
462  TCEString strictName = "LD"; strictName << vecSize;
463  bool allowStrict = vecSize <= align;
464 
465  auto fuNav = ttaMach_->functionUnitNavigator();
466  bool found = false;
467  for (int i = 0; i < fuNav.count(); i++) {
468  auto fu = fuNav.item(i);
469  if (fu->hasOperation(relaxedName) && fu->hasAddressSpace()) {
470  auto as = fu->addressSpace();
471  if (as->hasNumericalId(asid)) {
472  found = true;
473  break;
474  }
475  }
476  if (allowStrict) {
477  if (fu->hasOperation(strictName) && fu->hasAddressSpace()) {
478  auto as = fu->addressSpace();
479  if (as->hasNumericalId(asid)) {
480  found = true;
481  break;
482  }
483  }
484  }
485  }
486  return found ? plugin_->getLoadOpcode(vt) : -1;
487 }

References TTAMachine::Machine::functionUnitNavigator(), llvm::TCETargetMachinePlugin::getLoadOpcode(), TTAMachine::Machine::Navigator< ComponentType >::item(), plugin_, and llvm::TCEBaseTargetMachine::ttaMach_.

Here is the call graph for this function:

◆ getMaxOpcode()

int llvm::TCETargetMachine::getMaxOpcode ( llvm::SDNode *  n)
inline

Definition at line 253 of file TCETargetMachine.hh.

253  {
254  return plugin_->getMaxOpcode(n);
255  }

References llvm::TCETargetMachinePlugin::getMaxOpcode(), and plugin_.

Referenced by TCEDAGToDAGISel::Select().

Here is the call graph for this function:

◆ getMaxuOpcode()

int llvm::TCETargetMachine::getMaxuOpcode ( llvm::SDNode *  n)
inline

Definition at line 257 of file TCETargetMachine.hh.

257  {
258  return plugin_->getMaxuOpcode(n);
259  }

References llvm::TCETargetMachinePlugin::getMaxuOpcode(), and plugin_.

Referenced by TCEDAGToDAGISel::Select().

Here is the call graph for this function:

◆ getMinOpcode()

int llvm::TCETargetMachine::getMinOpcode ( llvm::SDNode *  n)
inline

Definition at line 245 of file TCETargetMachine.hh.

245  {
246  return plugin_->getMinOpcode(n);
247  }

References llvm::TCETargetMachinePlugin::getMinOpcode(), and plugin_.

Referenced by TCEDAGToDAGISel::Select().

Here is the call graph for this function:

◆ getMinuOpcode()

int llvm::TCETargetMachine::getMinuOpcode ( llvm::SDNode *  n)
inline

Definition at line 249 of file TCETargetMachine.hh.

249  {
250  return plugin_->getMinuOpcode(n);
251  }

References llvm::TCETargetMachinePlugin::getMinuOpcode(), and plugin_.

Referenced by TCEDAGToDAGISel::Select().

Here is the call graph for this function:

◆ getRegisterInfo()

virtual const TargetRegisterInfo* llvm::TCETargetMachine::getRegisterInfo ( ) const
inlinevirtual

Definition at line 158 of file TCETargetMachine.hh.

158  {
159  return plugin_->getRegisterInfo();
160  }

References llvm::TCETargetMachinePlugin::getRegisterInfo(), and plugin_.

Here is the call graph for this function:

◆ getShlOpcode()

int llvm::TCETargetMachine::getShlOpcode ( const llvm::EVT &  vt) const
inline

Definition at line 265 of file TCETargetMachine.hh.

265  {
266  return plugin_->getShlOpcode(vt);
267  }

References llvm::TCETargetMachinePlugin::getShlOpcode(), and plugin_.

Here is the call graph for this function:

◆ getSubtargetImpl() [1/2]

virtual const TCESubtarget* llvm::TCETargetMachine::getSubtargetImpl ( ) const
inlinevirtual

Definition at line 144 of file TCETargetMachine.hh.

144  {
145  // compiler does not know it's derived without the plugin,
146  // but this class cannow include the plugin.
147  return reinterpret_cast<const TCESubtarget*>(plugin_->getSubtarget());
148  }

References llvm::TCETargetMachinePlugin::getSubtarget(), and plugin_.

Here is the call graph for this function:

◆ getSubtargetImpl() [2/2]

virtual const TargetSubtargetInfo* llvm::TCETargetMachine::getSubtargetImpl ( const Function &  ) const
inlineoverridevirtual

Definition at line 150 of file TCETargetMachine.hh.

150  {
151  return plugin_->getSubtarget();
152  }

References llvm::TCETargetMachinePlugin::getSubtarget(), and plugin_.

Here is the call graph for this function:

◆ getTargetLowering()

virtual TargetLowering* llvm::TCETargetMachine::getTargetLowering ( ) const
inlinevirtual

Definition at line 169 of file TCETargetMachine.hh.

169  {
170  return plugin_->getTargetLowering();
171  }

References llvm::TCETargetMachinePlugin::getTargetLowering(), and plugin_.

Here is the call graph for this function:

◆ getTargetTransformInfo()

TargetTransformInfo llvm::TCETargetMachine::getTargetTransformInfo ( const Function &  F) const
inlineoverride

Definition at line 183 of file TCETargetMachine.hh.

183  {
184  return plugin_->getTargetTransformInfo(F);
185  }

References llvm::TCETargetMachinePlugin::getTargetTransformInfo(), and plugin_.

Here is the call graph for this function:

◆ has16bitLoads()

bool llvm::TCETargetMachine::has16bitLoads ( ) const
inline

Definition at line 290 of file TCETargetMachine.hh.

290  {
291  return plugin_->has16bitLoads();
292  }

References llvm::TCETargetMachinePlugin::has16bitLoads(), and plugin_.

Referenced by llvm::TCETargetLowering::TCETargetLowering().

Here is the call graph for this function:

◆ has8bitLoads()

bool llvm::TCETargetMachine::has8bitLoads ( ) const
inline

Definition at line 286 of file TCETargetMachine.hh.

286  {
287  return plugin_->has8bitLoads();
288  }

References llvm::TCETargetMachinePlugin::has8bitLoads(), and plugin_.

Referenced by llvm::TCETargetLowering::TCETargetLowering().

Here is the call graph for this function:

◆ hasOperation()

bool llvm::TCETargetMachine::hasOperation ( TCEString  operationName) const
inline

◆ largestImmValue()

uint64_t llvm::TCETargetMachine::largestImmValue ( ) const
inline

Definition at line 314 of file TCETargetMachine.hh.

314  {
315  assert(ttaMach_ && "setTargetMachinePlugin() was not called");
316  return largestImm_;
317  }

References assert, largestImm_, and llvm::TCEBaseTargetMachine::ttaMach_.

Referenced by llvm::TCETargetLowering::TCETargetLowering().

◆ llvmRegisterId()

unsigned llvm::TCETargetMachine::llvmRegisterId ( const TCEString ttaRegister)
inline

Definition at line 221 of file TCETargetMachine.hh.

221  {
222  return plugin_->llvmRegisterId(ttaRegister);
223  }

References llvm::TCETargetMachinePlugin::llvmRegisterId(), and plugin_.

Referenced by llvm::TCETargetLowering::getRegForInlineAsmConstraint().

Here is the call graph for this function:

◆ loadPlugin()

void llvm::TCETargetMachine::loadPlugin ( )

◆ missingOperations()

const std::set< std::pair< unsigned, llvm::MVT::SimpleValueType > > * TCETargetMachine::missingOperations ( )

Returns list of llvm::ISD SelectionDAG opcodes for operations that are not supported in the target architecture.

The returned operations have to be expanded to emulation function calls or emulation patterns in TCETargetLowering.

Definition at line 319 of file TCETargetMachine.cc.

319  {
320  return &missingOps_;
321 }

References missingOps_.

Referenced by llvm::TCETargetLowering::TCETargetLowering().

◆ opcode()

unsigned llvm::TCETargetMachine::opcode ( TCEString  operationName) const
inline

Definition at line 241 of file TCETargetMachine.hh.

241  {
242  return plugin_->opcode(operationName);
243  }

References llvm::TCETargetMachinePlugin::opcode(), operationName(), and plugin_.

Referenced by llvm::TCERegisterInfo::eliminateFrameIndex().

Here is the call graph for this function:

◆ operationName()

std::string llvm::TCETargetMachine::operationName ( unsigned  opc) const
inline

Definition at line 188 of file TCETargetMachine.hh.

188  {
189  return plugin_->operationName(opc);
190  }

References llvm::TCETargetMachinePlugin::operationName(), and plugin_.

Referenced by llvm::TCERegisterInfo::eliminateFrameIndex(), hasOperation(), opcode(), osalInputIndex(), and ConstantTransformer::runOnMachineFunction().

Here is the call graph for this function:

◆ promotedOperations()

const std::set< std::pair< unsigned, llvm::MVT::SimpleValueType > > * TCETargetMachine::promotedOperations ( )

Returns list of llvm::ISD SelectionDAG opcodes for operations that are not supported in the target architecture but will be promoted.

The returned operations have to be promoted to emulation function calls or emulation patterns in TCETargetLowering.

Definition at line 331 of file TCETargetMachine.cc.

331  {
332  return &promotedOps_;
333 }

References promotedOps_.

Referenced by llvm::TCETargetLowering::TCETargetLowering().

◆ raPortDRegNum()

unsigned llvm::TCETargetMachine::raPortDRegNum ( ) const
inline

Definition at line 231 of file TCETargetMachine.hh.

231  {
232  return plugin_->raPortDRegNum();
233  }

References plugin_, and llvm::TCETargetMachinePlugin::raPortDRegNum().

Here is the call graph for this function:

◆ registerIndex()

unsigned llvm::TCETargetMachine::registerIndex ( unsigned  dwarfRegNum) const
inline

Definition at line 208 of file TCETargetMachine.hh.

208  {
209  return plugin_->registerIndex(dwarfRegNum);
210  }

References plugin_, and llvm::TCETargetMachinePlugin::registerIndex().

Referenced by llvm::LLVMTCEBuilder::emitWriteSP(), and registerName().

Here is the call graph for this function:

◆ registerName()

std::string llvm::TCETargetMachine::registerName ( unsigned  dwarfRegNum) const
inline

Returns full name of the register.

Definition at line 216 of file TCETargetMachine.hh.

216  {
217  return rfName(dwarfRegNum) + "."
218  + std::to_string(registerIndex(dwarfRegNum));
219  }

References registerIndex(), and rfName().

Referenced by llvm::LLVMTCEBuilder::emitInlineAsm(), InlineAsmParser::registerName(), and InlineAsmParser::substituteAsmString().

Here is the call graph for this function:

◆ rfName()

std::string llvm::TCETargetMachine::rfName ( unsigned  dwarfRegNum) const
inline

Definition at line 204 of file TCETargetMachine.hh.

204  {
205  return plugin_->rfName(dwarfRegNum);
206  }

References plugin_, and llvm::TCETargetMachinePlugin::rfName().

Referenced by llvm::LLVMTCEBuilder::emitWriteSP(), llvm::TCETargetLowering::hasI1RegisterClass(), and registerName().

Here is the call graph for this function:

◆ setEmulationModule()

virtual void llvm::TCETargetMachine::setEmulationModule ( Module *  mod)
inlinevirtual

Definition at line 127 of file TCETargetMachine.hh.

127  {
128  emulationModule_ = mod;
129  }

References emulationModule_.

Referenced by LLVMBackend::compile().

◆ setStackAlignment()

void llvm::TCETargetMachine::setStackAlignment ( unsigned  align)
inline

Definition at line 273 of file TCETargetMachine.hh.

273  {
274  stackAlignment_ = align;
275  }

References stackAlignment_.

Referenced by LLVMBackend::compile().

◆ setTargetMachinePlugin()

void TCETargetMachine::setTargetMachinePlugin ( TCETargetMachinePlugin plugin,
TTAMachine::Machine target 
)
virtual

Definition at line 167 of file TCETargetMachine.cc.

168  {
169 
170  setTTAMach(&target);
171  plugin_ = &plugin;
172  missingOps_.clear();
173  promotedOps_.clear();
174  MVT::SimpleValueType defType = plugin_->getDefaultType();
175  if (!plugin_->hasSDIV()) missingOps_.insert(std::make_pair(llvm::ISD::SDIV, defType));
176  if (!plugin_->hasUDIV()) missingOps_.insert(std::make_pair(llvm::ISD::UDIV, defType));
177  if (!plugin_->hasSREM()) missingOps_.insert(std::make_pair(llvm::ISD::SREM, defType));
178  if (!plugin_->hasUREM()) missingOps_.insert(std::make_pair(llvm::ISD::UREM, defType));
179  if (!plugin_->hasMUL()) missingOps_.insert(std::make_pair(llvm::ISD::MUL, defType));
180  if (!plugin_->hasROTL()) missingOps_.insert(std::make_pair(llvm::ISD::ROTL, defType));
181  if (!plugin_->hasROTR()) missingOps_.insert(std::make_pair(llvm::ISD::ROTR, defType));
182 
183  if (!plugin_->hasSHL()) customLegalizedOps_.insert(std::make_pair(llvm::ISD::SHL, MVT::i32));
184  if (!plugin_->hasSHR()) customLegalizedOps_.insert(std::make_pair(llvm::ISD::SRA, MVT::i32));
185  if (!plugin_->hasSHRU()) customLegalizedOps_.insert(std::make_pair(llvm::ISD::SRL, MVT::i32));
186 
187  if (!plugin_->hasSXHW()) missingOps_.insert(
188  std::make_pair(llvm::ISD::SIGN_EXTEND_INREG, MVT::i16));
189 
190  if (!plugin_->hasSXQW()) missingOps_.insert(
191  std::make_pair(llvm::ISD::SIGN_EXTEND_INREG, MVT::i8));
192 
193  if (!plugin_->hasSQRTF()) {
194  missingOps_.insert(std::make_pair(llvm::ISD::FSQRT, MVT::f32));
195  }
196 
197  // register machine to plugin
199 
200  initAsmInfo();
201 
202  // Set data layout with correct stack alignment.
203  unsigned alignBits = MachineInfo::maxMemoryAlignment(target) * 8;
204  TCEString dataLayoutStr("");
205  if (plugin_->isLittleEndian()) {
206  dataLayoutStr += target.is64bit() ? "e-p:64:64:64" : "e-p:32:32:32";
207  } else {
208  dataLayoutStr += "E-p:32:32:32";
209  }
210  dataLayoutStr += "-a0:0:" + Conversion::toString(alignBits);
211  if (target.is64bit()) {
212  dataLayoutStr += "-i1:8:64";
213  dataLayoutStr += "-i8:8:64";
214  dataLayoutStr += "-i16:16:64";
215  dataLayoutStr += "-i32:32:64";
216  dataLayoutStr += "-i64:64:64";
217  dataLayoutStr += "-f16:16:64";
218  dataLayoutStr += "-f32:32:64";
219  } else {
220  dataLayoutStr += "-i1:8:8";
221  dataLayoutStr += "-i8:8:32";
222  dataLayoutStr += "-i16:16:32";
223  dataLayoutStr += "-i32:32:32";
224  dataLayoutStr += "-i64:64:64";
225  dataLayoutStr += "-f16:16:16";
226  dataLayoutStr += "-f32:32:32";
227  }
228  dataLayoutStr += "-f64:64:64";
229  dataLayoutStr += "-v64:64:64";
230  dataLayoutStr += "-v128:128:128";
231  dataLayoutStr += "-v256:256:256";
232  dataLayoutStr += "-v512:512:512";
233  dataLayoutStr += "-v1024:1024:1024";
234 #if LLVM_HAS_CUSTOM_VECTOR_EXTENSION == 2
235  dataLayoutStr += "-v2048:2048:2048";
236  dataLayoutStr += "-v4096:4096:4096";
237 #endif
238 
239  DataLayout* dl = plugin_->getDataLayout();
240  dl->reset(dataLayoutStr.c_str());
241 }

References customLegalizedOps_, llvm::TCETargetMachinePlugin::getDataLayout(), llvm::TCETargetMachinePlugin::getDefaultType(), llvm::TCETargetMachinePlugin::hasMUL(), llvm::TCETargetMachinePlugin::hasROTL(), llvm::TCETargetMachinePlugin::hasROTR(), llvm::TCETargetMachinePlugin::hasSDIV(), llvm::TCETargetMachinePlugin::hasSHL(), llvm::TCETargetMachinePlugin::hasSHR(), llvm::TCETargetMachinePlugin::hasSHRU(), llvm::TCETargetMachinePlugin::hasSQRTF(), llvm::TCETargetMachinePlugin::hasSREM(), llvm::TCETargetMachinePlugin::hasSXHW(), llvm::TCETargetMachinePlugin::hasSXQW(), llvm::TCETargetMachinePlugin::hasUDIV(), llvm::TCETargetMachinePlugin::hasUREM(), TTAMachine::Machine::is64bit(), llvm::TCETargetMachinePlugin::isLittleEndian(), MachineInfo::maxMemoryAlignment(), missingOps_, plugin_, promotedOps_, llvm::TCETargetMachinePlugin::registerTargetMachine(), setTTAMach(), and Conversion::toString().

Referenced by LLVMBackend::compile().

Here is the call graph for this function:

◆ setTTAMach()

virtual void llvm::TCETargetMachine::setTTAMach ( const TTAMachine::Machine mach)
inlineoverridevirtual

Reimplemented from llvm::TCEBaseTargetMachine.

Definition at line 131 of file TCETargetMachine.hh.

132  {
135  }

References calculateSupportedImmediates(), and llvm::TCEBaseTargetMachine::setTTAMach().

Referenced by setTargetMachinePlugin().

Here is the call graph for this function:

◆ smallestImmValue()

int64_t llvm::TCETargetMachine::smallestImmValue ( ) const
inline

Definition at line 310 of file TCETargetMachine.hh.

310  {
311  assert(ttaMach_ && "setTargetMachinePlugin() was not called");
312  return smallestImm_;
313  }

References assert, smallestImm_, and llvm::TCEBaseTargetMachine::ttaMach_.

◆ spDRegNum()

unsigned llvm::TCETargetMachine::spDRegNum ( ) const
inline

Definition at line 237 of file TCETargetMachine.hh.

237  {
238  return plugin_->spDRegNum();
239  }

References plugin_, and llvm::TCETargetMachinePlugin::spDRegNum().

Referenced by llvm::LLVMTCEBuilder::emitWriteSP().

Here is the call graph for this function:

◆ stackAlignment()

unsigned llvm::TCETargetMachine::stackAlignment ( ) const
inline

◆ targetPlugin()

virtual TCETargetMachinePlugin& llvm::TCETargetMachine::targetPlugin ( ) const
inlinevirtual

Definition at line 120 of file TCETargetMachine.hh.

120 { return *plugin_; }

References plugin_.

Referenced by ConstantTransformer::runOnMachineFunction().

◆ ttaMachine()

virtual const TTAMachine::Machine& llvm::TCETargetMachine::ttaMachine ( ) const
inlinevirtual

Definition at line 137 of file TCETargetMachine.hh.

137  {
138  return *ttaMach_;
139  }

References llvm::TCEBaseTargetMachine::ttaMach_.

Referenced by InlineAsmParser::parse(), and llvm::TCETargetLowering::TCETargetLowering().

◆ validStackAccessOperation()

bool llvm::TCETargetMachine::validStackAccessOperation ( const std::string &  opName) const
inline

Returns true if LLVM opcode if valid for stack variable accesses.

Definition at line 196 of file TCETargetMachine.hh.

196  {
197  return plugin_->validStackAccessOperation(opName);
198  }

References plugin_, and llvm::TCETargetMachinePlugin::validStackAccessOperation().

Referenced by llvm::TCERegisterInfo::eliminateFrameIndex().

Here is the call graph for this function:

Member Data Documentation

◆ customLegalizedOps_

std::set<std::pair<unsigned, llvm::MVT::SimpleValueType> > llvm::TCETargetMachine::customLegalizedOps_
private

Definition at line 335 of file TCETargetMachine.hh.

Referenced by customLegalizedOperations(), and setTargetMachinePlugin().

◆ emulationModule_

Module* llvm::TCETargetMachine::emulationModule_

These two parameter passing should be rethought... maybe TTAMach can be avoided by changing pass to use plugin_ instead.

Definition at line 126 of file TCETargetMachine.hh.

Referenced by setEmulationModule().

◆ largestImm_

uint64_t llvm::TCETargetMachine::largestImm_ = std::numeric_limits<int64_t>::min()
private

◆ missingOps_

std::set<std::pair<unsigned, llvm::MVT::SimpleValueType> > llvm::TCETargetMachine::missingOps_
private

llvm::ISD opcode list of operations that have to be expanded.

Definition at line 333 of file TCETargetMachine.hh.

Referenced by missingOperations(), and setTargetMachinePlugin().

◆ plugin_

TCETargetMachinePlugin* llvm::TCETargetMachine::plugin_
private

◆ pluginTool_

PluginTools* llvm::TCETargetMachine::pluginTool_
private

Definition at line 331 of file TCETargetMachine.hh.

Referenced by ~TCETargetMachine().

◆ promotedOps_

std::set<std::pair<unsigned, llvm::MVT::SimpleValueType> > llvm::TCETargetMachine::promotedOps_
private

Definition at line 334 of file TCETargetMachine.hh.

Referenced by promotedOperations(), and setTargetMachinePlugin().

◆ smallestImm_

int64_t llvm::TCETargetMachine::smallestImm_ = std::numeric_limits<int64_t>::max()
private

◆ stackAlignment_

unsigned llvm::TCETargetMachine::stackAlignment_
private

Definition at line 344 of file TCETargetMachine.hh.

Referenced by setStackAlignment(), and stackAlignment().

◆ SupportedFPImmWidth_

int llvm::TCETargetMachine::SupportedFPImmWidth_ = std::numeric_limits<int>::min()
private

Definition at line 341 of file TCETargetMachine.hh.

Referenced by calculateSupportedImmediates(), and canEncodeAsMOVF().


The documentation for this class was generated from the following files:
llvm::TCETargetMachinePlugin::registerIndex
virtual unsigned registerIndex(unsigned dwarfRegNum)=0
Returns name of the physical register index corresponding to a generated register ID.
llvm::TCETargetMachine::rfName
std::string rfName(unsigned dwarfRegNum) const
Definition: TCETargetMachine.hh:204
llvm::TCEPassConfig
Definition: TCETargetMachine.hh:81
llvm::TCETargetMachinePlugin::getMaxuOpcode
virtual int getMaxuOpcode(llvm::SDNode *n) const =0
Options
Definition: Options.hh:51
MachineInfo::maxMemoryAlignment
static int maxMemoryAlignment(const TTAMachine::Machine &mach)
Definition: MachineInfo.cc:261
MachineConnectivityCheck
Definition: MachineConnectivityCheck.hh:69
llvm::TCETargetMachinePlugin::hasSXHW
virtual bool hasSXHW() const =0
llvm::TCETargetMachinePlugin::getMinuOpcode
virtual int getMinuOpcode(llvm::SDNode *n) const =0
llvm::TCETargetMachinePlugin::has8bitLoads
virtual bool has8bitLoads() const =0
llvm::TCETargetMachinePlugin::has16bitLoads
virtual bool has16bitLoads() const =0
llvm::TCETargetMachinePlugin::getLoadOpcode
virtual int getLoadOpcode(const llvm::EVT &vt) const =0
llvm::TCETargetMachinePlugin::hasSQRTF
virtual bool hasSQRTF() const =0
llvm::TCETargetMachinePlugin::getFrameLowering
virtual const TargetFrameLowering * getFrameLowering() const =0
llvm::TCETargetMachinePlugin::hasUREM
virtual bool hasUREM() const =0
llvm::TCETargetMachinePlugin::hasROTR
virtual bool hasROTR() const =0
TTAMachine::Machine::is64bit
bool is64bit() const
Definition: Machine.hh:260
llvm::TCETargetMachinePlugin::getMinOpcode
virtual int getMinOpcode(llvm::SDNode *n) const =0
llvm::TCETargetMachine::emulationModule_
Module * emulationModule_
Definition: TCETargetMachine.hh:126
llvm::TCETargetMachinePlugin::validStackAccessOperation
virtual bool validStackAccessOperation(const std::string &opName) const =0
Returns true if OSAL operation is valid for stack accesses.
llvm::TCETargetMachinePlugin::getIorOpcode
virtual int getIorOpcode(const llvm::EVT &vt) const =0
llvm::TCEBaseTargetMachine::setTTAMach
virtual void setTTAMach(const TTAMachine::Machine *mach)
Definition: TCEStubTargetMachine.hh:94
llvm::TCETargetMachinePlugin::getMaxOpcode
virtual int getMaxOpcode(llvm::SDNode *n) const =0
llvm::TCETargetMachinePlugin::getTargetTransformInfo
virtual TargetTransformInfo getTargetTransformInfo(const Function &F) const =0
llvm::TCETargetMachinePlugin::getSubtarget
virtual const TargetSubtargetInfo * getSubtarget() const =0
llvm::TCETargetMachinePlugin::registerTargetMachine
virtual void registerTargetMachine(TCETargetMachine &tm)=0
Plugin needs target machine for TragetLowering generation.
llvm::TCETargetMachinePlugin::getInstrInfo
virtual const TargetInstrInfo * getInstrInfo() const =0
Conversion::toString
static std::string toString(const T &source)
llvm::TCETargetMachinePlugin::hasUDIV
virtual bool hasUDIV() const =0
llvm::TCETargetMachinePlugin::getTargetLowering
virtual TargetLowering * getTargetLowering() const =0
llvm::TCETargetMachinePlugin::adfXML
virtual const std::string * adfXML()=0
Returns pointer to xml string of the target machine .adf.
llvm::TCETargetMachinePlugin::isLittleEndian
virtual bool isLittleEndian() const =0
llvm::TCETargetMachinePlugin::hasROTL
virtual bool hasROTL() const =0
llvm::TCETargetMachine::setTTAMach
virtual void setTTAMach(const TTAMachine::Machine *mach) override
Definition: TCETargetMachine.hh:131
assert
#define assert(condition)
Definition: Application.hh:86
llvm::TCETargetMachine::customLegalizedOps_
std::set< std::pair< unsigned, llvm::MVT::SimpleValueType > > customLegalizedOps_
Definition: TCETargetMachine.hh:335
llvm::TCETargetMachinePlugin::spDRegNum
virtual unsigned spDRegNum()=0
Returns ID number of the stack pointer register.
llvm::TCETargetMachinePlugin::hasSREM
virtual bool hasSREM() const =0
llvm::TCEBaseTargetMachine::TCEBaseTargetMachine
TCEBaseTargetMachine(const Target &T, const Triple &TT, const llvm::StringRef &CPU, const llvm::StringRef &FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL)
Definition: TCEStubTargetMachine.cc:125
llvm::TCETargetMachinePlugin::hasSHL
virtual bool hasSHL() const =0
llvm::TCETargetMachinePlugin::raPortDRegNum
virtual unsigned raPortDRegNum()=0
Returns ID number of the return address register.
llvm::TCETargetMachinePlugin::is64bit
virtual bool is64bit() const =0
llvm::TCETargetMachine::stackAlignment_
unsigned stackAlignment_
Definition: TCETargetMachine.hh:344
TTAMachine::Machine::immediateUnitNavigator
virtual ImmediateUnitNavigator immediateUnitNavigator() const
Definition: Machine.cc:416
ADFSerializer
Definition: ADFSerializer.hh:49
llvm::TCETargetMachinePlugin::opcode
virtual unsigned opcode(TCEString operationName) const =0
Returns the opcode for the given osal operation, undefined if not found.
TTAMachine::Machine::functionUnitNavigator
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition: Machine.cc:380
llvm::TCETargetMachinePlugin::hasSXQW
virtual bool hasSXQW() const =0
llvm::TCETargetMachinePlugin::hasSHRU
virtual bool hasSHRU() const =0
llvm::TCETargetMachinePlugin::hasSDIV
virtual bool hasSDIV() const =0
llvm::TCETargetMachine::pluginTool_
PluginTools * pluginTool_
Definition: TCETargetMachine.hh:331
llvm::TCETargetMachine::plugin_
TCETargetMachinePlugin * plugin_
Definition: TCETargetMachine.hh:330
llvm::TCETargetMachine::missingOps_
std::set< std::pair< unsigned, llvm::MVT::SimpleValueType > > missingOps_
llvm::ISD opcode list of operations that have to be expanded.
Definition: TCETargetMachine.hh:333
llvm::TCETargetMachinePlugin::getAddOpcode
virtual int getAddOpcode(const llvm::EVT &vt) const =0
llvm::TCETargetMachinePlugin::rfName
virtual std::string rfName(unsigned dwarfRegNum)=0
Returns name of the physical register file corresponding to a generated register ID.
llvm::TCETargetMachinePlugin::hasOperation
virtual bool hasOperation(TCEString operationName) const =0
Returns true in case the target supports the given osal operation.
llvm::TCETargetMachine::smallestImm_
int64_t smallestImm_
Definition: TCETargetMachine.hh:339
llvm::TCETargetMachinePlugin::getDataLayout
virtual const DataLayout * getDataLayout() const
Definition: TCETargetMachinePlugin.hh:223
TTAMachine::Machine::registerFileNavigator
virtual RegisterFileNavigator registerFileNavigator() const
Definition: Machine.cc:450
llvm::TCETargetMachine::calculateSupportedImmediates
void calculateSupportedImmediates()
Definition: TCETargetMachine.cc:389
llvm::TCETargetMachine::promotedOps_
std::set< std::pair< unsigned, llvm::MVT::SimpleValueType > > promotedOps_
Definition: TCETargetMachine.hh:334
llvm::TCETargetMachinePlugin::getDefaultType
virtual MVT::SimpleValueType getDefaultType() const =0
llvm::TCETargetMachinePlugin::canMaterializeConstant
virtual bool canMaterializeConstant(const ConstantInt &ci) const =0
llvm::TCETargetMachinePlugin::getShlOpcode
virtual int getShlOpcode(const llvm::EVT &vt) const =0
llvm::TCEBaseTargetMachine::ttaMach_
const TTAMachine::Machine * ttaMach_
Definition: TCEStubTargetMachine.hh:92
TCEString
Definition: TCEString.hh:53
llvm::TCETargetMachine::registerIndex
unsigned registerIndex(unsigned dwarfRegNum) const
Definition: TCETargetMachine.hh:208
llvm::TCETargetMachinePlugin::hasMUL
virtual bool hasMUL() const =0
TTAMachine::Machine::busNavigator
virtual BusNavigator busNavigator() const
Definition: Machine.cc:356
llvm::TCETargetMachinePlugin::hasSHR
virtual bool hasSHR() const =0
ADFSerializer::readMachine
TTAMachine::Machine * readMachine()
Definition: ADFSerializer.cc:275
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
XMLSerializer::setSourceString
void setSourceString(const std::string &source)
Definition: XMLSerializer.cc:128
llvm::TCETargetMachine::operationName
std::string operationName(unsigned opc) const
Definition: TCETargetMachine.hh:188
TTAMachine::Machine::instructionTemplateNavigator
virtual InstructionTemplateNavigator instructionTemplateNavigator() const
Definition: Machine.cc:428
llvm::TCETargetMachinePlugin::operationName
virtual std::string operationName(unsigned opc) const =0
Returns operation name corresponding to llvm target opcode.
llvm::TCETargetMachine::SupportedFPImmWidth_
int SupportedFPImmWidth_
Definition: TCETargetMachine.hh:341
llvm::TCETargetMachinePlugin::dataASName
virtual std::string dataASName()=0
Returns name of the data address space.
llvm::TCETargetMachinePlugin::getRegisterInfo
virtual const TargetRegisterInfo * getRegisterInfo() const =0
llvm::TCETargetMachine::largestImm_
uint64_t largestImm_
Definition: TCETargetMachine.hh:340
llvm::TCETargetMachinePlugin::llvmRegisterId
virtual unsigned llvmRegisterId(const TCEString &ttaRegister)=0
ImmInfo::registerImmediateLoadWidth
static int registerImmediateLoadWidth(const TTAMachine::RegisterFile &targetRF, bool allowSignExtension=false)
Definition: ImmInfo.cc:326