26 #define DEBUG_TYPE "bpf-mi-checking" 44 void checkingIllegalXADD(
void);
52 checkingIllegalXADD();
108 &BPFMCRegisterClasses[BPF::GPRRegClassID];
109 std::vector<unsigned> GPR32LiveDefs;
110 std::vector<unsigned> GPR64DeadDefs;
115 if (!MO.isReg() || MO.isUse())
118 RegIsGPR64 = GPR64RegClass->
contains(MO.getReg());
126 GPR32LiveDefs.push_back(MO.getReg());
133 GPR64DeadDefs.push_back(MO.getReg());
137 if (GPR32LiveDefs.empty())
142 if (GPR64DeadDefs.empty())
146 std::vector<unsigned>::iterator search_begin = GPR64DeadDefs.begin();
147 std::vector<unsigned>::iterator search_end = GPR64DeadDefs.end();
148 for (
auto I : GPR32LiveDefs)
150 if (
std::find(search_begin, search_end, *SR) == search_end)
156 void BPFMIPreEmitChecking::checkingIllegalXADD(
void) {
165 if (hasLiveDefs(MI, TRI)) {
170 ": Invalid usage of the XADD return value",
false);
183 "BPF PreEmit Checking",
false,
false)
188 return new BPFMIPreEmitChecking();
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
FunctionPass * createBPFMIPreEmitCheckingPass()
void initializeBPFMIPreEmitCheckingPass(PassRegistry &)
unsigned const TargetRegisterInfo * TRI
iterator_range< mop_iterator > operands()
MCSuperRegIterator enumerates all super-registers of Reg.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
bool contains(MCRegister Reg) const
contains - Return true if the specified register is included in this register class.
static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T, ArrayRef< StringLiteral > StandardNames)
Initialize the set of available library functions based on the specified target triple.
MCRegisterClass - Base class of TargetRegisterClass.
FunctionPass class - This class is used to implement most global optimizations.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
auto find(R &&Range, const T &Val) -> decltype(adl_begin(Range))
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly...
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
MachineOperand class - Representation of each machine instruction operand.
const Function & getFunction() const
Return the LLVM function that this machine code represents.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
Representation of each machine instruction.
const std::string to_string(const T &Value)