OpenASIP  2.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
LLVMBackend Class Reference

#include <LLVMBackend.hh>

Collaboration diagram for LLVMBackend:
Collaboration graph

Public Member Functions

 LLVMBackend (bool useInstalledVersion, TCEString tempDir)
 
virtual ~LLVMBackend ()
 
TTAProgram::Programcompile (const std::string &bytecodeFile, const std::string &emulationBytecodeFile, TTAMachine::Machine &target, int optLevel, bool debug=false, InterPassData *ipData=NULL)
 
TTAProgram::Programcompile (llvm::Module &module, llvm::Module *emulationModule, llvm::TCETargetMachinePlugin &plugin, TTAMachine::Machine &target, int optLevel, bool debug=false, InterPassData *ipData=NULL)
 
TTAProgram::Programschedule (const std::string &bytecodeFile, const std::string &emulationBytecodeFile, TTAMachine::Machine &target, int optLevel=2, bool debug=false, SchedulingPlan *plan=NULL)
 
llvm::TCETargetMachinePlugincreatePlugin (const TTAMachine::Machine &target)
 
std::string pluginFilename (const TTAMachine::Machine &target)
 

Static Public Member Functions

static OperationDAGSelector::OperationSet llvmRequiredOpset (bool includeFloatOps, bool isLittleEndian, bool bits64)
 

Private Member Functions

unsigned maxAllocaAlignment (const llvm::Module &mod) const
 

Private Attributes

bool useInstalledVersion_
 Assume we are running an installed TCE version. More...
 
PluginTools pluginTool_
 Plugin tool for loading target machine plugin. More...
 
TCEString cachePath_
 Path to the cache where precompiled plugins are stored. More...
 
TCEString tempDir_
 Directory to store temporary files. More...
 
LLVMTCECmdLineOptionsoptions_
 
InterPassDataipData_
 

Static Private Attributes

static const std::string TBLGEN_INCLUDES = ""
 
static const std::string PLUGIN_PREFIX = "tcecc-"
 
static const std::string PLUGIN_SUFFIX = ".so"
 
static const TCEString CXX0X_FLAG = "-std=c++0x"
 
static const TCEString CXX11_FLAG = "-std=c++11"
 
static const TCEString CXX14_FLAG = "-std=c++14"
 

Detailed Description

LLVM compiler backend and compiler interface for TCE.

Definition at line 63 of file LLVMBackend.hh.

Constructor & Destructor Documentation

◆ LLVMBackend()

LLVMBackend::LLVMBackend ( bool  useInstalledVersion,
TCEString  tempDir 
)

Constructor.

Parameters
useInstalledVersionShould be true in case we are running an installed TCE (not from the source/build tree).
tempDirAn existing directory where to store temporary files. The directory should be removed by the caller after use.

Definition at line 324 of file LLVMBackend.cc.

324  :
325  useInstalledVersion_(useInstalledVersion), tempDir_(tempDir) {
326 
328 
329  options_ =
331 
332  if (options_ != NULL)
334 
335  PassRegistry &Registry = *llvm::PassRegistry::getPassRegistry();
336  llvm::initializeCore(Registry);
337  llvm::initializeScalarOpts(Registry);
338  llvm::initializeIPO(Registry);
339  llvm::initializeAnalysis(Registry);
340  llvm::initializeTransformUtils(Registry);
341  llvm::initializeInstCombine(Registry);
342  llvm::initializeTarget(Registry);
343 }

References LLVMTCECmdLineOptions::backendCacheDir(), cachePath_, Application::cmdLineOptions(), Environment::llvmtceCachePath(), and options_.

Here is the call graph for this function:

◆ ~LLVMBackend()

LLVMBackend::~LLVMBackend ( )
virtual

Destructor.

Definition at line 348 of file LLVMBackend.cc.

348  {
349 }

Member Function Documentation

◆ compile() [1/2]

TTAProgram::Program * LLVMBackend::compile ( const std::string &  bytecodeFile,
const std::string &  emulationBytecodeFile,
TTAMachine::Machine target,
int  optLevel,
bool  debug = false,
InterPassData ipData = NULL 
)

Compiles bytecode for the given target machine.

Parameters
bytecodeFileFull path to the llvm bytecode file to compile.
targetTarget machine to compile the bytecode for.
optLevelOptimization level.
debugIf true, enable LLVM debug printing.

Definition at line 360 of file LLVMBackend.cc.

363  {
364  // Check target machine
365  MachineValidator validator(target);
366  std::set<MachineValidator::ErrorCode> checks;
367  checks.insert(MachineValidator::GCU_MISSING);
368  checks.insert(MachineValidator::GCU_AS_MISSING);
370  checks.insert(MachineValidator::PC_PORT_MISSING);
371  checks.insert(MachineValidator::RA_PORT_MISSING);
372  checks.insert(MachineValidator::FU_PORT_MISSING);
373  MachineValidatorResults* res = validator.validate(checks);
374 
375  if (res->errorCount() > 0) {
376  std::string msg;
377  for (int i = 0; i < res->errorCount(); i++) {
378  msg += res->error(i).second + "\n";
379  }
380  delete res; res = NULL;
381  throw CompileError(__FILE__, __LINE__, __func__, msg);
382  }
383 
384  // Load bytecode file.
385  std::string errMsgParse;
386  LLVMContext context;
387 
388  std::unique_ptr<llvm::Module> m;
389 
390  ErrorOr<std::unique_ptr<MemoryBuffer>> bufferPtr =
391  MemoryBuffer::getFileOrSTDIN(bytecodeFile.c_str());
392 
393  if (std::error_code ec = bufferPtr.getError()) {
394  std::string msg = "Error reading bytecode file: " + bytecodeFile +
395  "\n" + ec.message();
396  throw CompileError(__FILE__, __LINE__, __func__, msg);
397  }
398 
399  // todo: what are these buffers..
400  std::unique_ptr<MemoryBuffer> buffer = std::move(bufferPtr.get());
401  Expected<std::unique_ptr<llvm::Module> > module =
402  parseBitcodeFile(buffer.get()->getMemBufferRef(), context);
403  if (Error E = module.takeError()) {
404  THROW_EXCEPTION(CompileError, "Error parsing bytecode file: "
405  + bytecodeFile);
406  }
407 
408  // TODO: why does this work? it should not?
409 // m.reset(module.get().get());
410  m = std::move(module.get());
411 
412  if (m.get() == 0) {
413  std::string msg = "Error parsing bytecode file: " + bytecodeFile +
414  "\n" + errMsgParse;
415  throw CompileError(__FILE__, __LINE__, __func__, msg);
416  }
417 
418  std::unique_ptr<Module> emuM;
419 
420  if (!emulationBytecodeFile.empty()) {
421  ErrorOr<std::unique_ptr<MemoryBuffer>> emuBufferPtr =
422  MemoryBuffer::getFileOrSTDIN(emulationBytecodeFile.c_str());
423 
424  if (std::error_code ec = emuBufferPtr.getError()) {
425  std::string msg = "Error reading bytecode file: " +
426  emulationBytecodeFile +
427  " of emulation library:\n" + ec.message();
428  throw CompileError(__FILE__, __LINE__, __func__, msg);
429  }
430 
431  std::unique_ptr<MemoryBuffer> emuBuffer =
432  std::move(emuBufferPtr.get());
433  Expected<std::unique_ptr<Module> > module =
434  parseBitcodeFile(emuBuffer.get()->getMemBufferRef(), context);
435  if (Error E = module.takeError()) {
436  THROW_EXCEPTION(CompileError, "Error parsing bytecode file: " +
437  emulationBytecodeFile + " of emulation library \n"
438  + errMsgParse);
439  }
440 
441  emuM = std::move(module.get());
442  if (emuM.get() == 0) {
443  std::string msg = "Error parsing bytecode file: " +
444  emulationBytecodeFile + " of emulation library \n"
445  + errMsgParse;
446  throw CompileError(__FILE__, __LINE__, __func__, msg);
447  }
448  }
449 
450  // Create target machine plugin.
451 #if (!defined(HAVE_CXX11) && !defined(HAVE_CXX0X))
452  std::auto_ptr<TCETargetMachinePlugin> plugin(createPlugin(target));
453 #else
454  std::unique_ptr<TCETargetMachinePlugin> plugin(createPlugin(target));
455 #endif
456 
457  TTAProgram::Program* result = NULL;
458  try {
459  // Compile.
460  result =
461  compile(*m.release(), emuM.release(), *plugin, target, optLevel,
462  debug, ipData);
463  } catch (...) {
464  // delete the backend plugin if we don't want to save it
465  // Let's hope this doesn't crash as the plugin is loaded to the
466  // current process. TCETargetMachinePlugin dtor should unload it.
467  if (!options_->saveBackendPlugin()) {
468  TCEString pluginPath =
469  cachePath_ + DS + pluginFilename(target);
471  }
472  delete res; res = NULL;
473 
474  throw;
475  }
476 
477  // delete the backend plugin if we don't want to save it
478  // Let's hope this doesn't crash as the plugin is loaded to the
479  // current process. TCETargetMachinePlugin dtor should unload it.
480  if (!options_->saveBackendPlugin()) {
481  TCEString pluginPath =
482  cachePath_ + DS + pluginFilename(target);
484  }
485  delete res; res = NULL;
486 
487  return result;
488 }

References __func__, cachePath_, createPlugin(), DS, MachineValidatorResults::error(), MachineValidatorResults::errorCount(), MachineValidator::FU_PORT_MISSING, MachineValidator::GCU_AS_MISSING, MachineValidator::GCU_MISSING, options_, MachineValidator::PC_PORT_MISSING, pluginFilename(), MachineValidator::RA_PORT_MISSING, FileSystem::removeFileOrDirectory(), LLVMTCECmdLineOptions::saveBackendPlugin(), THROW_EXCEPTION, MachineValidator::USED_IO_NOT_BOUND, and MachineValidator::validate().

Referenced by main().

Here is the call graph for this function:

◆ compile() [2/2]

TTAProgram::Program * LLVMBackend::compile ( llvm::Module &  module,
llvm::Module *  emulationModule,
llvm::TCETargetMachinePlugin plugin,
TTAMachine::Machine target,
int  optLevel,
bool  debug = false,
InterPassData ipData = NULL 
)

Compiles given llvm program module for target machine using the given target machine plugin.

Parameters
moduleLLVM module to compile.
pluginTarget architecture compiler plugin.
targetTarget architecture as Machine object.
optLevelOptimization level.
debugIf true, enable LLVM debug printing.
Returns
Module compiled to program for the target architecture.

This is quite straight copy how llc actually creates passes for target.

Definition at line 578 of file LLVMBackend.cc.

581  {
582  ipData_ = ipData;
583  // TODO: fixme
584  std::string targetStr = "tce-llvm";
585  if (target.isLittleEndian()) {
586  if (target.is64bit()) {
587  targetStr = "tcele64-llvm";
588  } else {
589  targetStr = "tcele-llvm";
590  }
591  }
592 
593  std::string errorStr;
594 
595  std::string featureString ="";
596 
597  // run registering code, which should have been done by LLVM
598 
599  // Initialize targets first. needs
600  // #include <llvm/Target/TargetSelecty.h>,
601  // whose defines collide with tce_config.h
602 
603  //InitializeAllTargets();
604  //InitializeAllAsmPrinters();
605 
606  // Register target to llvm for using lookupTarget
609 
610  // get registered target machine and set plugin.
611  const Target* tceTarget =
612  TargetRegistry::lookupTarget(targetStr, errorStr);
613  Target* nonconst_target = const_cast<Target*>(tceTarget);
614 
615  if (!tceTarget) {
616  errs() << errorStr << "\n";
617  return NULL;
618  }
619 
620  TargetRegistry::RegisterMCRegInfo(
621  *nonconst_target, createTCEMCRegisterInfo);
622  TargetRegistry::RegisterMCInstrInfo(
623  *nonconst_target, createTCEMCInstrInfo);
624  TargetRegistry::RegisterMCSubtargetInfo(
625  *nonconst_target, createTCEMCSubtargetInfo);
626 
627  std::string cpuStr = "tce";
628 
629  TargetOptions Options;
630  Options.UnsafeFPMath = false; //EnableUnsafeFPMath;
631  Options.NoInfsFPMath = false; //EnableNoInfsFPMath;
632  Options.NoNaNsFPMath = false; //EnableNoNaNsFPMath;
633  Options.HonorSignDependentRoundingFPMathOption = false;
634  // the stack alignment depends on the widest aligned
635  // memory operations supported by the machine and
636  // on the maximum alignment of any stack object in
637  // the program, recompute this now as the llvm::Module has
638  // been loaded
639  unsigned maxMachineAlignment = (unsigned)MachineInfo::maxMemoryAlignment(target);
640  module.setOverrideStackAlignment(maxMachineAlignment);
642 
643  if (maxAllocaAlignment(module) > maxMachineAlignment) {
645  "Alloca object requires larger stack alignment than widest "
646  "memory operation. "
647  "We were hoping this wouldn't happen, because now stack "
648  "alignment cannot be "
649  "figured out just from adf-file. ATM (5/20) this assumption is "
650  "made here, "
651  "at tcecc::getStackAlignment and at CodeGenerator.cc "
652  "constructor.");
653  }
654  } else {
655  module.setOverrideStackAlignment(
656  std::max(maxMachineAlignment, maxAllocaAlignment(module)));
657  }
658  Options.GuaranteedTailCallOpt = true; //EnableGuaranteedTailCallOpt;
659 
660  TCETargetMachine* targetMachine =
661  static_cast<TCETargetMachine*>(
662  tceTarget->createTargetMachine(
663  targetStr, cpuStr, featureString, Options,
664  Reloc::Model::Static));
665 
666  if (!targetMachine) {
667  errs() << "Could not create tce target machine" << "\n";
668  return NULL;
669  }
670  // The way to override the stack alignment was
671  // changed in LLVM commit 787ee457173c. It's easiest
672  // we just pass it through TCETargetMachine for now
673  // even though it's really module specific.
674  targetMachine->setStackAlignment(
675  std::max((unsigned)(target.is64bit() ? 8 : 4),
676  module.getOverrideStackAlignment()));
677 
678  // This hack must be cleaned up before adding TCE target to llvm upstream
679  // these are needed by TCETargetMachine::addInstSelector passes
680  targetMachine->setTargetMachinePlugin(plugin, target);
681  targetMachine->setEmulationModule(emulationModule);
682 
683  /**
684  * This is quite straight copy how llc actually creates passes for target.
685  */
686 
687  llvm::legacy::PassManager Passes;
688 #define addPass(P) Passes.add(P)
689 
690  llvm::raw_fd_ostream sos(STDOUT_FILENO, false);
691 
692  targetMachine->addPassesToEmitFile(
693  Passes, sos, nullptr, CGFT_AssemblyFile);
694 
695 
696  // Add alias analysis pass that is distributed with pocl library.
698  ImmutablePass* (*creator)();
699  std::string file = options_->workItemAAFile();
700  bool foundAA = true;
701  try {
703  "create_workitem_aa_plugin", creator, file);
704  } catch(Exception& e) {
705  std::string msg = std::string() +
706  "Unable to load plugin file '" +
707  file + "'. Error: " + e.errorMessageStack();
708  if (Application::verboseLevel() > 0) {
710  << msg << std::endl;
712  "Most likely too old version of POCL. \
713  TCE will continue without work item alias analysis." <<
714  std::endl;
715  }
716  foundAA = false;
717  }
718  if (foundAA)
719  addPass(creator());
720  }
721  if (ipData_ != NULL) {
722  // Stack pointer datum.
723  RegDatum* spReg = new RegDatum;
724  spReg->first = plugin.rfName(plugin.spDRegNum());
725  spReg->second = plugin.registerIndex(plugin.spDRegNum());
726  ipData_->setDatum("STACK_POINTER", spReg);
727 
728  // FP register datum.
729  RegDatum* fpReg = new RegDatum;
730  fpReg->first = plugin.rfName(plugin.fpDRegNum());
731  fpReg->second = plugin.registerIndex(plugin.fpDRegNum());
732  ipData_->setDatum("FRAME_POINTER", fpReg);
733 
734  // Return value register datum.
735  RegDatum* rvReg = new RegDatum;
736  rvReg->first = plugin.rfName(plugin.rvDRegNum());
737  rvReg->second = plugin.registerIndex(plugin.rvDRegNum());
738  ipData_->setDatum("RV_REGISTER", rvReg);
739 
740  std::vector<unsigned> paramRegs = plugin.getParamDRegNums();
741  for (unsigned int i = 0; i < paramRegs.size(); i++) {
742  RegDatum* p = new RegDatum;
743  p->first = plugin.rfName(paramRegs[i]);
744  p->second = plugin.registerIndex(paramRegs[i]);
745  TCEString datumName = "IPARAM";
746  datumName << i+2;
747  ipData_->setDatum(datumName, p);
748  }
749 
750  std::vector<unsigned> vectorRVRegs = plugin.getVectorRVDRegNums();
751  for (unsigned int i = 0; i < vectorRVRegs.size(); i++) {
752  RegDatum* p = new RegDatum;
753  p->first = plugin.rfName(vectorRVRegs[i]);
754  p->second = plugin.registerIndex(vectorRVRegs[i]);
755  TCEString datumName = "VRV_REGISTER";
756  datumName << i;
757  ipData_->setDatum(datumName, p);
758  }
759 
760  // TODO: add datums for vector RV registers.
761  }
762 
763  // Find the inner loops. Must be executed with a separate
764  // PassManager as mixing module passes and loop passes does
765  // not seem to magically work.
766  // TODO: is it safe to trust the llvm::BasicBlock pointers are
767  // intact until we run the actual code generation? The loop info
768  // is stored using those as indices.
769  llvm::legacy::PassManager FPasses;
770  InnerLoopFinder* loopFinder = new InnerLoopFinder();
771  FPasses.add(loopFinder);
772  FPasses.run(module);
773 
774  LLVMTCEBuilder* builder = NULL;
775 
776  // This is not actuall LLVM pass so we can not get actual AA.
777  // It will be picked later, for now just passing NULL.
778  // When LLVMTCEIRBuilder is called from TCEScheduler it will require
779  // AA parameter.
780  AliasAnalysis* AA = NULL;
781  LLVMTCEIRBuilder* b =
782  new LLVMTCEIRBuilder(*targetMachine, &target, *ipData, AA);
783  b->setInnerLoopFinder(loopFinder);
784  builder = b;
785 
786  if (options_ != NULL && options_->isInitialStackPointerValueSet()) {
789  }
790  addPass(new ConstantTransformer(target));
791  addPass(builder);
792  Passes.run(module);
793 
794  if (ipData_ != NULL) {
795  if (builder->isProgramUsingRestrictedPointers()) {
796  ipData_->setDatum("RESTRICTED_POINTERS_FOUND", NULL);
797  }
798  }
799  builder->deleteDeadProcedures();
800  return builder->result();
801 }

References abortWithError, addPass, LLVMTCECmdLineOptions::assumeADFStackAlignment(), createTCEMCInstrInfo(), createTCEMCRegisterInfo(), createTCEMCSubtargetInfo(), llvm::LLVMTCEBuilder::deleteDeadProcedures(), Exception::errorMessageStack(), llvm::TCETargetMachinePlugin::fpDRegNum(), llvm::TCETargetMachinePlugin::getParamDRegNums(), llvm::TCETargetMachinePlugin::getVectorRVDRegNums(), PluginTools::importSymbol(), LLVMTCECmdLineOptions::initialStackPointerValue(), ipData_, TTAMachine::Machine::is64bit(), LLVMTCECmdLineOptions::isInitialStackPointerValueSet(), TTAMachine::Machine::isLittleEndian(), llvm::LLVMTCEBuilder::isProgramUsingRestrictedPointers(), LLVMTCECmdLineOptions::isWorkItemAAFileDefined(), LLVMInitializeTCETarget(), LLVMInitializeTCETargetInfo(), Application::logStream(), maxAllocaAlignment(), MachineInfo::maxMemoryAlignment(), options_, pluginTool_, llvm::TCETargetMachinePlugin::registerIndex(), llvm::LLVMTCEBuilder::result(), llvm::TCETargetMachinePlugin::rfName(), llvm::TCETargetMachinePlugin::rvDRegNum(), InterPassData::setDatum(), llvm::TCETargetMachine::setEmulationModule(), llvm::LLVMTCEBuilder::setInitialStackPointerValue(), llvm::LLVMTCEIRBuilder::setInnerLoopFinder(), llvm::TCETargetMachine::setStackAlignment(), llvm::TCETargetMachine::setTargetMachinePlugin(), llvm::TCETargetMachinePlugin::spDRegNum(), Application::verboseLevel(), and LLVMTCECmdLineOptions::workItemAAFile().

Here is the call graph for this function:

◆ createPlugin()

TCETargetMachinePlugin * LLVMBackend::createPlugin ( const TTAMachine::Machine target)

Creates TCETargetMachinePlugin for target architecture.

Parameters
targetTarget machine to build plugin for.

Definition at line 809 of file LLVMBackend.cc.

809  {
810  std::string pluginFile = pluginFilename(target);
811  std::string pluginFileName;
812  std::string tempPluginFileName;
813 
814  // Create cache directory if it doesn't exist.
817  }
818 
819  pluginFileName = cachePath_ + DS + pluginFile;
820  tempPluginFileName = cachePath_ + DS + pluginFile + ".%%_%%_%%_%%";
821 
822  llvm::SmallString<128> ResultPath;
823  llvm::sys::fs::createUniqueFile(llvm::Twine(tempPluginFileName), ResultPath);
824  tempPluginFileName = ResultPath.str().str();
825 
826  // Static plugin source files path.
827  std::string srcsPath = "";
828  std::string pluginIncludeFlags = "";
829  if (useInstalledVersion_) {
830  srcsPath = Application::installationDir() + DS + "include" + DS;
831  pluginIncludeFlags = " -I" + srcsPath;
832  } else {
833  srcsPath = std::string(TCE_SRC_ROOT) + DS +
834  "src" + DS + "applibs" + DS + "LLVMBackend" + DS + "plugin" + DS;
835 
836  pluginIncludeFlags =
837  " -I" + srcsPath +
838  " -I" + std::string(TCE_SRC_ROOT) + DS + " " +
839  " -I" + std::string(TCE_SRC_ROOT) + DS + "src" + DS + "tools" +
840  " -I" + std::string(TCE_SRC_ROOT) + DS + "src" + DS + "base" +
841  DS + "mach"
842  " -I" + std::string(TCE_SRC_ROOT) + DS + "src" + DS +
843  "applibs" + DS + "LLVMBackend" + DS + " " +
844 
845  " -I" + std::string(TCE_SRC_ROOT) + DS + "src" + DS +
846  "applibs" + DS + "mach" + " " +
847 
848  " -I" + std::string(TCE_SRC_ROOT) + DS + "src" + DS +
849  "applibs" + DS + "Scheduler" + DS + " " +
850 
851  " -I" + std::string(TCE_SRC_ROOT) + DS + "src" + DS +
852  "applibs" + DS + "Scheduler" + DS + "Algorithms" + " " +
853 
854  " -I`" LLVM_CONFIG " --includedir`" + DS + "llvm" + DS +
855  "Target" + DS;
856 
857  }
858 
859 
860  if (FileSystem::fileExists(pluginFileName) &&
861  FileSystem::fileIsReadable(pluginFileName)) {
862 
863  try {
865  pluginTool_.registerModule(pluginFile);
866  TCETargetMachinePlugin* (*creator)();
868  "create_tce_backend_plugin", creator, pluginFile);
869 
870  return creator();
871  } catch(Exception& e) {
872  if (Application::verboseLevel() > 0) {
874  << "Unable to load plugin file " << pluginFileName
875  << ": " << e.errorMessage() << ", "
876  << "regenerating..." << std::endl;
877  }
878  }
879  }
880 
881  if (!options_->useOldBackendSources()) {
882  // Create target instruction and register definitions in .td files.
883  TDGen* pluginGenPtr = new TDGen(target);
884 
885  try {
886  pluginGenPtr->generateBackend(tempDir_);
887  delete pluginGenPtr;
888  } catch(Exception& e) {
889  std::string msg =
890  "Failed to build compiler plugin for target architecture: ";
891  msg += e.errorMessage();
892  CompileError ne(__FILE__, __LINE__, __func__, msg);
893  ne.setCause(e);
894  throw ne;
895  }
896  }
897  std::string tblgenbin = "llvm-tblgen";
898 
899  // Generate TCEGenRegisterNames.inc
900  std::string tblgenCmd;
901 
902  if (useInstalledVersion_) {
903  // This is quite ugly. LLVM include dir is determined by
904  // executing llvm-config in the commandline. This doesn't
905  // work if llvm-config is not found in path.
906  // First check that llvm-config is found in path.
907  if (system(LLVM_CONFIG " --version")) {
908  std::string msg = "Unable to determine llvm include dir. "
909  LLVM_CONFIG " not found in path";
910 
911  throw CompileError(__FILE__, __LINE__, __func__, msg);
912  }
913  // /usr/include needs to be last in case there is old llvm installation
914  // from packages
915  tblgenCmd = tblgenbin + " " + TBLGEN_INCLUDES +
916  pluginIncludeFlags +
917  " -I" + tempDir_ +
918  " -I`" LLVM_CONFIG " --includedir`" +
919  " -I`" LLVM_CONFIG " --includedir`/Target" +
920  " -I`" LLVM_CONFIG " --includedir`/llvm/Target" +
921  " -I/usr/include ";
922  } else {
923  tblgenCmd = tblgenbin + " " + TBLGEN_INCLUDES +
924  pluginIncludeFlags +
925  " -I" + tempDir_ +
926  " -I" + LLVM_INCLUDE_DIR +
927  " -I" + LLVM_INCLUDE_DIR + "/Target" +
928  " -I" + LLVM_INCLUDE_DIR + "/llvm/Target";
929  }
930 
931  tblgenCmd += " " + tempDir_ + FileSystem::DIRECTORY_SEPARATOR + "TCE.td";
932 
933  // Generate TCEGenRegisterInfo.inc
934  std::string cmd = tblgenCmd +
935  " -gen-register-info" +
937  "TCEGenRegisterInfo.inc";
938 
939  if (Application::verboseLevel() > 0) {
940  Application::logStream() << "LLVMBackend: " << cmd << std::endl;
941  }
942  int ret = system(cmd.c_str());
943  if (ret) {
944  std::string msg = std::string() +
945  "Failed to build compiler plugin for target architecture.\n" +
946  "Failed command was: " + cmd;
947 
948  throw CompileError(__FILE__, __LINE__, __func__, msg);
949  }
950 
951  // Generate TCEGenInstrInfo.inc
952  cmd = tblgenCmd +
953  " -gen-instr-info" +
955  "TCEGenInstrInfo.inc";
956 
957  ret = system(cmd.c_str());
958  if (ret) {
959  std::string msg = std::string() +
960  "Failed to build compiler plugin for target architecture.\n" +
961  "Failed command was: " + cmd;
962 
963  throw CompileError(__FILE__, __LINE__, __func__, msg);
964  }
965 
966  // Generate TCEGenDAGISel.inc
967  cmd = tblgenCmd +
968  " -gen-dag-isel" +
970  "TCEGenDAGISel.inc";
971 
972  ret = system(cmd.c_str());
973  if (ret) {
974  std::string msg = std::string() +
975  "Failed to build compiler plugin for target architecture.\n" +
976  "Failed command was: " + cmd;
977 
978  throw CompileError(__FILE__, __LINE__, __func__, msg);
979  }
980 
981 
982  // Generate TCEGenCallingConv.inc
983  cmd = tblgenCmd +
984  " -gen-callingconv" +
986  "TCEGenCallingConv.inc";
987 
988  ret = system(cmd.c_str());
989  if (ret) {
990  std::string msg = std::string() +
991  "Failed to build compiler plugin for target architecture.\n" +
992  "Failed command was: " + cmd;
993 
994  throw CompileError(__FILE__, __LINE__, __func__, msg);
995  }
996 
997  // Generate TCESuBTargetInfo.inc
998  cmd = tblgenCmd +
999  " -gen-subtarget" +
1001  "TCEGenSubTargetInfo.inc";
1002 
1003  ret = system(cmd.c_str());
1004  if (ret) {
1005  std::string msg =
1006  std::string() +
1007  "Failed to build compiler plugin for target architecture.\n" +
1008  "Failed command was: " + cmd;
1009 
1010  throw CompileError(__FILE__, __LINE__, __func__, msg);
1011  }
1012 
1013  // Generate TCEDFAPacketizer.inc
1014  cmd = tblgenCmd + " -gen-dfa-packetizer" + " -o " + tempDir_ +
1015  FileSystem::DIRECTORY_SEPARATOR + "TCEGenDFAPacketizer.inc";
1016 
1017  ret = system(cmd.c_str());
1018  if (ret) {
1019  std::string msg =
1020  std::string() +
1021  "Failed to build compiler plugin for target architecture.\n" +
1022  "Failed command was: " + cmd;
1023 
1024  throw CompileError(__FILE__, __LINE__, __func__, msg);
1025  }
1026 
1027  // NOTE: this could be get from Makefile.am
1028  TCEString pluginSources = srcsPath + "PluginCompileWrapper.cc ";
1029 
1030  TCEString endianOption = target.isLittleEndian() ?
1031  "-DLITTLE_ENDIAN_TARGET" : "";
1032 
1033  TCEString bitnessOption = target.is64bit() ? "-DTARGET64BIT" : "";
1034  // Compile plugin to cache.
1035  // CXX and SHARED_CXX_FLAGS defined in tce_config.h
1036  cmd = std::string(CXX) +
1037  " -I" + tempDir_ +
1038  pluginIncludeFlags +
1039  " " + SHARED_CXX_FLAGS +
1040  " " + LLVM_CPPFLAGS;
1041 
1043  cmd += " -I`" LLVM_CONFIG " --includedir`";
1044 
1045  cmd +=
1046  " " + CXX14_FLAG +
1047  " " + endianOption +
1048  " " + bitnessOption +
1049  " " + pluginSources +
1050  " -o " + tempPluginFileName;
1051 
1052  if (Application::verboseLevel() > 0) {
1053  Application::logStream() << "LLVMBackend: " << cmd << std::endl;
1054  }
1055  ret = system(cmd.c_str());
1056  if (ret) {
1057  std::string msg = std::string() +
1058  "Failed to build compiler plugin for target architecture.\n" +
1059  "Failed command was: " + cmd;
1060 
1061  throw CompileError(__FILE__, __LINE__, __func__, msg);
1062  }
1063 
1064  // move plugin to final location
1065  llvm::sys::fs::rename(llvm::Twine(tempPluginFileName), llvm::Twine(pluginFileName));
1066 
1067  // Load plugin.
1068  TCETargetMachinePlugin* (*creator)();
1069  try {
1071  pluginTool_.registerModule(pluginFile);
1073  "create_tce_backend_plugin", creator, pluginFile);
1074  } catch(Exception& e) {
1075  std::string msg = std::string() +
1076  "Unable to load plugin file '" +
1077  pluginFileName + "'. Error: " + e.errorMessage();
1078 
1079  IOException ne(__FILE__, __LINE__, __func__, msg);
1080  throw ne;
1081  }
1082 
1083  return creator();
1084 }

References __func__, PluginTools::addSearchPath(), cachePath_, FileSystem::createDirectory(), CXX14_FLAG, FileSystem::DIRECTORY_SEPARATOR, DS, Exception::errorMessage(), FileSystem::fileExists(), FileSystem::fileIsDirectory(), FileSystem::fileIsReadable(), TDGen::generateBackend(), PluginTools::importSymbol(), Application::installationDir(), TTAMachine::Machine::is64bit(), TTAMachine::Machine::isLittleEndian(), Application::logStream(), options_, pluginFilename(), pluginTool_, PluginTools::registerModule(), Exception::setCause(), TBLGEN_INCLUDES, tempDir_, useInstalledVersion_, LLVMTCECmdLineOptions::useOldBackendSources(), and Application::verboseLevel().

Referenced by compile().

Here is the call graph for this function:

◆ llvmRequiredOpset()

OperationDAGSelector::OperationSet LLVMBackend::llvmRequiredOpset ( bool  includeFloatOps,
bool  littleEndian,
bool  bits64 
)
static

Returns minimum opset that is required by llvm.

Returns
Minimumn opset that is required for llvm.

Definition at line 150 of file LLVMBackend.cc.

150  {
152 
153  if (littleEndian) {
154  requiredOps.insert("LD32");
155  requiredOps.insert("LD16");
156  requiredOps.insert("LDU16");
157  requiredOps.insert("LD8");
158  requiredOps.insert("LDU8");
159  requiredOps.insert("ST32");
160  requiredOps.insert("ST16");
161  requiredOps.insert("ST8");
162  } else {
163  requiredOps.insert("LDW");
164  requiredOps.insert("LDH");
165  requiredOps.insert("LDHU");
166  requiredOps.insert("LDQ");
167  requiredOps.insert("LDQU");
168  requiredOps.insert("STW");
169  requiredOps.insert("STH");
170  requiredOps.insert("STQ");
171  }
172 
173  // -- Floating point operations --
174  if (includeFloatOps) {
175  requiredOps.insert("ADDF");
176  requiredOps.insert("SUBF");
177  requiredOps.insert("MULF");
178  requiredOps.insert("DIVF");
179  requiredOps.insert("NEGF");
180  requiredOps.insert("SQRTF");
181 
182  requiredOps.insert("CFI");
183  requiredOps.insert("CFIU");
184  requiredOps.insert("CIF");
185  requiredOps.insert("CIFU");
186 
187  // Ordered FP comparison operations
188  requiredOps.insert("EQF");
189  requiredOps.insert("NEF");
190  requiredOps.insert("LTF");
191  requiredOps.insert("LEF");
192  requiredOps.insert("GTF");
193  requiredOps.insert("GEF");
194 
195  // Unordered FP comparison operations
196  requiredOps.insert("EQUF");
197  requiredOps.insert("NEUF");
198  requiredOps.insert("LTUF");
199  requiredOps.insert("LEUF");
200  requiredOps.insert("GTUF");
201  requiredOps.insert("GEUF");
202 
203  // Ordered/unordered operations
204  requiredOps.insert("ORDF");
205  requiredOps.insert("UORDF");
206 
207  if (bits64) {
208  requiredOps.insert("ADDD");
209  requiredOps.insert("SUBD");
210  requiredOps.insert("MULD");
211  requiredOps.insert("DIVD");
212  requiredOps.insert("NEGD");
213  requiredOps.insert("SQRTD");
214 
215  requiredOps.insert("CDL");
216  requiredOps.insert("CDLU");
217  requiredOps.insert("CLD");
218  requiredOps.insert("CLDU");
219 
220  requiredOps.insert("CFD");
221  requiredOps.insert("CDF");
222 
223  // Ordered FP comparison operations
224  requiredOps.insert("EQD");
225  requiredOps.insert("NED");
226  requiredOps.insert("LTD");
227  requiredOps.insert("LED");
228  requiredOps.insert("GTD");
229  requiredOps.insert("GED");
230 
231  // Unordered FP comparison operations
232  requiredOps.insert("EQUD");
233  requiredOps.insert("NEUD");
234  requiredOps.insert("LTUD");
235  requiredOps.insert("LEUD");
236  requiredOps.insert("GTUD");
237  requiredOps.insert("GEUD");
238 
239  // Ordered/unordered operations
240  requiredOps.insert("ORDD");
241  requiredOps.insert("UORDD");
242  }
243  }
244 
245  if (bits64) {
246  requiredOps.insert("LDU32"); // TODO not really needed?
247  requiredOps.insert("LD64");
248  requiredOps.insert("ST64");
249 
250  requiredOps.insert("ADD64");
251  requiredOps.insert("SUB64");
252  requiredOps.insert("MUL64");
253  requiredOps.insert("DIV64");
254  requiredOps.insert("DIVU64");
255  requiredOps.insert("DIV64");
256  requiredOps.insert("MOD64");
257  requiredOps.insert("MODU64");
258 
259  requiredOps.insert("SXH64");
260  requiredOps.insert("SXQ64");
261 
262  requiredOps.insert("AND64");
263  requiredOps.insert("XOR64");
264  requiredOps.insert("IOR64");
265 
266  requiredOps.insert("SHL64");
267  requiredOps.insert("SHR64");
268  requiredOps.insert("SHRU64");
269 
270  requiredOps.insert("EQ64");
271  requiredOps.insert("NE64");
272  requiredOps.insert("LT64");
273  requiredOps.insert("LTU64");
274  requiredOps.insert("LE64");
275  requiredOps.insert("LEU64");
276  requiredOps.insert("GT64");
277  requiredOps.insert("GTU64");
278  requiredOps.insert("GE64");
279  requiredOps.insert("GEU64");
280 
281  return requiredOps;
282  } else {
283  requiredOps.insert("ADD");
284  requiredOps.insert("SUB");
285  requiredOps.insert("MUL");
286  requiredOps.insert("DIV");
287  requiredOps.insert("DIVU");
288  requiredOps.insert("DIV");
289  requiredOps.insert("MOD");
290  requiredOps.insert("MODU");
291 
292  requiredOps.insert("SXHW");
293  requiredOps.insert("SXQW");
294 
295  requiredOps.insert("AND");
296  requiredOps.insert("XOR");
297  requiredOps.insert("IOR");
298 
299  requiredOps.insert("SHL");
300  requiredOps.insert("SHR");
301  requiredOps.insert("SHRU");
302 
303  requiredOps.insert("EQ");
304  requiredOps.insert("NE");
305  requiredOps.insert("LT");
306  requiredOps.insert("LTU");
307  requiredOps.insert("LE");
308  requiredOps.insert("LEU");
309  requiredOps.insert("GT");
310  requiredOps.insert("GTU");
311  requiredOps.insert("GE");
312  requiredOps.insert("GEU");
313  }
314  return requiredOps;
315 }

Referenced by TDGen::writeInstrInfo().

◆ maxAllocaAlignment()

unsigned LLVMBackend::maxAllocaAlignment ( const llvm::Module &  mod) const
private

Ripped from LLVMTargetMachine.cpp

static void printAndVerify(PassManagerBase &PM, bool allowDoubleDefs = false, bool printMF = false) { if (printMF) { PM.add(createMachineFunctionPrinterPass(cerr)); } PM.add(createMachineVerifierPass(allowDoubleDefs)); } Finds the maximum alignment of an alloca in the module.

Used to align the stack for the program image.

Definition at line 509 of file LLVMBackend.cc.

509  {
510  unsigned maxAlignment = 4;
511  for (llvm::Module::const_iterator f = mod.begin(),
512  fe = mod.end(); f != fe; ++f) {
513  for (llvm::Function::const_iterator bb = f->begin(), be = f->end();
514  bb != be; ++bb) {
515  const llvm::BasicBlock* basicBlock = &(*bb);
516  for (llvm::BasicBlock::const_iterator i = basicBlock->begin(),
517  ie = basicBlock->end(); i != ie; ++i) {
518  if (!isa<const llvm::AllocaInst>(i)) continue;
519  const llvm::AllocaInst* alloca =
520  dyn_cast<const llvm::AllocaInst>(i);
521  #ifdef LLVM_OLDER_THAN_15
522  maxAlignment = std::max(maxAlignment,
523  (unsigned)alloca->getAlign().value());
524  maxAlignment = std::max(maxAlignment,
525  (unsigned)alloca->getAlignment());
526  #else
527  maxAlignment = std::max(maxAlignment,
528  (unsigned)alloca->getAlign().value());
529  maxAlignment = std::max(maxAlignment,
530  (unsigned)alloca->getAlign().value());
531  #endif
532 
533  }
534  }
535  }
536  return maxAlignment;
537 }

Referenced by compile().

◆ pluginFilename()

std::string LLVMBackend::pluginFilename ( const TTAMachine::Machine target)

Returns (hopefully) unique plugin filename for target architecture.

The filename includes also the TCE version string to avoid problems with incompatible backend plugins between TCE revisions. The filename is used for cached plugins.

Parameters
targetTarget architecture.
Returns
Filename for the target architecture.

Definition at line 1097 of file LLVMBackend.cc.

1098  {
1099  TCEString fileName = target.hash();
1100  fileName += "-" + Application::TCEVersionString();
1101  fileName += PLUGIN_SUFFIX;
1102 
1103  return fileName;
1104 }

References TTAMachine::Machine::hash(), PLUGIN_SUFFIX, and Application::TCEVersionString().

Referenced by compile(), and createPlugin().

Here is the call graph for this function:

◆ schedule()

TTAProgram::Program* LLVMBackend::schedule ( const std::string &  bytecodeFile,
const std::string &  emulationBytecodeFile,
TTAMachine::Machine target,
int  optLevel = 2,
bool  debug = false,
SchedulingPlan *  plan = NULL 
)

Member Data Documentation

◆ cachePath_

TCEString LLVMBackend::cachePath_
private

Path to the cache where precompiled plugins are stored.

Definition at line 101 of file LLVMBackend.hh.

Referenced by compile(), createPlugin(), and LLVMBackend().

◆ CXX0X_FLAG

const TCEString LLVMBackend::CXX0X_FLAG = "-std=c++0x"
staticprivate

Definition at line 112 of file LLVMBackend.hh.

◆ CXX11_FLAG

const TCEString LLVMBackend::CXX11_FLAG = "-std=c++11"
staticprivate

Definition at line 113 of file LLVMBackend.hh.

◆ CXX14_FLAG

const TCEString LLVMBackend::CXX14_FLAG = "-std=c++14"
staticprivate

Definition at line 114 of file LLVMBackend.hh.

Referenced by createPlugin().

◆ ipData_

InterPassData* LLVMBackend::ipData_
private

Definition at line 107 of file LLVMBackend.hh.

Referenced by compile().

◆ options_

LLVMTCECmdLineOptions* LLVMBackend::options_
private

Definition at line 105 of file LLVMBackend.hh.

Referenced by compile(), createPlugin(), and LLVMBackend().

◆ PLUGIN_PREFIX

const std::string LLVMBackend::PLUGIN_PREFIX = "tcecc-"
staticprivate

Definition at line 110 of file LLVMBackend.hh.

◆ PLUGIN_SUFFIX

const std::string LLVMBackend::PLUGIN_SUFFIX = ".so"
staticprivate

Definition at line 111 of file LLVMBackend.hh.

Referenced by pluginFilename().

◆ pluginTool_

PluginTools LLVMBackend::pluginTool_
private

Plugin tool for loading target machine plugin.

Definition at line 99 of file LLVMBackend.hh.

Referenced by compile(), and createPlugin().

◆ TBLGEN_INCLUDES

const POP_COMPILER_DIAGS std::string LLVMBackend::TBLGEN_INCLUDES = ""
staticprivate

Definition at line 109 of file LLVMBackend.hh.

Referenced by createPlugin().

◆ tempDir_

TCEString LLVMBackend::tempDir_
private

Directory to store temporary files.

Definition at line 103 of file LLVMBackend.hh.

Referenced by createPlugin().

◆ useInstalledVersion_

bool LLVMBackend::useInstalledVersion_
private

Assume we are running an installed TCE version.

Definition at line 96 of file LLVMBackend.hh.

Referenced by createPlugin().


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.
SimpleInterPassDatum
Definition: InterPassDatum.hh:64
LLVMBackend::cachePath_
TCEString cachePath_
Path to the cache where precompiled plugins are stored.
Definition: LLVMBackend.hh:101
TTAProgram::Program
Definition: Program.hh:63
Options
Definition: Options.hh:51
MachineInfo::maxMemoryAlignment
static int maxMemoryAlignment(const TTAMachine::Machine &mach)
Definition: MachineInfo.cc:261
llvm::TCETargetMachinePlugin::fpDRegNum
virtual unsigned fpDRegNum()=0
Returns ID number of the frame pointer register.
FileSystem::removeFileOrDirectory
static bool removeFileOrDirectory(const std::string &path)
Definition: FileSystem.cc:493
FileSystem::createDirectory
static bool createDirectory(const std::string &path)
Definition: FileSystem.cc:400
llvm::LLVMTCEBuilder::result
TTAProgram::Program * result()
Definition: LLVMTCEBuilder.cc:3713
RegDatum
SimpleInterPassDatum< std::pair< TCEString, unsigned int > > RegDatum
Datum type for transferring register name as a data. Stack pointer register is saved with key STACK_P...
Definition: InterPassDatum.hh:87
LLVMBackend::PLUGIN_SUFFIX
static const std::string PLUGIN_SUFFIX
Definition: LLVMBackend.hh:111
MachineValidator::GCU_MISSING
@ GCU_MISSING
GCU missing in machine.
Definition: MachineValidator.hh:57
LLVMBackend::pluginTool_
PluginTools pluginTool_
Plugin tool for loading target machine plugin.
Definition: LLVMBackend.hh:99
LLVMTCECmdLineOptions::saveBackendPlugin
bool saveBackendPlugin() const
Definition: LLVMTCECmdLineOptions.cc:369
LLVMBackend::compile
TTAProgram::Program * compile(const std::string &bytecodeFile, const std::string &emulationBytecodeFile, TTAMachine::Machine &target, int optLevel, bool debug=false, InterPassData *ipData=NULL)
Definition: LLVMBackend.cc:360
TTAMachine::Machine::is64bit
bool is64bit() const
Definition: Machine.hh:260
MachineValidator::USED_IO_NOT_BOUND
@ USED_IO_NOT_BOUND
Pipeline uses an IO which is not bound.
Definition: MachineValidator.hh:61
CompileError
Definition: Exception.hh:1019
Application::verboseLevel
static int verboseLevel()
Definition: Application.hh:176
Application::logStream
static std::ostream & logStream()
Definition: Application.cc:155
LLVMTCECmdLineOptions::workItemAAFile
std::string workItemAAFile() const
Definition: LLVMTCECmdLineOptions.cc:409
MachineValidator::PC_PORT_MISSING
@ PC_PORT_MISSING
PC port missing in GCU.
Definition: MachineValidator.hh:65
MachineValidatorResults
Definition: MachineValidatorResults.hh:45
llvm::TCETargetMachine::setTargetMachinePlugin
virtual void setTargetMachinePlugin(TCETargetMachinePlugin &plugin, TTAMachine::Machine &target)
Definition: TCETargetMachine.cc:167
TTAMachine::Machine::hash
TCEString hash() const
Definition: Machine.cc:932
TDGen
Definition: TDGen.hh:77
LLVMBackend::ipData_
InterPassData * ipData_
Definition: LLVMBackend.hh:107
TDGen::generateBackend
void generateBackend(std::string &path)
Definition: TDGen.cc:388
llvm::TCETargetMachine::setStackAlignment
void setStackAlignment(unsigned align)
Definition: TCETargetMachine.hh:273
MachineValidator
Definition: MachineValidator.hh:52
TTAMachine::Machine::isLittleEndian
bool isLittleEndian() const
Definition: Machine.hh:258
createTCEMCRegisterInfo
static MCRegisterInfo * createTCEMCRegisterInfo(const Triple &TT)
Definition: LLVMBackend.cc:540
llvm::TCETargetMachinePlugin::spDRegNum
virtual unsigned spDRegNum()=0
Returns ID number of the stack pointer register.
FileSystem::fileIsDirectory
static bool fileIsDirectory(const std::string fileName)
LLVMBackend::tempDir_
TCEString tempDir_
Directory to store temporary files.
Definition: LLVMBackend.hh:103
InnerLoopFinder
Definition: InnerLoopFinder.hh:28
addPass
#define addPass(P)
MachineValidator::FU_PORT_MISSING
@ FU_PORT_MISSING
FU is missing ports.
Definition: MachineValidator.hh:75
abortWithError
#define abortWithError(message)
Definition: Application.hh:72
MachineValidator::GCU_AS_MISSING
@ GCU_AS_MISSING
Address space missing in GCU.
Definition: MachineValidator.hh:59
LLVMBackend::options_
LLVMTCECmdLineOptions * options_
Definition: LLVMBackend.hh:105
PluginTools::importSymbol
void importSymbol(const std::string &symbolName, T *&target, const std::string &module)
THROW_EXCEPTION
#define THROW_EXCEPTION(exceptionType, message)
Exception wrapper macro that automatically includes file name, line number and function name where th...
Definition: Exception.hh:39
LLVMInitializeTCETarget
void LLVMInitializeTCETarget()
Definition: TCETargetMachine.cc:117
Application::cmdLineOptions
static CmdLineOptions * cmdLineOptions()
Definition: Application.cc:397
__func__
#define __func__
Definition: Application.hh:67
PluginTools::registerModule
void registerModule(const std::string &module)
Definition: PluginTools.cc:138
LLVMBackend::createPlugin
llvm::TCETargetMachinePlugin * createPlugin(const TTAMachine::Machine &target)
Definition: LLVMBackend.cc:809
llvm::TCETargetMachinePlugin::getParamDRegNums
virtual std::vector< unsigned > getParamDRegNums() const =0
createTCEMCInstrInfo
static MCInstrInfo * createTCEMCInstrInfo()
Definition: LLVMBackend.cc:546
llvm::LLVMTCEIRBuilder
Definition: LLVMTCEIRBuilder.hh:60
Exception::errorMessageStack
std::string errorMessageStack(bool messagesOnly=false) const
Definition: Exception.cc:138
LLVMBackend::TBLGEN_INCLUDES
static const std::string TBLGEN_INCLUDES
Definition: LLVMBackend.hh:109
MachineValidatorResults::errorCount
int errorCount() const
Definition: MachineValidatorResults.cc:56
OperationDAGSelector::OperationSet
TCETools::CIStringSet OperationSet
Definition: OperationDAGSelector.hh:88
Exception
Definition: Exception.hh:54
ConstantTransformer
Definition: ConstantTransformer.hh:43
LLVMTCECmdLineOptions::backendCacheDir
std::string backendCacheDir() const
Definition: LLVMTCECmdLineOptions.cc:419
LLVMTCECmdLineOptions::useOldBackendSources
bool useOldBackendSources() const
Definition: LLVMTCECmdLineOptions.cc:389
LLVMTCECmdLineOptions
Definition: LLVMTCECmdLineOptions.hh:48
LLVMTCECmdLineOptions::assumeADFStackAlignment
bool assumeADFStackAlignment() const
Definition: LLVMTCECmdLineOptions.cc:463
llvm::TCETargetMachinePlugin::rvDRegNum
virtual unsigned rvDRegNum()=0
llvm::TCETargetMachinePlugin::rfName
virtual std::string rfName(unsigned dwarfRegNum)=0
Returns name of the physical register file corresponding to a generated register ID.
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
createTCEMCSubtargetInfo
static MCSubtargetInfo * createTCEMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
Definition: LLVMBackend.cc:552
FileSystem::DIRECTORY_SEPARATOR
static const std::string DIRECTORY_SEPARATOR
Definition: FileSystem.hh:189
llvm::LLVMTCEIRBuilder::setInnerLoopFinder
void setInnerLoopFinder(InnerLoopFinder *loopFinder)
Definition: LLVMTCEIRBuilder.hh:84
llvm::TCETargetMachinePlugin
Definition: TCETargetMachinePlugin.hh:109
LLVMTCECmdLineOptions::isInitialStackPointerValueSet
bool isInitialStackPointerValueSet() const
Definition: LLVMTCECmdLineOptions.cc:426
MachineValidator::RA_PORT_MISSING
@ RA_PORT_MISSING
RA port missing in GCU.
Definition: MachineValidator.hh:67
llvm::LLVMTCEBuilder::isProgramUsingRestrictedPointers
bool isProgramUsingRestrictedPointers() const
Definition: LLVMTCEBuilder.hh:123
PluginTools::addSearchPath
void addSearchPath(const std::string &searchPath)
Definition: PluginTools.cc:95
Environment::llvmtceCachePath
static std::string llvmtceCachePath()
Definition: Environment.cc:1087
FileSystem::fileExists
static bool fileExists(const std::string fileName)
LLVMBackend::maxAllocaAlignment
unsigned maxAllocaAlignment(const llvm::Module &mod) const
Definition: LLVMBackend.cc:509
Application::installationDir
static std::string installationDir()
Definition: Application.cc:537
TCEString
Definition: TCEString.hh:53
LLVMInitializeTCETargetInfo
void LLVMInitializeTCETargetInfo()
Definition: TCEStubTargetMachine.cc:67
llvm::TCETargetMachine
Definition: TCETargetMachine.hh:106
llvm::LLVMTCEBuilder::setInitialStackPointerValue
void setInitialStackPointerValue(unsigned value)
Definition: LLVMTCEBuilder.cc:1240
LLVMTCECmdLineOptions::isWorkItemAAFileDefined
bool isWorkItemAAFileDefined() const
Definition: LLVMTCECmdLineOptions.cc:404
IOException
Definition: Exception.hh:130
LLVMBackend::pluginFilename
std::string pluginFilename(const TTAMachine::Machine &target)
Definition: LLVMBackend.cc:1097
InterPassData::setDatum
void setDatum(const std::string &key, InterPassDatum *datum)
Definition: InterPassData.cc:89
llvm::TCETargetMachinePlugin::getVectorRVDRegNums
virtual std::vector< unsigned > getVectorRVDRegNums() const =0
DS
#define DS
Definition: LLVMBackend.cc:124
FileSystem::fileIsReadable
static bool fileIsReadable(const std::string fileName)
LLVMBackend::useInstalledVersion_
bool useInstalledVersion_
Assume we are running an installed TCE version.
Definition: LLVMBackend.hh:96
llvm::TCETargetMachine::setEmulationModule
virtual void setEmulationModule(Module *mod)
Definition: TCETargetMachine.hh:127
Application::TCEVersionString
static std::string TCEVersionString()
Definition: Application.cc:510
llvm::LLVMTCEBuilder
Definition: LLVMTCEBuilder.hh:102
llvm::LLVMTCEBuilder::deleteDeadProcedures
void deleteDeadProcedures()
Definition: LLVMTCEBuilder.cc:1197
llvm::AliasAnalysis
AAResults AliasAnalysis
Definition: DataDependenceGraphBuilder.hh:45
LLVMBackend::CXX14_FLAG
static const TCEString CXX14_FLAG
Definition: LLVMBackend.hh:114
LLVMTCECmdLineOptions::initialStackPointerValue
uint64_t initialStackPointerValue() const
Definition: LLVMTCECmdLineOptions.cc:431
MachineValidatorResults::error
Error error(int index) const
Definition: MachineValidatorResults.cc:70