From 862bd78f8caf8af526c1b6baf418d98940a3e0b2 Mon Sep 17 00:00:00 2001 From: Langston Barrett Date: Fri, 7 Oct 2022 16:44:54 -0400 Subject: [PATCH] FactGenerator: Consistent names for multi-word opcodes --- FactGenerator/include/predicates.inc | 71 +++++++++++------------- FactGenerator/src/InstructionVisitor.cpp | 41 +++++++------- 2 files changed, 53 insertions(+), 59 deletions(-) diff --git a/FactGenerator/include/predicates.inc b/FactGenerator/include/predicates.inc index b57898f..fee3bbe 100644 --- a/FactGenerator/include/predicates.inc +++ b/FactGenerator/include/predicates.inc @@ -241,47 +241,42 @@ GROUP_END(invoke) // Vector Operations -GROUP_BEGIN(extract_element) -// TODO(#42): Rename extract_element to extractelement -PREDICATE(extract_element, instr, extractelement_instr) -PREDICATE(extract_element, base, extractelement_instr_base) -PREDICATE(extract_element, index, extractelement_instr_index) -GROUP_END(extract_element) - -GROUP_BEGIN(insert_element) -// TODO(#42): Rename insert_element to insertelement -PREDICATE(insert_element, instr, insertelement_instr) -PREDICATE(insert_element, base, insertelement_instr_base) -PREDICATE(insert_element, index, insertelement_instr_index) -PREDICATE(insert_element, value, insertelement_instr_value) -GROUP_END(insert_element) - -GROUP_BEGIN(shuffle_vector) -// TODO(#42): Rename shuffle_vector to shufflevector -PREDICATE(shuffle_vector, instr, shufflevector_instr) -PREDICATE(shuffle_vector, first_vector, shufflevector_instr_first_vector) -PREDICATE(shuffle_vector, second_vector, shufflevector_instr_second_vector) -PREDICATE(shuffle_vector, mask, shufflevector_instr_mask) -GROUP_END(shuffle_vector) +GROUP_BEGIN(extractelement) +PREDICATE2(extractelement, instr) +PREDICATEI(extractelement, base) +PREDICATEI(extractelement, index) +GROUP_END(extractelement) + +GROUP_BEGIN(insertelement) +PREDICATE2(insertelement, instr) +PREDICATEI(insertelement, base) +PREDICATEI(insertelement, index) +PREDICATEI(insertelement, value) +GROUP_END(insertelement) + +GROUP_BEGIN(shufflevector) +PREDICATE2(shufflevector, instr) +PREDICATEI(shufflevector, first_vector) +PREDICATEI(shufflevector, second_vector) +PREDICATEI(shufflevector, mask) +GROUP_END(shufflevector) // Aggregate Operations -GROUP_BEGIN(extract_value) -// TODO(#42): Rename extract_value to extractvalue -PREDICATE(extract_value, instr, extractvalue_instr) -PREDICATE(extract_value, base, extractvalue_instr_base) -PREDICATE(extract_value, index, extractvalue_instr_index) -PREDICATE(extract_value, nindices, extractvalue_instr_nindices) -GROUP_END(extract_value) - -GROUP_BEGIN(insert_value) -// TODO(#42): Rename insert_value to insertvalue -PREDICATE(insert_value, instr, insertvalue_instr) -PREDICATE(insert_value, base, insertvalue_instr_base) -PREDICATE(insert_value, value, insertvalue_instr_value) -PREDICATE(insert_value, index, insertvalue_instr_index) -PREDICATE(insert_value, nindices, insertvalue_instr_nindices) -GROUP_END(insert_value) +GROUP_BEGIN(extractvalue) +PREDICATE2(extractvalue, instr) +PREDICATEI(extractvalue, base) +PREDICATEI(extractvalue, index) +PREDICATEI(extractvalue, nindices) +GROUP_END(extractvalue) + +GROUP_BEGIN(insertvalue) +PREDICATE2(insertvalue, instr) +PREDICATEI(insertvalue, base) +PREDICATEI(insertvalue, value) +PREDICATEI(insertvalue, index) +PREDICATEI(insertvalue, nindices) +GROUP_END(insertvalue) // Memory Operations diff --git a/FactGenerator/src/InstructionVisitor.cpp b/FactGenerator/src/InstructionVisitor.cpp index fbdba4d..cda8eab 100644 --- a/FactGenerator/src/InstructionVisitor.cpp +++ b/FactGenerator/src/InstructionVisitor.cpp @@ -359,19 +359,19 @@ void InstructionVisitor::visitVAArgInst(const llvm::VAArgInst &VI) { void InstructionVisitor::visitExtractValueInst( const llvm::ExtractValueInst &EVI) { - refmode_t iref = recordInstruction(pred::extract_value::instr, EVI); + refmode_t iref = recordInstruction(pred::extractvalue::instr, EVI); // Aggregate Operand - writeInstrOperand(pred::extract_value::base, iref, EVI.getOperand(0)); + writeInstrOperand(pred::extractvalue::base, iref, EVI.getOperand(0)); // Constant Indices int index = 0; for (const unsigned *i = EVI.idx_begin(), *e = EVI.idx_end(); i != e; ++i) { - gen.writeFact(pred::extract_value::index, iref, index++, *i); + gen.writeFact(pred::extractvalue::index, iref, index++, *i); } - gen.writeFact(pred::extract_value::nindices, iref, EVI.getNumIndices()); + gen.writeFact(pred::extractvalue::nindices, iref, EVI.getNumIndices()); } void InstructionVisitor::visitStoreInst(const llvm::StoreInst &SI) { @@ -497,19 +497,19 @@ void InstructionVisitor::visitSelectInst(const llvm::SelectInst &SI) { void InstructionVisitor::visitInsertValueInst( const llvm::InsertValueInst &IVI) { - refmode_t iref = recordInstruction(pred::insert_value::instr, IVI); + refmode_t iref = recordInstruction(pred::insertvalue::instr, IVI); - writeInstrOperand(pred::insert_value::base, iref, IVI.getOperand(0)); - writeInstrOperand(pred::insert_value::value, iref, IVI.getOperand(1)); + writeInstrOperand(pred::insertvalue::base, iref, IVI.getOperand(0)); + writeInstrOperand(pred::insertvalue::value, iref, IVI.getOperand(1)); // Constant Indices int index = 0; for (const unsigned *i = IVI.idx_begin(), *e = IVI.idx_end(); i != e; ++i) { - gen.writeFact(pred::insert_value::index, iref, index++, *i); + gen.writeFact(pred::insertvalue::index, iref, index++, *i); } - gen.writeFact(pred::insert_value::nindices, iref, IVI.getNumIndices()); + gen.writeFact(pred::insertvalue::nindices, iref, IVI.getNumIndices()); } void InstructionVisitor::visitLandingPadInst(const llvm::LandingPadInst &LI) { @@ -644,30 +644,29 @@ void InstructionVisitor::visitFCmpInst(const llvm::FCmpInst &I) { void InstructionVisitor::visitExtractElementInst( const llvm::ExtractElementInst &EEI) { - refmode_t iref = recordInstruction(pred::extract_element::instr, EEI); + refmode_t iref = recordInstruction(pred::extractelement::instr, EEI); - writeInstrOperand(pred::extract_element::base, iref, EEI.getVectorOperand()); - writeInstrOperand(pred::extract_element::index, iref, EEI.getIndexOperand()); + writeInstrOperand(pred::extractelement::base, iref, EEI.getVectorOperand()); + writeInstrOperand(pred::extractelement::index, iref, EEI.getIndexOperand()); } void InstructionVisitor::visitInsertElementInst( const llvm::InsertElementInst &IEI) { - refmode_t iref = recordInstruction(pred::insert_element::instr, IEI); + refmode_t iref = recordInstruction(pred::insertelement::instr, IEI); - writeInstrOperand(pred::insert_element::base, iref, IEI.getOperand(0)); - writeInstrOperand(pred::insert_element::value, iref, IEI.getOperand(1)); - writeInstrOperand(pred::insert_element::index, iref, IEI.getOperand(2)); + writeInstrOperand(pred::insertelement::base, iref, IEI.getOperand(0)); + writeInstrOperand(pred::insertelement::value, iref, IEI.getOperand(1)); + writeInstrOperand(pred::insertelement::index, iref, IEI.getOperand(2)); } void InstructionVisitor::visitShuffleVectorInst( const llvm::ShuffleVectorInst &SVI) { - refmode_t iref = recordInstruction(pred::shuffle_vector::instr, SVI); + refmode_t iref = recordInstruction(pred::shufflevector::instr, SVI); + writeInstrOperand(pred::shufflevector::first_vector, iref, SVI.getOperand(0)); writeInstrOperand( - pred::shuffle_vector::first_vector, iref, SVI.getOperand(0)); - writeInstrOperand( - pred::shuffle_vector::second_vector, iref, SVI.getOperand(1)); - writeInstrOperand(pred::shuffle_vector::mask, iref, SVI.getOperand(2)); + pred::shufflevector::second_vector, iref, SVI.getOperand(1)); + writeInstrOperand(pred::shufflevector::mask, iref, SVI.getOperand(2)); } void InstructionVisitor::visitInstruction(const llvm::Instruction &I) {