//===-- SelectionDAG.cpp - Implement the SelectionDAG data structures -----===//// // The LLVM Compiler Infrastructure//// This file was developed by the LLVM research group and is distributed under// the University of Illinois Open Source License. See LICENSE.TXT for details.// //===----------------------------------------------------------------------===////// This implements the SelectionDAG class.////===----------------------------------------------------------------------===//#include"llvm/CodeGen/SelectionDAG.h"#include"llvm/Constants.h"#include"llvm/GlobalValue.h"#include"llvm/Assembly/Writer.h"#include"llvm/CodeGen/MachineBasicBlock.h"#include"llvm/Target/TargetLowering.h"#include<iostream>#include<set>#include<cmath>#include<algorithm>usingnamespacellvm;staticboolisCommutativeBinOp(unsignedOpcode){switch(Opcode){caseISD::ADD:caseISD::MUL:caseISD::AND:caseISD::OR:caseISD::XOR:returntrue;default:returnfalse;// FIXME: Need commutative info for user ops!}}staticboolisAssociativeBinOp(unsignedOpcode){switch(Opcode){caseISD::ADD:caseISD::MUL:caseISD::AND:caseISD::OR:caseISD::XOR:returntrue;default:returnfalse;// FIXME: Need associative in