XCoreISelDAGToDAG.cpp (208954) | XCoreISelDAGToDAG.cpp (212904) |
---|---|
1//===-- XCoreISelDAGToDAG.cpp - A dag to dag inst selector for XCore ------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 42 unchanged lines hidden (view full) --- 51 SDNode *Select(SDNode *N); 52 53 /// getI32Imm - Return a target constant with the specified value, of type 54 /// i32. 55 inline SDValue getI32Imm(unsigned Imm) { 56 return CurDAG->getTargetConstant(Imm, MVT::i32); 57 } 58 | 1//===-- XCoreISelDAGToDAG.cpp - A dag to dag inst selector for XCore ------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 42 unchanged lines hidden (view full) --- 51 SDNode *Select(SDNode *N); 52 53 /// getI32Imm - Return a target constant with the specified value, of type 54 /// i32. 55 inline SDValue getI32Imm(unsigned Imm) { 56 return CurDAG->getTargetConstant(Imm, MVT::i32); 57 } 58 |
59 inline bool immMskBitp(SDNode *inN) const { 60 ConstantSDNode *N = cast<ConstantSDNode>(inN); 61 uint32_t value = (uint32_t)N->getZExtValue(); 62 if (!isMask_32(value)) { 63 return false; 64 } 65 int msksize = 32 - CountLeadingZeros_32(value); 66 return (msksize >= 1 && msksize <= 8) || 67 msksize == 16 || msksize == 24 || msksize == 32; 68 } 69 |
|
59 // Complex Pattern Selectors. 60 bool SelectADDRspii(SDNode *Op, SDValue Addr, SDValue &Base, 61 SDValue &Offset); 62 bool SelectADDRdpii(SDNode *Op, SDValue Addr, SDValue &Base, 63 SDValue &Offset); 64 bool SelectADDRcpii(SDNode *Op, SDValue Addr, SDValue &Base, 65 SDValue &Offset); 66 --- 79 unchanged lines hidden (view full) --- 146 147SDNode *XCoreDAGToDAGISel::Select(SDNode *N) { 148 DebugLoc dl = N->getDebugLoc(); 149 EVT NVT = N->getValueType(0); 150 if (NVT == MVT::i32) { 151 switch (N->getOpcode()) { 152 default: break; 153 case ISD::Constant: { | 70 // Complex Pattern Selectors. 71 bool SelectADDRspii(SDNode *Op, SDValue Addr, SDValue &Base, 72 SDValue &Offset); 73 bool SelectADDRdpii(SDNode *Op, SDValue Addr, SDValue &Base, 74 SDValue &Offset); 75 bool SelectADDRcpii(SDNode *Op, SDValue Addr, SDValue &Base, 76 SDValue &Offset); 77 --- 79 unchanged lines hidden (view full) --- 157 158SDNode *XCoreDAGToDAGISel::Select(SDNode *N) { 159 DebugLoc dl = N->getDebugLoc(); 160 EVT NVT = N->getValueType(0); 161 if (NVT == MVT::i32) { 162 switch (N->getOpcode()) { 163 default: break; 164 case ISD::Constant: { |
154 if (Predicate_immMskBitp(N)) { | 165 uint64_t Val = cast<ConstantSDNode>(N)->getZExtValue(); 166 if (immMskBitp(N)) { |
155 // Transformation function: get the size of a mask | 167 // Transformation function: get the size of a mask |
156 int64_t MaskVal = cast<ConstantSDNode>(N)->getZExtValue(); 157 assert(isMask_32(MaskVal)); | |
158 // Look for the first non-zero bit | 168 // Look for the first non-zero bit |
159 SDValue MskSize = getI32Imm(32 - CountLeadingZeros_32(MaskVal)); | 169 SDValue MskSize = getI32Imm(32 - CountLeadingZeros_32(Val)); |
160 return CurDAG->getMachineNode(XCore::MKMSK_rus, dl, 161 MVT::i32, MskSize); 162 } | 170 return CurDAG->getMachineNode(XCore::MKMSK_rus, dl, 171 MVT::i32, MskSize); 172 } |
163 else if (! Predicate_immU16(N)) { 164 unsigned Val = cast<ConstantSDNode>(N)->getZExtValue(); | 173 else if (!isUInt<16>(Val)) { |
165 SDValue CPIdx = 166 CurDAG->getTargetConstantPool(ConstantInt::get( 167 Type::getInt32Ty(*CurDAG->getContext()), Val), 168 TLI.getPointerTy()); 169 return CurDAG->getMachineNode(XCore::LDWCP_lru6, dl, MVT::i32, 170 MVT::Other, CPIdx, 171 CurDAG->getEntryNode()); 172 } --- 37 unchanged lines hidden --- | 174 SDValue CPIdx = 175 CurDAG->getTargetConstantPool(ConstantInt::get( 176 Type::getInt32Ty(*CurDAG->getContext()), Val), 177 TLI.getPointerTy()); 178 return CurDAG->getMachineNode(XCore::LDWCP_lru6, dl, MVT::i32, 179 MVT::Other, CPIdx, 180 CurDAG->getEntryNode()); 181 } --- 37 unchanged lines hidden --- |