Skip to content

Commit

Permalink
Add getProcessorName to other codegens
Browse files Browse the repository at this point in the history
Signed-off-by: Dhruv Chopra <Dhruv.C.Chopra@ibm.com>
  • Loading branch information
dchopra001 committed May 1, 2021
1 parent 03905d3 commit da34f97
Show file tree
Hide file tree
Showing 9 changed files with 214 additions and 3 deletions.
19 changes: 19 additions & 0 deletions compiler/aarch64/env/OMRCPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,22 @@ OMR::ARM64::CPU::supportsFeature(uint32_t feature)
OMRPORT_ACCESS_FROM_OMRPORT(TR::Compiler->omrPortLib);
return (TRUE == omrsysinfo_processor_has_feature(&_processorDescription, feature));
}

const char*
OMR::ARM64::CPU::getProcessorName()
{
const char* returnString = "";
switch(_processorDescription.processor)
{
case OMR_PROCESSOR_ARM64_UNKNOWN:
returnString = "Unknown ARM64 processor";
break;
case OMR_PROCESSOR_ARM64_V8_A:
returnString = "ARMv8-A processor";
break;
default:
returnString = "Unknown ARM64 processor";
break;
}
return returnString;
}
6 changes: 6 additions & 0 deletions compiler/aarch64/env/OMRCPU.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ class OMR_EXTENSIBLE CPU : public OMR::CPU
* @returns true if feature is supported
*/
bool supportsFeature(uint32_t feature);

/**
* @brief Returns name of the current processor
* @returns const char* string representing the name of the current processor
*/
const char* getProcessorName();
};

}
Expand Down
6 changes: 6 additions & 0 deletions compiler/arm/env/OMRCPU.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ class OMR_EXTENSIBLE CPU : public OMR::CPU
* @param requireRotateToLeft if true, returns true if rotate to left operation is available.
*/
bool getSupportsHardware64bitRotate(bool requireRotateToLeft=false) { return !requireRotateToLeft; } // only rotate to right is available

/**
* @brief Returns name of the current processor
* @returns const char* string representing the name of the current processor
*/
const char* getProcessorName() { return "Unknown Arm Processor"; }
};

}
Expand Down
6 changes: 6 additions & 0 deletions compiler/env/OMRCPU.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@ class OMR_EXTENSIBLE CPU
*/
bool supportsFeature(uint32_t feature);

/**
* @brief Returns name of the current processor
* @returns const char* string representing the name of the current processor
*/
const char* getProcessorName() { return "Unknown Processor"; }

protected:
OMRProcessorDesc _processorDescription;

Expand Down
81 changes: 81 additions & 0 deletions compiler/p/env/OMRCPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,84 @@ OMR::Power::CPU::getOldProcessorTypeFromNewProcessorType(OMRProcessorArchitectur
return TR_FirstPPCProcessor;
}

const char*
OMR::Power::CPU::getProcessorName()
{
const char* returnString = "";
switch(_processorDescription.processor)
{
case OMR_PROCESSOR_PPC_PWR604:
returnString = "PPCPWR604";
break;

case OMR_PROCESSOR_PPC_PWR630:
returnString = "PPCpwr630 ";
break;

case OMR_PROCESSOR_PPC_GP:
returnString = "PPCgp";
break;

case OMR_PROCESSOR_PPC_GR:
returnString = "PPCgr";
break;

case OMR_PROCESSOR_PPC_P6:
returnString = "PPCp6";
break;

case OMR_PROCESSOR_PPC_P7:
returnString = "PPCp7";
break;

case OMR_PROCESSOR_PPC_P8:
returnString = "PPCp8";
break;

case OMR_PROCESSOR_PPC_P9:
returnString = "PPCp9";
break;

case OMR_PROCESSOR_PPC_P10:
returnString = "PPCp10";
break;

case OMR_PROCESSOR_PPC_PULSAR:
returnString = "PPCpulsar";
break;

case OMR_PROCESSOR_PPC_NSTAR:
returnString = "PPCnstar";
break;

case OMR_PROCESSOR_PPC_PWR403:
returnString = "PPCPWR403";
break;

case OMR_PROCESSOR_PPC_PWR601:
returnString = "PPCPWR601";
break;

case OMR_PROCESSOR_PPC_PWR603:
returnString = "PPCPWR603";
break;

case OMR_PROCESSOR_PPC_82XX:
returnString = "PPCP82xx";
break;

case OMR_PROCESSOR_PPC_7XX:
returnString = "PPC7xx";
break;

case OMR_PROCESSOR_PPC_PWR440:
returnString = "PPCPWR440";
break;

default:
returnString = "Unknown PPC processor";
break;
}
return returnString;
}

6 changes: 6 additions & 0 deletions compiler/p/env/OMRCPU.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ class OMR_EXTENSIBLE CPU : public OMR::CPU
bool isAtLeast(OMRProcessorArchitecture p);
bool isAtMost(OMRProcessorArchitecture p);

/**
* @brief Returns name of the current processor
* @returns const char* string representing the name of the current processor
*/
const char* getProcessorName();

private:

TR_Processor getOldProcessorTypeFromNewProcessorType(OMRProcessorArchitecture p);
Expand Down
80 changes: 80 additions & 0 deletions compiler/x/env/OMRCPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,3 +573,83 @@ OMR::X86::CPU::supports_feature_old_api(uint32_t feature)
return supported;
}

const char*
OMR::X86::CPU::getProcessorName()
{
const char* returnString = "";
switch(_processorDescription.processor)
{
case OMR_PROCESSOR_X86_INTELPENTIUM:
returnString = "X86 Intel Pentium";
break;

case OMR_PROCESSOR_X86_INTELP6:
returnString = "X86 Intel P6";
break;

case OMR_PROCESSOR_X86_INTELPENTIUM4:
returnString = "X86 Intel Netburst Microarchitecture";
break;

case OMR_PROCESSOR_X86_INTELCORE2:
returnString = "X86 Intel Core2 Microarchitecture";
break;

case OMR_PROCESSOR_X86_INTELTULSA:
returnString = "X86 Intel Tulsa";
break;

case OMR_PROCESSOR_X86_INTELNEHALEM:
returnString = "X86 Intel Nehalem";
break;

case OMR_PROCESSOR_X86_INTELWESTMERE:
returnString = "X86 Intel Westmere";
break;

case OMR_PROCESSOR_X86_INTELSANDYBRIDGE:
returnString = "X86 Intel Sandy Bridge";
break;

case OMR_PROCESSOR_X86_INTELIVYBRIDGE:
returnString = "X86 Intel Ivy Bridge";
break;

case OMR_PROCESSOR_X86_INTELHASWELL:
returnString = "X86 Intel Haswell";
break;

case OMR_PROCESSOR_X86_INTELBROADWELL:
returnString = "X86 Intel Broadwell";
break;

case OMR_PROCESSOR_X86_INTELSKYLAKE:
returnString = "X86 Intel Skylake";
break;

case OMR_PROCESSOR_X86_AMDK5:
returnString = "X86 AMDK5";
break;

case OMR_PROCESSOR_X86_AMDK6:
returnString = "X86 AMDK6";
break;

case OMR_PROCESSOR_X86_AMDATHLONDURON:
returnString = "X86 AMD Athlon-Duron";
break;

case OMR_PROCESSOR_X86_AMDOPTERON:
returnString = "X86 AMD Opteron";
break;

case OMR_PROCESSOR_X86_AMDFAMILY15H:
returnString = "X86 AMD Family 15h";
break;

default:
returnString = "Unknown X86 Processor";
break;
}
return returnString;
}
6 changes: 6 additions & 0 deletions compiler/x/env/OMRCPU.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ class OMR_EXTENSIBLE CPU : public OMR::CPU
bool supportsFeature(uint32_t feature);
bool supports_feature_old_api(uint32_t feature);
bool supports_feature_test(uint32_t feature);

/**
* @brief Returns name of the current processor
* @returns const char* string representing the name of the current processor
*/
const char* getProcessorName();
};
}

Expand Down
7 changes: 4 additions & 3 deletions compiler/z/env/OMRCPU.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ class OMR_EXTENSIBLE CPU : public OMR::CPU
zNext,
};

/** \brief
* Gets the name of the processor that _processorDescription described.
*/
/**
* @brief Returns name of the current processor
* @returns const char* string representing the name of the current processor
*/
const char* getProcessorName();

static TR::CPU detect(OMRPortLibrary * const omrPortLib);
Expand Down

0 comments on commit da34f97

Please sign in to comment.