-
-/// Returns true if the opcode is an operation with optional optimization flags.
-static bool mayHaveOptimizationFlags(unsigned Opcode) {
- switch (Opcode) {
- case ISD::SDIV:
- case ISD::UDIV:
- case ISD::SRA:
- case ISD::SRL:
- case ISD::MUL:
- case ISD::ADD:
- case ISD::SUB:
- case ISD::SHL:
- case ISD::FADD:
- case ISD::FDIV:
- case ISD::FMUL:
- case ISD::FREM:
- case ISD::FSUB:
- return true;
- default:
- return false;
- }
-}
-/// This class is an extension of SDNode used from instructions that may have
-/// associated extra flags.
-class SDNodeWithFlags : public SDNode {
-public:
- SDNodeFlags Flags;
- SDNodeWithFlags(unsigned Opc, unsigned Order, DebugLoc dl, SDVTList VTs,
- ArrayRef<SDValue> Ops, const SDNodeFlags &NodeFlags)
- : SDNode(Opc, Order, dl, VTs, Ops) {
- Flags = NodeFlags;
- }
-
- // This is used to implement dyn_cast, isa, and other type queries.
- static bool classof(const SDNode *N) {
- return mayHaveOptimizationFlags(N->getOpcode());
- }
-};