From 495c675771f43cfa12ab7a426a538be72fec1805 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Sun, 9 Aug 2026 17:03:19 +0800 Subject: [CodeGen] Implement machine optimization and scheduling --- backend/unittests/CodeGen/InstructionDescriptorTest.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'backend/unittests/CodeGen/InstructionDescriptorTest.cpp') diff --git a/backend/unittests/CodeGen/InstructionDescriptorTest.cpp b/backend/unittests/CodeGen/InstructionDescriptorTest.cpp index 424d2e4..687e723 100644 --- a/backend/unittests/CodeGen/InstructionDescriptorTest.cpp +++ b/backend/unittests/CodeGen/InstructionDescriptorTest.cpp @@ -86,6 +86,7 @@ private: RegisterOrImmediate.Kinds = { rcc::MachineOperand::Kind::Register, rcc::MachineOperand::Kind::Immediate, + rcc::MachineOperand::Kind::GlobalSymbol, }; RegisterOrImmediate.RegisterRole = rcc::RegisterOperandRole::Use; RegisterOrImmediate.ImmediatePredicate = rcc::ImmediatePredicateID::fromValue(1); @@ -218,6 +219,15 @@ void testOperandValidation(TestContext &Context) { .has_value(), "matching roles, constraints, flags, and predicate must validate"); + std::vector SymbolOperands; + SymbolOperands.push_back(*registerOperand(*Destination, {rcc::RegisterOperandFlag::Define})); + SymbolOperands.push_back(*registerOperand(*Source, {rcc::RegisterOperandFlag::Use})); + SymbolOperands.push_back(*rcc::MachineOperand::globalSymbol("object", 0, 0x1)); + Context.expect( + InstructionSet->validateExplicitOperands(rcc::Opcode::fromValue(1), SymbolOperands, RegInfo) + .has_value(), + "an immediate predicate must not reject another allowed symbolic operand kind"); + std::vector WrongRole; WrongRole.push_back(*registerOperand(*Destination, {rcc::RegisterOperandFlag::Use})); WrongRole.push_back(*registerOperand(*Source, {rcc::RegisterOperandFlag::Use})); -- cgit v1.2.3