OpenASIP 2.2
Loading...
Searching...
No Matches
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, std::optional< Reloc::Model > RM, std::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.
 
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,
std::optional< Reloc::Model >  RM,
std::optional< CodeModel::Model >  CM,
CodeGenOpt::Level  OL,
bool  isLittle 
)

Definition at line 148 of file TCETargetMachine.cc.

153 :
154 #else
155 std::optional<Reloc::Model> RM, std::optional<CodeModel::Model> CM, CodeGenOpt::Level OL, bool) :
156 #endif
157 TCEBaseTargetMachine(T, TTriple, CPU, FS, Options,
158 RM?*RM:Reloc::Model::Static, CM?*CM:CodeModel::Small, OL),
159 // Note: Reloc::Model does not have "Default" named member. "Static" is ok?
160 // Note: CodeModel does not have "Default" named member. "Small" is ok?
161 plugin_(NULL), pluginTool_(NULL) {
162}
Definition Model.hh:50
TCETargetMachinePlugin * plugin_

◆ ~TCETargetMachine()

TCETargetMachine::~TCETargetMachine ( )
virtual

The Destructor.

Definition at line 167 of file TCETargetMachine.cc.

167 {
168 if (pluginTool_ != NULL) {
169 delete pluginTool_;
170 pluginTool_ = NULL;
171 }
172}

References pluginTool_.

Member Function Documentation

◆ bitness()

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

Definition at line 298 of file TCETargetMachine.hh.

298 {
299 return plugin_->is64bit() ? 64 : 32;
300 }
virtual bool is64bit() const =0

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

Here is the call graph for this function:

◆ calculateSupportedImmediates()

void TCETargetMachine::calculateSupportedImmediates ( )
private

Definition at line 400 of file TCETargetMachine.cc.

400 {
401 using MCC = MachineConnectivityCheck;
402
403 // FIX ME: All 32 bit regs are assumed to be RF-connected.
404 std::pair<int64_t, uint64_t> moveImm{
405 std::numeric_limits<int64_t>::max(),
406 std::numeric_limits<uint64_t>::min() };
408 for (auto& rf : ttaMach_->registerFileNavigator()) {
409 if (rf->width() != 32) continue;
410
411 for (auto& bus : ttaMach_->busNavigator()) {
412 if (!MCC::busConnectedToRF(*bus, *rf)
413 || bus->immediateWidth() == 0) {
414 continue;
415 }
416
417 if (bus->immediateWidth() >= 32) {
418 moveImm.first = -(1ll << (32-1));
419 moveImm.second = (1ll << 32)-1;
420 break;
421 } else {
422 std::pair<int64_t, uint64_t> imm =
423 MathTools::bitsToIntegerRange<int64_t, uint64_t>(
424 bus->immediateWidth(),
425 bus->signExtends());
426
427 moveImm.first = std::min(moveImm.first, imm.first);
428 moveImm.second = std::max(moveImm.second, imm.second);
429 }
430 }
431 }
432
433 for (auto& iu : ttaMach_->immediateUnitNavigator()) {
434 for (auto& it : ttaMach_->instructionTemplateNavigator()) {
435 int supportedWidth = it->supportedWidth(*iu);
436 if (supportedWidth >= 32) {
437 moveImm.first = -(1ll << (32-1));
438 moveImm.second = (1ll << 32)-1;
439 break;
440 } else {
441 std::pair<int64_t, uint64_t> imm =
442 MathTools::bitsToIntegerRange<int64_t, uint64_t>(
443 supportedWidth, iu->signExtends());
444
445 moveImm.first = std::min(moveImm.first, imm.first);
446 moveImm.second = std::max(moveImm.second, imm.second);
447 }
448 }
449 }
450 smallestImm_ = moveImm.first;
451 largestImm_ = moveImm.second;
452
453 for (auto* rf : ttaMach_->registerFileNavigator()) {
454 if (!MCC::rfConnected(*rf)) continue;
455
456 SupportedFPImmWidth_ = std::max(
459 }
460}
#define assert(condition)
static int registerImmediateLoadWidth(const TTAMachine::RegisterFile &targetRF, bool allowSignExtension=false)
Definition ImmInfo.cc:326
const TTAMachine::Machine * ttaMach_

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 393 of file TCETargetMachine.cc.

393 {
394 int fpBitWidth = static_cast<int>(
395 llvm::APFloat::getSizeInBits(fp.getSemantics()));
396 return fpBitWidth <= SupportedFPImmWidth_;
397}

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 370 of file TCETargetMachine.cc.

370 {
371 // setTargetMachinePlugin() calls calculateSupportedImmediateLimits.
372 assert(ttaMach_ && "setTargetMachinePlugin() was not called");
373 switch (vt.SimpleTy) {
374 case MVT::i1:
375 return (1 <= largestImm_);
376 case MVT::i8:
377 case MVT::i16:
378 case MVT::i32:
379 case MVT::i64:
380 return smallestImm_ == INT64_MIN || largestImm_ == UINT64_MAX ||
381 ((int64_t)smallestImm_ <= val &&
382 (val < 0 || val <= (int64_t)largestImm_));
383 default: assert(false && "Not implemented or supported.");
384 }
385 return false;
386}

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 325 of file TCETargetMachine.hh.

325 {
327 }
virtual bool canMaterializeConstant(const ConstantInt &ci) const =0

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 311 of file TCETargetMachine.cc.

311 {
314
315 assert(options->isMachineFileDefined() && "ADF not defined");
316 assert(options->machineFile() != "" && "ADF not defined");
317 ADFSerializer serializer;
318 serializer.setSourceFile(options->machineFile());
319 return serializer.readMachine();
320}
static MachInfoCmdLineOptions options
Definition MachInfo.cc:46
TTAMachine::Machine * readMachine()
static CmdLineOptions * cmdLineOptions()
void setSourceFile(const std::string &fileName)

References assert, Application::cmdLineOptions(), options, ADFSerializer::readMachine(), and XMLSerializer::setSourceFile().

Here is the call graph for this function:

◆ createPassConfig()

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

Definition at line 356 of file TCETargetMachine.cc.

357 {
358 TCEPassConfig *tpc;
359 tpc = new TCEPassConfig(this, PM, plugin_);
360 // TODO: is this false by default if not set?
361 // false seems to give slightly better performance than true.
362 tpc->setEnableTailMerge(false);
363 return tpc;
364}

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 351 of file TCETargetMachine.cc.

351 {
352 return &customLegalizedOps_;
353}
std::set< std::pair< unsigned, llvm::MVT::SimpleValueType > > customLegalizedOps_

References customLegalizedOps_.

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

◆ dataASName()

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

Definition at line 231 of file TCETargetMachine.hh.

231 {
232 return plugin_->dataASName();
233 }
virtual std::string dataASName()=0
Returns name of the data address space.

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 265 of file TCETargetMachine.hh.

265 {
266 return plugin_->getAddOpcode(vt);
267 }
virtual int getAddOpcode(const llvm::EVT &vt) const =0

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 166 of file TCETargetMachine.hh.

166 {
167 return plugin_->getDataLayout();
168 }
virtual const DataLayout * getDataLayout() const

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 170 of file TCETargetMachine.hh.

170 {
171 return plugin_->getFrameLowering();
172 }
virtual const TargetFrameLowering * getFrameLowering() const =0

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 158 of file TCETargetMachine.hh.

158 {
159 return plugin_->getInstrInfo();
160 }
virtual const TargetInstrInfo * getInstrInfo() const =0

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 273 of file TCETargetMachine.hh.

273 {
274 return plugin_->getIorOpcode(vt);
275 }
virtual int getIorOpcode(const llvm::EVT &vt) const =0

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 467 of file TCETargetMachine.cc.

467 {
468 int laneCount = vt.getVectorElementCount().getKnownMinValue();
469
470 int laneSize = vt.getScalarSizeInBits();
471 int vecSize = laneCount * laneSize;
472 TCEString relaxedName = "LD"; relaxedName << laneSize << "X" << laneCount;
473 TCEString strictName = "LD"; strictName << vecSize;
474 bool allowStrict = vecSize <= align;
475
476 auto fuNav = ttaMach_->functionUnitNavigator();
477 bool found = false;
478 for (int i = 0; i < fuNav.count(); i++) {
479 auto fu = fuNav.item(i);
480 if (fu->hasOperation(relaxedName) && fu->hasAddressSpace()) {
481 auto as = fu->addressSpace();
482 if (as->hasNumericalId(asid)) {
483 found = true;
484 break;
485 }
486 }
487 if (allowStrict) {
488 if (fu->hasOperation(strictName) && fu->hasAddressSpace()) {
489 auto as = fu->addressSpace();
490 if (as->hasNumericalId(asid)) {
491 found = true;
492 break;
493 }
494 }
495 }
496 }
497 return found ? plugin_->getLoadOpcode(vt) : -1;
498}
ComponentType * item(int index) const
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition Machine.cc:380
virtual int getLoadOpcode(const llvm::EVT &vt) const =0

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 257 of file TCETargetMachine.hh.

257 {
258 return plugin_->getMaxOpcode(n);
259 }
virtual int getMaxOpcode(llvm::SDNode *n) const =0

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 261 of file TCETargetMachine.hh.

261 {
262 return plugin_->getMaxuOpcode(n);
263 }
virtual int getMaxuOpcode(llvm::SDNode *n) const =0

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 249 of file TCETargetMachine.hh.

249 {
250 return plugin_->getMinOpcode(n);
251 }
virtual int getMinOpcode(llvm::SDNode *n) const =0

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 253 of file TCETargetMachine.hh.

253 {
254 return plugin_->getMinuOpcode(n);
255 }
virtual int getMinuOpcode(llvm::SDNode *n) const =0

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 162 of file TCETargetMachine.hh.

162 {
163 return plugin_->getRegisterInfo();
164 }
virtual const TargetRegisterInfo * getRegisterInfo() const =0

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 269 of file TCETargetMachine.hh.

269 {
270 return plugin_->getShlOpcode(vt);
271 }
virtual int getShlOpcode(const llvm::EVT &vt) const =0

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 148 of file TCETargetMachine.hh.

148 {
149 // compiler does not know it's derived without the plugin,
150 // but this class cannow include the plugin.
151 return reinterpret_cast<const TCESubtarget*>(plugin_->getSubtarget());
152 }
virtual const TargetSubtargetInfo * getSubtarget() const =0

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 154 of file TCETargetMachine.hh.

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

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 173 of file TCETargetMachine.hh.

173 {
174 return plugin_->getTargetLowering();
175 }
virtual TargetLowering * getTargetLowering() const =0

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 187 of file TCETargetMachine.hh.

187 {
189 }
virtual TargetTransformInfo getTargetTransformInfo(const Function &F) const =0

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

Here is the call graph for this function:

◆ has16bitLoads()

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

Definition at line 294 of file TCETargetMachine.hh.

294 {
295 return plugin_->has16bitLoads();
296 }
virtual bool has16bitLoads() const =0

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 290 of file TCETargetMachine.hh.

290 {
291 return plugin_->has8bitLoads();
292 }
virtual bool has8bitLoads() const =0

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

Definition at line 204 of file TCETargetMachine.hh.

204 {
206 }
virtual bool hasOperation(TCEString operationName) const =0
Returns true in case the target supports the given osal operation.
std::string operationName(unsigned opc) const

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

Referenced by llvm::TCERegisterInfo::eliminateFrameIndex(), llvm::TCETargetLowering::LowerBuildVector(), and llvm::TCETargetLowering::LowerShift().

Here is the call graph for this function:

◆ largestImmValue()

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

Definition at line 318 of file TCETargetMachine.hh.

318 {
319 assert(ttaMach_ && "setTargetMachinePlugin() was not called");
320 return largestImm_;
321 }

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

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

◆ llvmRegisterId()

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

Definition at line 225 of file TCETargetMachine.hh.

225 {
226 return plugin_->llvmRegisterId(ttaRegister);
227 }
virtual unsigned llvmRegisterId(const TCEString &ttaRegister)=0

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 330 of file TCETargetMachine.cc.

330 {
331 return &missingOps_;
332}
std::set< std::pair< unsigned, llvm::MVT::SimpleValueType > > missingOps_
llvm::ISD opcode list of operations that have to be expanded.

References missingOps_.

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

◆ opcode()

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

Definition at line 245 of file TCETargetMachine.hh.

245 {
247 }
virtual unsigned opcode(TCEString operationName) const =0
Returns the opcode for the given osal operation, undefined if not found.

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 192 of file TCETargetMachine.hh.

192 {
193 return plugin_->operationName(opc);
194 }
virtual std::string operationName(unsigned opc) const =0
Returns operation name corresponding to llvm target opcode.

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 342 of file TCETargetMachine.cc.

342 {
343 return &promotedOps_;
344}
std::set< std::pair< unsigned, llvm::MVT::SimpleValueType > > promotedOps_

References promotedOps_.

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

◆ raPortDRegNum()

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

Definition at line 235 of file TCETargetMachine.hh.

235 {
236 return plugin_->raPortDRegNum();
237 }
virtual unsigned raPortDRegNum()=0
Returns ID number of the return address register.

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 212 of file TCETargetMachine.hh.

212 {
213 return plugin_->registerIndex(dwarfRegNum);
214 }
virtual unsigned registerIndex(unsigned dwarfRegNum)=0
Returns name of the physical register index corresponding to a generated register ID.

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 220 of file TCETargetMachine.hh.

220 {
221 return rfName(dwarfRegNum) + "."
222 + std::to_string(registerIndex(dwarfRegNum));
223 }
std::string rfName(unsigned dwarfRegNum) const
unsigned registerIndex(unsigned dwarfRegNum) const

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 208 of file TCETargetMachine.hh.

208 {
209 return plugin_->rfName(dwarfRegNum);
210 }
virtual std::string rfName(unsigned dwarfRegNum)=0
Returns name of the physical register file corresponding to a generated register ID.

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 131 of file TCETargetMachine.hh.

131 {
132 emulationModule_ = mod;
133 }

References emulationModule_.

Referenced by LLVMBackend::compile().

◆ setStackAlignment()

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

Definition at line 277 of file TCETargetMachine.hh.

277 {
278 stackAlignment_ = align;
279 }

References stackAlignment_.

Referenced by LLVMBackend::compile().

◆ setTargetMachinePlugin()

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

Definition at line 175 of file TCETargetMachine.cc.

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

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 135 of file TCETargetMachine.hh.

136 {
139 }
virtual void setTTAMach(const TTAMachine::Machine *mach)

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 314 of file TCETargetMachine.hh.

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

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

◆ spDRegNum()

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

Definition at line 241 of file TCETargetMachine.hh.

241 {
242 return plugin_->spDRegNum();
243 }
virtual unsigned spDRegNum()=0
Returns ID number of the stack pointer register.

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 124 of file TCETargetMachine.hh.

124{ return *plugin_; }

References plugin_.

Referenced by ConstantTransformer::runOnMachineFunction().

◆ ttaMachine()

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

Definition at line 141 of file TCETargetMachine.hh.

141 {
142 return *ttaMach_;
143 }

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 200 of file TCETargetMachine.hh.

200 {
201 return plugin_->validStackAccessOperation(opName);
202 }
virtual bool validStackAccessOperation(const std::string &opName) const =0
Returns true if OSAL operation is valid for stack accesses.

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 339 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 130 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 337 of file TCETargetMachine.hh.

Referenced by missingOperations(), and setTargetMachinePlugin().

◆ plugin_

TCETargetMachinePlugin* llvm::TCETargetMachine::plugin_
private

◆ pluginTool_

PluginTools* llvm::TCETargetMachine::pluginTool_
private

Definition at line 335 of file TCETargetMachine.hh.

Referenced by ~TCETargetMachine().

◆ promotedOps_

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

Definition at line 338 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 348 of file TCETargetMachine.hh.

Referenced by setStackAlignment(), and stackAlignment().

◆ SupportedFPImmWidth_

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

Definition at line 345 of file TCETargetMachine.hh.

Referenced by calculateSupportedImmediates(), and canEncodeAsMOVF().


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