forked from OSchip/llvm-project
[Hexagon] Factoring bundle creation in to a utility function.
llvm-svn: 253056
This commit is contained in:
parent
c674ecedc3
commit
f0af6e5243
|
@ -137,8 +137,7 @@ public:
|
|||
HexagonAsmParser(MCSubtargetInfo &_STI, MCAsmParser &_Parser,
|
||||
const MCInstrInfo &MII, const MCTargetOptions &Options)
|
||||
: MCTargetAsmParser(Options), STI(_STI), Parser(_Parser),
|
||||
MCII (MII), InBrackets(false) {
|
||||
MCB.setOpcode(Hexagon::BUNDLE);
|
||||
MCII (MII), MCB(HexagonMCInstrInfo::createBundle()), InBrackets(false) {
|
||||
setAvailableFeatures(
|
||||
ComputeAvailableFeatures(_STI.getFeatureBits()));
|
||||
|
||||
|
|
|
@ -162,8 +162,7 @@ DecodeStatus HexagonDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
|
|||
Size = 0;
|
||||
|
||||
*CurrentBundle = &MI;
|
||||
MI.setOpcode(Hexagon::BUNDLE);
|
||||
MI.addOperand(MCOperand::createImm(0));
|
||||
MI = HexagonMCInstrInfo::createBundle();
|
||||
while (Result == Success && Complete == false) {
|
||||
if (Bytes.size() < HEXAGON_INSTR_SIZE)
|
||||
return MCDisassembler::Fail;
|
||||
|
|
|
@ -178,9 +178,7 @@ bool HexagonAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
|||
/// the current output stream.
|
||||
///
|
||||
void HexagonAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
MCInst MCB;
|
||||
MCB.setOpcode(Hexagon::BUNDLE);
|
||||
MCB.addOperand(MCOperand::createImm(0));
|
||||
MCInst MCB = HexagonMCInstrInfo::createBundle();
|
||||
|
||||
if (MI->isBundle()) {
|
||||
const MachineBasicBlock* MBB = MI->getParent();
|
||||
|
|
|
@ -281,8 +281,7 @@ public:
|
|||
assert(HexagonMCInstrInfo::isBundle(Inst) &&
|
||||
"Hexagon relaxInstruction only works on bundles");
|
||||
|
||||
Res.setOpcode(Hexagon::BUNDLE);
|
||||
Res.addOperand(MCOperand::createImm(0));
|
||||
Res = HexagonMCInstrInfo::createBundle();
|
||||
// Copy the results into the bundle.
|
||||
bool Update = false;
|
||||
for (auto &I : HexagonMCInstrInfo::bundleInstructions(Inst)) {
|
||||
|
|
|
@ -411,7 +411,7 @@ bool lookForCompound(MCInstrInfo const &MCII, MCContext &Context, MCInst &MCI) {
|
|||
/// additional slot.
|
||||
void HexagonMCInstrInfo::tryCompound(MCInstrInfo const &MCII,
|
||||
MCContext &Context, MCInst &MCI) {
|
||||
assert(MCI.getOpcode() == Hexagon::BUNDLE &&
|
||||
assert(HexagonMCInstrInfo::isBundle(MCI) &&
|
||||
"Non-Bundle where Bundle expected");
|
||||
|
||||
// By definition a compound must have 2 insn.
|
||||
|
|
|
@ -37,9 +37,7 @@ static cl::opt<unsigned>
|
|||
|
||||
void HexagonMCELFStreamer::EmitInstruction(const MCInst &MCK,
|
||||
const MCSubtargetInfo &STI) {
|
||||
MCInst HMI;
|
||||
HMI.setOpcode(Hexagon::BUNDLE);
|
||||
HMI.addOperand(MCOperand::createImm(0));
|
||||
MCInst HMI = HexagonMCInstrInfo::createBundle();
|
||||
MCInst *MCB;
|
||||
|
||||
if (MCK.getOpcode() != Hexagon::BUNDLE) {
|
||||
|
|
|
@ -104,6 +104,13 @@ void HexagonMCInstrInfo::clampExtended(MCInstrInfo const &MCII,
|
|||
}
|
||||
}
|
||||
|
||||
MCInst HexagonMCInstrInfo::createBundle() {
|
||||
MCInst Result;
|
||||
Result.setOpcode(Hexagon::BUNDLE);
|
||||
Result.addOperand(MCOperand::createImm(0));
|
||||
return Result;
|
||||
}
|
||||
|
||||
MCInst *HexagonMCInstrInfo::deriveDuplex(MCContext &Context, unsigned iClass,
|
||||
MCInst const &inst0,
|
||||
MCInst const &inst1) {
|
||||
|
|
|
@ -70,6 +70,8 @@ bool canonicalizePacket(MCInstrInfo const &MCII, MCSubtargetInfo const &STI,
|
|||
// Clamp off upper 26 bits of extendable operand for emission
|
||||
void clampExtended(MCInstrInfo const &MCII, MCContext &Context, MCInst &MCI);
|
||||
|
||||
MCInst createBundle();
|
||||
|
||||
// Return the extender for instruction at Index or nullptr if none
|
||||
MCInst const *extenderForIndex(MCInst const &MCB, size_t Index);
|
||||
void extendIfNeeded(MCContext &Context, MCInstrInfo const &MCII, MCInst &MCB,
|
||||
|
|
Loading…
Reference in New Issue