diff options
author | Jay Foad <jay.foad@amd.com> | 2023-01-12 07:38:13 +0000 |
---|---|---|
committer | Jay Foad <jay.foad@amd.com> | 2023-03-27 11:39:18 +0100 |
commit | 1220c5d4ac00ebf64128678e4ffd2abd9f5d60ae (patch) | |
tree | 63c01ac17c71e4197ec997ffcae15d52c137b93a /llvm/unittests/CodeGen/MachineInstrTest.cpp | |
parent | a826b9034bbd046a5d0708ba656a3d345d179920 (diff) | |
download | llvm-1220c5d4ac00ebf64128678e4ffd2abd9f5d60ae.zip llvm-1220c5d4ac00ebf64128678e4ffd2abd9f5d60ae.tar.gz llvm-1220c5d4ac00ebf64128678e4ffd2abd9f5d60ae.tar.bz2 |
[MC] Store implicit ops immediately after the TargetInsts table. NFC.
This shrinks MCInstrDesc (and hence the whole TargetInsts table) because
we can store a 16-bit offset value to access the implicit operands,
instead of a pointer. This also reduces the number of relocs that need
to be applied when LLVM is compiled as position-independent code.
Differential Revision: https://reviews.llvm.org/D142218
Diffstat (limited to 'llvm/unittests/CodeGen/MachineInstrTest.cpp')
-rw-r--r-- | llvm/unittests/CodeGen/MachineInstrTest.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/llvm/unittests/CodeGen/MachineInstrTest.cpp b/llvm/unittests/CodeGen/MachineInstrTest.cpp index 574e90d..62b1c6f 100644 --- a/llvm/unittests/CodeGen/MachineInstrTest.cpp +++ b/llvm/unittests/CodeGen/MachineInstrTest.cpp @@ -54,9 +54,9 @@ TEST(IsIdenticalToTest, DifferentDefs) { MCOperandInfo OpInfo[] = { {0, 0, MCOI::OPERAND_REGISTER, 0}, {0, 1 << MCOI::OptionalDef, MCOI::OPERAND_REGISTER, 0}}; - MCInstrDesc MCID = {0, NumOps, NumDefs, 0, - 0, 0, 0, 1ULL << MCID::HasOptionalDef, - 0, nullptr, OpInfo}; + MCInstrDesc MCID = { + 0, NumOps, NumDefs, 0, 0, 0, 0, 0, 1ULL << MCID::HasOptionalDef, + 0, OpInfo}; // Create two MIs with different virtual reg defs and the same uses. unsigned VirtualDef1 = -42; // The value doesn't matter, but the sign does. @@ -125,9 +125,9 @@ TEST(MachineInstrExpressionTraitTest, IsEqualAgreesWithGetHashValue) { MCOperandInfo OpInfo[] = { {0, 0, MCOI::OPERAND_REGISTER, 0}, {0, 1 << MCOI::OptionalDef, MCOI::OPERAND_REGISTER, 0}}; - MCInstrDesc MCID = {0, NumOps, NumDefs, 0, - 0, 0, 0, 1ULL << MCID::HasOptionalDef, - 0, nullptr, OpInfo}; + MCInstrDesc MCID = { + 0, NumOps, NumDefs, 0, 0, 0, 0, 0, 1ULL << MCID::HasOptionalDef, + 0, OpInfo}; // Define a series of instructions with different kinds of operands and make // sure that the hash function is consistent with isEqual for various @@ -201,7 +201,7 @@ TEST(MachineInstrPrintingTest, DebugLocPrinting) { auto MF = createMachineFunction(Ctx, Mod); MCOperandInfo OpInfo{0, 0, MCOI::OPERAND_REGISTER, 0}; - MCInstrDesc MCID = {0, 1, 1, 0, 0, 0, 0, 0, 0, nullptr, &OpInfo}; + MCInstrDesc MCID = {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, &OpInfo}; DIFile *DIF = DIFile::getDistinct(Ctx, "filename", ""); DISubprogram *DIS = DISubprogram::getDistinct( @@ -228,7 +228,7 @@ TEST(MachineInstrSpan, DistanceBegin) { auto MF = createMachineFunction(Ctx, Mod); auto MBB = MF->CreateMachineBasicBlock(); - MCInstrDesc MCID = {0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr, nullptr}; + MCInstrDesc MCID = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr}; auto MII = MBB->begin(); MachineInstrSpan MIS(MII, MBB); @@ -245,7 +245,7 @@ TEST(MachineInstrSpan, DistanceEnd) { auto MF = createMachineFunction(Ctx, Mod); auto MBB = MF->CreateMachineBasicBlock(); - MCInstrDesc MCID = {0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr, nullptr}; + MCInstrDesc MCID = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr}; auto MII = MBB->end(); MachineInstrSpan MIS(MII, MBB); @@ -260,7 +260,7 @@ TEST(MachineInstrExtraInfo, AddExtraInfo) { LLVMContext Ctx; Module Mod("Module", Ctx); auto MF = createMachineFunction(Ctx, Mod); - MCInstrDesc MCID = {0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr, nullptr}; + MCInstrDesc MCID = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr}; auto MI = MF->CreateMachineInstr(MCID, DebugLoc()); auto MAI = MCAsmInfo(); @@ -320,7 +320,7 @@ TEST(MachineInstrExtraInfo, ChangeExtraInfo) { LLVMContext Ctx; Module Mod("Module", Ctx); auto MF = createMachineFunction(Ctx, Mod); - MCInstrDesc MCID = {0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr, nullptr}; + MCInstrDesc MCID = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr}; auto MI = MF->CreateMachineInstr(MCID, DebugLoc()); auto MAI = MCAsmInfo(); @@ -361,7 +361,7 @@ TEST(MachineInstrExtraInfo, RemoveExtraInfo) { LLVMContext Ctx; Module Mod("Module", Ctx); auto MF = createMachineFunction(Ctx, Mod); - MCInstrDesc MCID = {0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr, nullptr}; + MCInstrDesc MCID = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr}; auto MI = MF->CreateMachineInstr(MCID, DebugLoc()); auto MAI = MCAsmInfo(); @@ -428,12 +428,10 @@ TEST(MachineInstrDebugValue, AddDebugValueOperand) { TargetOpcode::DBG_INSTR_REF, TargetOpcode::DBG_PHI, TargetOpcode::DBG_LABEL}) { const MCInstrDesc MCID = { - Opcode, 0, - 0, 0, - 0, 0, - 0, (1ULL << MCID::Pseudo) | (1ULL << MCID::Variadic), - 0, nullptr, - nullptr}; + Opcode, 0, 0, + 0, 0, 0, + 0, 0, (1ULL << MCID::Pseudo) | (1ULL << MCID::Variadic), + 0, nullptr}; auto *MI = MF->CreateMachineInstr(MCID, DebugLoc()); MI->addOperand(*MF, MachineOperand::CreateReg(0, /*isDef*/ false)); @@ -463,7 +461,7 @@ TEST(MachineInstrBuilder, BuildMI) { Module Mod("Module", Ctx); auto MF = createMachineFunction(Ctx, Mod); auto MBB = MF->CreateMachineBasicBlock(); - MCInstrDesc MCID = {0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr, nullptr}; + MCInstrDesc MCID = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr}; EXPECT_THAT(BuildMI(*MF, MIMD, MCID), HasMIMetadata(MIMD)); EXPECT_THAT(BuildMI(*MF, MIMD, MCID), HasMIMetadata(MIMD)); EXPECT_THAT(BuildMI(*MBB, MBB->end(), MIMD, MCID), HasMIMetadata(MIMD)); |