aboutsummaryrefslogtreecommitdiff
path: root/backend/utils/TableGen
diff options
context:
space:
mode:
Diffstat (limited to 'backend/utils/TableGen')
-rw-r--r--backend/utils/TableGen/Common/CodeGenInstruction.cpp5
-rw-r--r--backend/utils/TableGen/Common/CodeGenTarget.h1
-rw-r--r--backend/utils/TableGen/InstrInfoEmitter.cpp5
3 files changed, 9 insertions, 2 deletions
diff --git a/backend/utils/TableGen/Common/CodeGenInstruction.cpp b/backend/utils/TableGen/Common/CodeGenInstruction.cpp
index fc6b400..d06fbfc 100644
--- a/backend/utils/TableGen/Common/CodeGenInstruction.cpp
+++ b/backend/utils/TableGen/Common/CodeGenInstruction.cpp
@@ -428,6 +428,7 @@ CodeGenTarget::normalizeImplicitRegisters(const std::vector<SourceImplicitRegist
.Flags = {},
.SchedulingClass = HasSchedulingClass ? SchedulingClass->second : 0,
.EncodingCategory = HasEncodingCategory ? EncodingCategory->second : 0,
+ .SizeInBytes = Instruction.SizeInBytes,
.AssemblyFormat = HasAssemblyFormat ? AssemblyFormat->second : 0,
.RequiresMemoryOperands = Instruction.RequiresMemoryOperands,
.Owner = std::string(*Owner),
@@ -547,6 +548,10 @@ CodeGenTarget::normalizeImplicitRegisters(const std::vector<SourceImplicitRegist
fail(Instruction.Range, "instruction pseudo flags, owner, and deadline are inconsistent");
return false;
}
+ if (Normalized.SizeInBytes != 0 && !HasFlag("ProducesCode")) {
+ fail(Instruction.Range, "only code-producing instructions can declare a byte size");
+ return false;
+ }
if (Normalized.RequiresMemoryOperands && !HasFlag("MayLoad") && !HasFlag("MayStore")) {
fail(Instruction.Range, "memory operand requirements need a load or store instruction flag");
return false;
diff --git a/backend/utils/TableGen/Common/CodeGenTarget.h b/backend/utils/TableGen/Common/CodeGenTarget.h
index cc2697c..139cfc8 100644
--- a/backend/utils/TableGen/Common/CodeGenTarget.h
+++ b/backend/utils/TableGen/Common/CodeGenTarget.h
@@ -155,6 +155,7 @@ struct NormalizedInstruction final {
std::vector<std::string> Flags;
std::uint32_t SchedulingClass = 0;
std::uint32_t EncodingCategory = 0;
+ std::uint32_t SizeInBytes = 0;
std::uint32_t AssemblyFormat = 0;
bool RequiresMemoryOperands = false;
std::string Owner;
diff --git a/backend/utils/TableGen/InstrInfoEmitter.cpp b/backend/utils/TableGen/InstrInfoEmitter.cpp
index 795a718..b06134f 100644
--- a/backend/utils/TableGen/InstrInfoEmitter.cpp
+++ b/backend/utils/TableGen/InstrInfoEmitter.cpp
@@ -179,8 +179,9 @@ std::string emitInstructionInfo(const NormalizedTargetModel &Model) {
Output << "InstructionFlag::" << Flag << ", ";
Output << "}, .SchedulingClass = SchedulingClassID::fromValue(" << Instruction.SchedulingClass
<< "), .EncodingCategory = EncodingCategoryID::fromValue("
- << Instruction.EncodingCategory << "), .AssemblyFormat = AssemblyFormatID::fromValue("
- << Instruction.AssemblyFormat << "), .RequiresMemoryOperands = "
+ << Instruction.EncodingCategory << "), .SizeInBytes = " << Instruction.SizeInBytes
+ << ", .AssemblyFormat = AssemblyFormatID::fromValue(" << Instruction.AssemblyFormat
+ << "), .RequiresMemoryOperands = "
<< (Instruction.RequiresMemoryOperands ? "true" : "false")
<< ", .Owner = PseudoOwner::" << Instruction.Owner
<< ", .Deadline = PipelineStage::" << Instruction.Deadline