LLVM: lib/Target/X86/MCA/X86CustomBehaviour.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
19
20namespace llvm {
21namespace mca {
22
23void X86InstrPostProcess::setMemBarriers(Instruction &Inst, const MCInst &MCI) {
25 case X86::MFENCE:
26 Inst.setLoadBarrier(true);
27 Inst.setStoreBarrier(true);
28 break;
29 case X86::LFENCE:
30 Inst.setLoadBarrier(true);
31 break;
32 case X86::SFENCE:
33 Inst.setStoreBarrier(true);
34 break;
35 }
36}
37
38void X86InstrPostProcess::useStackEngine(Instruction &Inst, const MCInst &MCI) {
39
40
41
42
43
44
46 auto *StackRegisterDef =
47 llvm::find_if(Inst.getDefs(), [](const WriteState &State) {
48 return State.getRegisterID() == X86::RSP;
49 });
51 StackRegisterDef != Inst.getDefs().end() &&
52 "Expected push instruction to implicitly use stack pointer register.");
53 Inst.getDefs().erase(StackRegisterDef);
54 }
55}
56
59
60 setMemBarriers(Inst, MCI);
61 useStackEngine(Inst, MCI);
62}
63
64}
65}
66
67using namespace llvm;
68using namespace mca;
69
74
75
76
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_C_ABI
LLVM_C_ABI is the export/visibility macro used to mark symbols declared in llvm-c as exported when bu...
LLVM_C_ABI void LLVMInitializeX86TargetMCA()
Extern function to initialize the targets for the X86 backend.
Definition X86CustomBehaviour.cpp:77
static InstrPostProcess * createX86InstrPostProcess(const MCSubtargetInfo &STI, const MCInstrInfo &MCII)
Definition X86CustomBehaviour.cpp:70
This file defines the X86CustomBehaviour class which inherits from CustomBehaviour.
Instances of this class represent a single low-level machine instruction.
unsigned getOpcode() const
Interface to description of machine instruction set.
Generic base class for all target subtargets.
Class which can be overriden by targets to modify the mca::Instruction objects before the pipeline st...
An instruction propagated through the simulated instruction pipeline.
void postProcessInstruction(Instruction &Inst, const MCInst &MCI) override
This method can be overriden by targets to modify the mca::Instruction object after it has been lower...
Definition X86CustomBehaviour.cpp:57
This is an optimization pass for GlobalISel generic memory operations.
Target & getTheX86_32Target()
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
Target & getTheX86_64Target()
static void RegisterInstrPostProcess(Target &T, Target::InstrPostProcessCtorTy Fn)
RegisterInstrPostProcess - Register an InstrPostProcess implementation for the given target.