diff options
author | Charles Davis <cdavis5x@gmail.com> | 2016-08-08 21:20:15 +0000 |
---|---|---|
committer | Charles Davis <cdavis5x@gmail.com> | 2016-08-08 21:20:15 +0000 |
commit | e9c32c7ed3d587696b9757f8f5151c914df2aff5 (patch) | |
tree | 4bafffe7bd125db9866f668cde0b04fafa1bc5b0 /llvm/lib/CodeGen/PatchableFunction.cpp | |
parent | 0e37911334775fe64070ba38e2642b35b5c38cb6 (diff) | |
download | llvm-e9c32c7ed3d587696b9757f8f5151c914df2aff5.zip llvm-e9c32c7ed3d587696b9757f8f5151c914df2aff5.tar.gz llvm-e9c32c7ed3d587696b9757f8f5151c914df2aff5.tar.bz2 |
Revert "[X86] Support the "ms-hotpatch" attribute."
This reverts commit r278048. Something changed between the last time I
built this--it takes awhile on my ridiculously slow and ancient
computer--and now that broke this.
llvm-svn: 278053
Diffstat (limited to 'llvm/lib/CodeGen/PatchableFunction.cpp')
-rw-r--r-- | llvm/lib/CodeGen/PatchableFunction.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/llvm/lib/CodeGen/PatchableFunction.cpp b/llvm/lib/CodeGen/PatchableFunction.cpp index c94307d..32468c9 100644 --- a/llvm/lib/CodeGen/PatchableFunction.cpp +++ b/llvm/lib/CodeGen/PatchableFunction.cpp @@ -13,11 +13,12 @@ //===----------------------------------------------------------------------===// #include "llvm/CodeGen/Passes.h" -#include "llvm/Analysis/TargetTransformInfo.h" -#include "llvm/CodeGen/Analysis.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/Target/TargetFrameLowering.h" +#include "llvm/Target/TargetInstrInfo.h" +#include "llvm/Target/TargetSubtargetInfo.h" using namespace llvm; @@ -28,9 +29,8 @@ struct PatchableFunction : public MachineFunctionPass { initializePatchableFunctionPass(*PassRegistry::getPassRegistry()); } - void getAnalysisUsage(AnalysisUsage &AU) const override; bool runOnMachineFunction(MachineFunction &F) override; - MachineFunctionProperties getRequiredProperties() const override { + MachineFunctionProperties getRequiredProperties() const override { return MachineFunctionProperties().set( MachineFunctionProperties::Property::AllVRegsAllocated); } @@ -53,29 +53,31 @@ static bool doesNotGeneratecode(const MachineInstr &MI) { } } -void PatchableFunction::getAnalysisUsage(AnalysisUsage &AU) const { - MachineFunctionPass::getAnalysisUsage(AU); - AU.addRequired<TargetTransformInfoWrapperPass>(); -} - bool PatchableFunction::runOnMachineFunction(MachineFunction &MF) { if (!MF.getFunction()->hasFnAttribute("patchable-function")) return false; +#ifndef NDEBUG Attribute PatchAttr = MF.getFunction()->getFnAttribute("patchable-function"); StringRef PatchType = PatchAttr.getValueAsString(); - assert((PatchType == "prologue-short-redirect" || - PatchType == "ms-hotpatch") && "Only possibilities today!"); + assert(PatchType == "prologue-short-redirect" && "Only possibility today!"); +#endif auto &FirstMBB = *MF.begin(); MachineBasicBlock::iterator FirstActualI = FirstMBB.begin(); for (; doesNotGeneratecode(*FirstActualI); ++FirstActualI) assert(FirstActualI != FirstMBB.end()); - const TargetTransformInfo &TTI = - getAnalysis<TargetTransformInfoWrapperPass>().getTTI(*MF.getFunction()); - TTI.emitPatchableOp(PatchType, FirstMBB, FirstActualI); + auto *TII = MF.getSubtarget().getInstrInfo(); + auto MIB = BuildMI(FirstMBB, FirstActualI, FirstActualI->getDebugLoc(), + TII->get(TargetOpcode::PATCHABLE_OP)) + .addImm(2) + .addImm(FirstActualI->getOpcode()); + + for (auto &MO : FirstActualI->operands()) + MIB.addOperand(MO); + FirstActualI->eraseFromParent(); MF.ensureAlignment(4); return true; } |