1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

[Hexagon] Factoring bundle creation in to a utility function.

llvm-svn: 253056
This commit is contained in:
Colin LeMahieu 2015-11-13 17:42:46 +00:00
parent 2d44d42b91
commit bae5bb8572
8 changed files with 15 additions and 13 deletions

View File

@ -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()));

View File

@ -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;

View File

@ -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();

View File

@ -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)) {

View File

@ -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.

View File

@ -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) {

View File

@ -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) {

View File

@ -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,