mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-08 03:30:22 +00:00
I love non-deturminism. Returning objects with references to stack objects is a bad idea (TM).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34210 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1bc3fa6451
commit
f7e804b683
@ -223,19 +223,22 @@ inline Shr_match<LHS, RHS> m_Shr(const LHS &L, const RHS &R) {
|
||||
|
||||
template<typename LHS_t, typename RHS_t, typename Class, typename OpcType>
|
||||
struct BinaryOpClass_match {
|
||||
OpcType &Opcode;
|
||||
OpcType *Opcode;
|
||||
LHS_t L;
|
||||
RHS_t R;
|
||||
|
||||
BinaryOpClass_match(OpcType &Op, const LHS_t &LHS,
|
||||
const RHS_t &RHS)
|
||||
: Opcode(Op), L(LHS), R(RHS) {}
|
||||
: Opcode(&Op), L(LHS), R(RHS) {}
|
||||
BinaryOpClass_match(const LHS_t &LHS, const RHS_t &RHS)
|
||||
: Opcode(0), L(LHS), R(RHS) {}
|
||||
|
||||
template<typename OpTy>
|
||||
bool match(OpTy *V) {
|
||||
if (Class *I = dyn_cast<Class>(V))
|
||||
if (L.match(I->getOperand(0)) && R.match(I->getOperand(1))) {
|
||||
Opcode = I->getOpcode();
|
||||
if (Opcode)
|
||||
*Opcode = I->getOpcode();
|
||||
return true;
|
||||
}
|
||||
#if 0 // Doesn't handle constantexprs yet!
|
||||
@ -257,9 +260,8 @@ m_Shift(Instruction::BinaryOps &Op, const LHS &L, const RHS &R) {
|
||||
template<typename LHS, typename RHS>
|
||||
inline BinaryOpClass_match<LHS, RHS, BinaryOperator, Instruction::BinaryOps>
|
||||
m_Shift(const LHS &L, const RHS &R) {
|
||||
Instruction::BinaryOps Op;
|
||||
return BinaryOpClass_match<LHS, RHS,
|
||||
BinaryOperator, Instruction::BinaryOps>(Op, L, R);
|
||||
BinaryOperator, Instruction::BinaryOps>(L, R);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
Loading…
Reference in New Issue
Block a user