LegalizeDAG.cpp (198396) | LegalizeDAG.cpp (198892) |
---|---|
1//===-- LegalizeDAG.cpp - Implement SelectionDAG::Legalize ----------------===// 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//===----------------------------------------------------------------------===// --- 18 unchanged lines hidden (view full) --- 27#include "llvm/Target/TargetSubtarget.h" 28#include "llvm/CallingConv.h" 29#include "llvm/Constants.h" 30#include "llvm/DerivedTypes.h" 31#include "llvm/Function.h" 32#include "llvm/GlobalVariable.h" 33#include "llvm/LLVMContext.h" 34#include "llvm/Support/CommandLine.h" | 1//===-- LegalizeDAG.cpp - Implement SelectionDAG::Legalize ----------------===// 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//===----------------------------------------------------------------------===// --- 18 unchanged lines hidden (view full) --- 27#include "llvm/Target/TargetSubtarget.h" 28#include "llvm/CallingConv.h" 29#include "llvm/Constants.h" 30#include "llvm/DerivedTypes.h" 31#include "llvm/Function.h" 32#include "llvm/GlobalVariable.h" 33#include "llvm/LLVMContext.h" 34#include "llvm/Support/CommandLine.h" |
35#include "llvm/Support/Compiler.h" | |
36#include "llvm/Support/ErrorHandling.h" 37#include "llvm/Support/MathExtras.h" 38#include "llvm/Support/raw_ostream.h" 39#include "llvm/ADT/DenseMap.h" 40#include "llvm/ADT/SmallVector.h" 41#include "llvm/ADT/SmallPtrSet.h" 42#include <map> 43using namespace llvm; --- 6 unchanged lines hidden (view full) --- 50/// eliminating operations the machine cannot handle. 51/// 52/// This code also does a small amount of optimization and recognition of idioms 53/// as part of its processing. For example, if a target does not support a 54/// 'setcc' instruction efficiently, but does support 'brcc' instruction, this 55/// will attempt merge setcc and brc instructions into brcc's. 56/// 57namespace { | 35#include "llvm/Support/ErrorHandling.h" 36#include "llvm/Support/MathExtras.h" 37#include "llvm/Support/raw_ostream.h" 38#include "llvm/ADT/DenseMap.h" 39#include "llvm/ADT/SmallVector.h" 40#include "llvm/ADT/SmallPtrSet.h" 41#include <map> 42using namespace llvm; --- 6 unchanged lines hidden (view full) --- 49/// eliminating operations the machine cannot handle. 50/// 51/// This code also does a small amount of optimization and recognition of idioms 52/// as part of its processing. For example, if a target does not support a 53/// 'setcc' instruction efficiently, but does support 'brcc' instruction, this 54/// will attempt merge setcc and brc instructions into brcc's. 55/// 56namespace { |
58class VISIBILITY_HIDDEN SelectionDAGLegalize { | 57class SelectionDAGLegalize { |
59 TargetLowering &TLI; 60 SelectionDAG &DAG; 61 CodeGenOpt::Level OptLevel; 62 63 // Libcall insertion helpers. 64 65 /// LastCALLSEQ_END - This keeps track of the CALLSEQ_END node that has been 66 /// legalized. We use this to ensure that calls are properly serialized --- 2502 unchanged lines hidden (view full) --- 2569 break; 2570 case ISD::FREM: 2571 Results.push_back(ExpandFPLibCall(Node, RTLIB::REM_F32, RTLIB::REM_F64, 2572 RTLIB::REM_F80, RTLIB::REM_PPCF128)); 2573 break; 2574 case ISD::ConstantFP: { 2575 ConstantFPSDNode *CFP = cast<ConstantFPSDNode>(Node); 2576 // Check to see if this FP immediate is already legal. | 58 TargetLowering &TLI; 59 SelectionDAG &DAG; 60 CodeGenOpt::Level OptLevel; 61 62 // Libcall insertion helpers. 63 64 /// LastCALLSEQ_END - This keeps track of the CALLSEQ_END node that has been 65 /// legalized. We use this to ensure that calls are properly serialized --- 2502 unchanged lines hidden (view full) --- 2568 break; 2569 case ISD::FREM: 2570 Results.push_back(ExpandFPLibCall(Node, RTLIB::REM_F32, RTLIB::REM_F64, 2571 RTLIB::REM_F80, RTLIB::REM_PPCF128)); 2572 break; 2573 case ISD::ConstantFP: { 2574 ConstantFPSDNode *CFP = cast<ConstantFPSDNode>(Node); 2575 // Check to see if this FP immediate is already legal. |
2577 bool isLegal = false; 2578 for (TargetLowering::legal_fpimm_iterator I = TLI.legal_fpimm_begin(), 2579 E = TLI.legal_fpimm_end(); I != E; ++I) { 2580 if (CFP->isExactlyValue(*I)) { 2581 isLegal = true; 2582 break; 2583 } 2584 } | |
2585 // If this is a legal constant, turn it into a TargetConstantFP node. | 2576 // If this is a legal constant, turn it into a TargetConstantFP node. |
2586 if (isLegal) | 2577 if (TLI.isFPImmLegal(CFP->getValueAPF(), Node->getValueType(0))) |
2587 Results.push_back(SDValue(Node, 0)); 2588 else 2589 Results.push_back(ExpandConstantFP(CFP, true, DAG, TLI)); 2590 break; 2591 } 2592 case ISD::EHSELECTION: { 2593 unsigned Reg = TLI.getExceptionSelectorRegister(); 2594 assert(Reg && "Can't expand to unknown register!"); --- 489 unchanged lines hidden --- | 2578 Results.push_back(SDValue(Node, 0)); 2579 else 2580 Results.push_back(ExpandConstantFP(CFP, true, DAG, TLI)); 2581 break; 2582 } 2583 case ISD::EHSELECTION: { 2584 unsigned Reg = TLI.getExceptionSelectorRegister(); 2585 assert(Reg && "Can't expand to unknown register!"); --- 489 unchanged lines hidden --- |