1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[MCA][NFCI] Minor changes to InstrBuilder and Instruction.

This is based on the assumption that most simulated instructions don't define
more than one or two registers. This is true for example on x86, where
most instruction definitions don't declare more than one register write.

The default code region size has been increased from 8 to 16. This is based on
the assumption that, for small microbenchmarks, the typical code snippet size is
often less than 16 instructions.

mca::Instruction now uses bitfields to pack flags.
No functional change intended.
This commit is contained in:
Andrea Di Biagio 2021-05-31 16:39:35 +01:00
parent 0bb0030f11
commit 44ebb7579c
5 changed files with 16 additions and 16 deletions

View File

@ -63,7 +63,8 @@ public:
const MCRegisterInfo &RI, const MCInstrAnalysis *IA); const MCRegisterInfo &RI, const MCInstrAnalysis *IA);
void clear() { void clear() {
VariantDescriptors.shrink_and_clear(); Descriptors.clear();
VariantDescriptors.clear();
FirstCallInst = true; FirstCallInst = true;
FirstReturnInst = true; FirstReturnInst = true;
} }

View File

@ -346,7 +346,7 @@ struct ResourceUsage {
/// An instruction descriptor /// An instruction descriptor
struct InstrDesc { struct InstrDesc {
SmallVector<WriteDescriptor, 4> Writes; // Implicit writes are at the end. SmallVector<WriteDescriptor, 2> Writes; // Implicit writes are at the end.
SmallVector<ReadDescriptor, 4> Reads; // Implicit reads are at the end. SmallVector<ReadDescriptor, 4> Reads; // Implicit reads are at the end.
// For every resource used by an instruction of this kind, this vector // For every resource used by an instruction of this kind, this vector
@ -370,16 +370,16 @@ struct InstrDesc {
// subtarget when computing the reciprocal throughput. // subtarget when computing the reciprocal throughput.
unsigned SchedClassID; unsigned SchedClassID;
bool MayLoad; unsigned MayLoad : 1;
bool MayStore; unsigned MayStore : 1;
bool HasSideEffects; unsigned HasSideEffects : 1;
bool BeginGroup; unsigned BeginGroup : 1;
bool EndGroup; unsigned EndGroup : 1;
bool RetireOOO; unsigned RetireOOO : 1;
// True if all buffered resources are in-order, and there is at least one // True if all buffered resources are in-order, and there is at least one
// buffer which is a dispatch hazard (BufferSize = 0). // buffer which is a dispatch hazard (BufferSize = 0).
bool MustIssueImmediately; unsigned MustIssueImmediately : 1;
// A zero latency instruction doesn't consume any scheduler resources. // A zero latency instruction doesn't consume any scheduler resources.
bool isZeroLatency() const { return !MaxLatency && Resources.empty(); } bool isZeroLatency() const { return !MaxLatency && Resources.empty(); }
@ -403,7 +403,7 @@ class InstructionBase {
// Output dependencies. // Output dependencies.
// One entry per each implicit and explicit register definition. // One entry per each implicit and explicit register definition.
SmallVector<WriteState, 4> Defs; SmallVector<WriteState, 2> Defs;
// Input dependencies. // Input dependencies.
// One entry per each implicit and explicit register use. // One entry per each implicit and explicit register use.

View File

@ -15,8 +15,7 @@
namespace llvm { namespace llvm {
namespace mca { namespace mca {
CodeEmitter::EncodingInfo CodeEmitter::EncodingInfo CodeEmitter::getOrCreateEncodingInfo(unsigned MCID) {
CodeEmitter::getOrCreateEncodingInfo(unsigned MCID) {
EncodingInfo &EI = Encodings[MCID]; EncodingInfo &EI = Encodings[MCID];
if (EI.second) if (EI.second)
return EI; return EI;

View File

@ -44,8 +44,8 @@ Context::createDefaultPipeline(const PipelineOptions &Opts, SourceMgr &SrcMgr) {
// Create the pipeline stages. // Create the pipeline stages.
auto Fetch = std::make_unique<EntryStage>(SrcMgr); auto Fetch = std::make_unique<EntryStage>(SrcMgr);
auto Dispatch = std::make_unique<DispatchStage>(STI, MRI, Opts.DispatchWidth, auto Dispatch =
*RCU, *PRF); std::make_unique<DispatchStage>(STI, MRI, Opts.DispatchWidth, *RCU, *PRF);
auto Execute = auto Execute =
std::make_unique<ExecuteStage>(*HWS, Opts.EnableBottleneckAnalysis); std::make_unique<ExecuteStage>(*HWS, Opts.EnableBottleneckAnalysis);
auto Retire = std::make_unique<RetireStage>(*RCU, *PRF, *LSU); auto Retire = std::make_unique<RetireStage>(*RCU, *PRF, *LSU);

View File

@ -53,7 +53,7 @@ class CodeRegion {
// An optional descriptor for this region. // An optional descriptor for this region.
llvm::StringRef Description; llvm::StringRef Description;
// Instructions that form this region. // Instructions that form this region.
llvm::SmallVector<llvm::MCInst, 8> Instructions; llvm::SmallVector<llvm::MCInst, 16> Instructions;
// Source location range. // Source location range.
llvm::SMLoc RangeStart; llvm::SMLoc RangeStart;
llvm::SMLoc RangeEnd; llvm::SMLoc RangeEnd;