Remove RCBarriers from TargetInstrDesc.

llvm-svn: 133964
This commit is contained in:
Evan Cheng 2011-06-27 23:47:21 +00:00
parent 7df851a4ff
commit b2fc68c7bc
3 changed files with 1 additions and 68 deletions

View File

@ -130,7 +130,6 @@ public:
uint64_t TSFlags; // Target Specific Flag values
const unsigned *ImplicitUses; // Registers implicitly read by this instr
const unsigned *ImplicitDefs; // Registers implicitly defined by this instr
const TargetRegisterClass **RCBarriers; // Reg classes completely "clobbered"
const TargetOperandInfo *OpInfo; // 'NumOperands' entries about operands
/// getOperandConstraint - Returns the value of the specific constraint if
@ -251,17 +250,6 @@ public:
return false;
}
/// getRegClassBarriers - Return a list of register classes that are
/// completely clobbered by this machine instruction. For example, on X86
/// the call instructions will completely clobber all the registers in the
/// fp stack and XMM classes.
///
/// This method returns null if the instruction doesn't completely clobber
/// any register class.
const TargetRegisterClass **getRegClassBarriers() const {
return RCBarriers;
}
/// getSchedClass - Return the scheduling class for this instruction. The
/// scheduling class is an index into the InstrItineraryData table. This
/// returns zero if there is no known scheduling information for the

View File

@ -27,14 +27,6 @@ static void PrintDefList(const std::vector<Record*> &Uses,
OS << "0 };\n";
}
static void PrintBarriers(std::vector<Record*> &Barriers,
unsigned Num, raw_ostream &OS) {
OS << "static const TargetRegisterClass* Barriers" << Num << "[] = { ";
for (unsigned i = 0, e = Barriers.size(); i != e; ++i)
OS << "&" << getQualifiedName(Barriers[i]) << "RegClass, ";
OS << "NULL };\n";
}
//===----------------------------------------------------------------------===//
// Instruction Itinerary Information.
//===----------------------------------------------------------------------===//
@ -158,33 +150,6 @@ void InstrInfoEmitter::EmitOperandInfo(raw_ostream &OS,
}
}
void InstrInfoEmitter::DetectRegisterClassBarriers(std::vector<Record*> &Defs,
const std::vector<CodeGenRegisterClass> &RCs,
std::vector<Record*> &Barriers) {
std::set<Record*> DefSet;
unsigned NumDefs = Defs.size();
for (unsigned i = 0; i < NumDefs; ++i)
DefSet.insert(Defs[i]);
for (unsigned i = 0, e = RCs.size(); i != e; ++i) {
const CodeGenRegisterClass &RC = RCs[i];
ArrayRef<Record*> Order = RC.getOrder();
if (Order.size() > NumDefs)
continue; // Can't possibly clobber this RC.
bool Clobber = true;
for (unsigned j = 0; j < Order.size(); ++j) {
Record *Reg = Order[j];
if (!DefSet.count(Reg)) {
Clobber = false;
break;
}
}
if (Clobber)
Barriers.push_back(RC.TheDef);
}
}
//===----------------------------------------------------------------------===//
// Main Output.
//===----------------------------------------------------------------------===//
@ -199,14 +164,10 @@ void InstrInfoEmitter::run(raw_ostream &OS) {
CodeGenTarget &Target = CDP.getTargetInfo();
const std::string &TargetName = Target.getName();
Record *InstrInfo = Target.getInstructionSet();
const std::vector<CodeGenRegisterClass> &RCs = Target.getRegisterClasses();
// Keep track of all of the def lists we have emitted already.
std::map<std::vector<Record*>, unsigned> EmittedLists;
unsigned ListNumber = 0;
std::map<std::vector<Record*>, unsigned> EmittedBarriers;
unsigned BarrierNumber = 0;
std::map<Record*, unsigned> BarriersMap;
// Emit all of the instruction's implicit uses and defs.
for (CodeGenTarget::inst_iterator II = Target.inst_begin(),
@ -219,14 +180,6 @@ void InstrInfoEmitter::run(raw_ostream &OS) {
}
std::vector<Record*> Defs = Inst->getValueAsListOfDefs("Defs");
if (!Defs.empty()) {
std::vector<Record*> RCBarriers;
DetectRegisterClassBarriers(Defs, RCs, RCBarriers);
if (!RCBarriers.empty()) {
unsigned &IB = EmittedBarriers[RCBarriers];
if (!IB) PrintBarriers(RCBarriers, IB = ++BarrierNumber, OS);
BarriersMap.insert(std::make_pair(Inst, IB));
}
unsigned &IL = EmittedLists[Defs];
if (!IL) PrintDefList(Defs, IL = ++ListNumber, OS);
}
@ -246,7 +199,7 @@ void InstrInfoEmitter::run(raw_ostream &OS) {
for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i)
emitRecord(*NumberedInstructions[i], i, InstrInfo, EmittedLists,
BarriersMap, OperandInfoIDs, OS);
OperandInfoIDs, OS);
OS << "};\n";
OS << "} // End llvm namespace \n";
}
@ -254,7 +207,6 @@ void InstrInfoEmitter::run(raw_ostream &OS) {
void InstrInfoEmitter::emitRecord(const CodeGenInstruction &Inst, unsigned Num,
Record *InstrInfo,
std::map<std::vector<Record*>, unsigned> &EmittedLists,
std::map<Record*, unsigned> &BarriersMap,
const OperandInfoMapTy &OpInfo,
raw_ostream &OS) {
int MinOperands = 0;
@ -322,12 +274,6 @@ void InstrInfoEmitter::emitRecord(const CodeGenInstruction &Inst, unsigned Num,
else
OS << "ImplicitList" << EmittedLists[DefList] << ", ";
std::map<Record*, unsigned>::iterator BI = BarriersMap.find(Inst.TheDef);
if (BI == BarriersMap.end())
OS << "NULL, ";
else
OS << "Barriers" << BI->second << ", ";
// Emit the operand info.
std::vector<std::string> OperandInfo = GetOperandInfo(Inst);
if (OperandInfo.empty())

View File

@ -44,7 +44,6 @@ private:
void emitRecord(const CodeGenInstruction &Inst, unsigned Num,
Record *InstrInfo,
std::map<std::vector<Record*>, unsigned> &EL,
std::map<Record*, unsigned> &BM,
const OperandInfoMapTy &OpInfo,
raw_ostream &OS);