llvm.org GIT mirror llvm / 028700f
Move parts of lib/Target that use CodeGen into lib/CodeGen. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146702 91177308-0d34-0410-b5e6-96231b3b80d8 Nick Lewycky 8 years ago
8 changed file(s) with 129 addition(s) and 128 deletion(s). Raw diff Collapse all Expand all
9292 StackSlotColoring.cpp
9393 StrongPHIElimination.cpp
9494 TailDuplication.cpp
95 TargetFrameLoweringImpl.cpp
9596 TargetInstrInfoImpl.cpp
9697 TargetLoweringObjectFileImpl.cpp
98 TargetOptionsImpl.cpp
9799 TwoAddressInstructionPass.cpp
98100 UnreachableBlockElim.cpp
99101 VirtRegMap.cpp
0 //===----- TargetFrameLoweringImpl.cpp - Implement target frame interface --==//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Implements the layout of a stack frame on the target machine.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "llvm/CodeGen/MachineFrameInfo.h"
14 #include "llvm/CodeGen/MachineFunction.h"
15 #include "llvm/Target/TargetFrameLowering.h"
16 #include "llvm/Target/TargetMachine.h"
17 #include "llvm/Target/TargetRegisterInfo.h"
18
19 #include
20 using namespace llvm;
21
22 TargetFrameLowering::~TargetFrameLowering() {
23 }
24
25 /// getFrameIndexOffset - Returns the displacement from the frame register to
26 /// the stack frame of the specified index. This is the default implementation
27 /// which is overridden for some targets.
28 int TargetFrameLowering::getFrameIndexOffset(const MachineFunction &MF,
29 int FI) const {
30 const MachineFrameInfo *MFI = MF.getFrameInfo();
31 return MFI->getObjectOffset(FI) + MFI->getStackSize() -
32 getOffsetOfLocalArea() + MFI->getOffsetAdjustment();
33 }
34
35 int TargetFrameLowering::getFrameIndexReference(const MachineFunction &MF,
36 int FI, unsigned &FrameReg) const {
37 const TargetRegisterInfo *RI = MF.getTarget().getRegisterInfo();
38
39 // By default, assume all frame indices are referenced via whatever
40 // getFrameRegister() says. The target can override this if it's doing
41 // something different.
42 FrameReg = RI->getFrameRegister(MF);
43 return getFrameIndexOffset(MF, FI);
44 }
2323 #include "llvm/CodeGen/MachineRegisterInfo.h"
2424 #include "llvm/CodeGen/ScoreboardHazardRecognizer.h"
2525 #include "llvm/CodeGen/PseudoSourceValue.h"
26 #include "llvm/MC/MCInstrItineraries.h"
2627 #include "llvm/Support/CommandLine.h"
2728 #include "llvm/Support/Debug.h"
2829 #include "llvm/Support/ErrorHandling.h"
509510 return (ScheduleHazardRecognizer *)
510511 new ScoreboardHazardRecognizer(II, DAG, "post-RA-sched");
511512 }
513
514 int
515 TargetInstrInfo::getOperandLatency(const InstrItineraryData *ItinData,
516 SDNode *DefNode, unsigned DefIdx,
517 SDNode *UseNode, unsigned UseIdx) const {
518 if (!ItinData || ItinData->isEmpty())
519 return -1;
520
521 if (!DefNode->isMachineOpcode())
522 return -1;
523
524 unsigned DefClass = get(DefNode->getMachineOpcode()).getSchedClass();
525 if (!UseNode->isMachineOpcode())
526 return ItinData->getOperandCycle(DefClass, DefIdx);
527 unsigned UseClass = get(UseNode->getMachineOpcode()).getSchedClass();
528 return ItinData->getOperandLatency(DefClass, DefIdx, UseClass, UseIdx);
529 }
530
531 int TargetInstrInfo::getInstrLatency(const InstrItineraryData *ItinData,
532 SDNode *N) const {
533 if (!ItinData || ItinData->isEmpty())
534 return 1;
535
536 if (!N->isMachineOpcode())
537 return 1;
538
539 return ItinData->getStageLatency(get(N->getMachineOpcode()).getSchedClass());
540 }
541
0 //===-- TargetOptionsImpl.cpp - Options that apply to all targets ----------==//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the methods in the TargetOptions.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "llvm/CodeGen/MachineFunction.h"
14 #include "llvm/CodeGen/MachineFrameInfo.h"
15 #include "llvm/Target/TargetOptions.h"
16 using namespace llvm;
17
18 /// DisableFramePointerElim - This returns true if frame pointer elimination
19 /// optimization should be disabled for the given machine function.
20 bool TargetOptions::DisableFramePointerElim(const MachineFunction &MF) const {
21 // Check to see if we should eliminate non-leaf frame pointers and then
22 // check to see if we should eliminate all frame pointers.
23 if (NoFramePointerElimNonLeaf && !NoFramePointerElim) {
24 const MachineFrameInfo *MFI = MF.getFrameInfo();
25 return MFI->hasCalls();
26 }
27
28 return NoFramePointerElim;
29 }
30
31 /// LessPreciseFPMAD - This flag return true when -enable-fp-mad option
32 /// is specified on the command line. When this flag is off(default), the
33 /// code generator is not allowed to generate mad (multiply add) if the
34 /// result is "less precise" than doing those operations individually.
35 bool TargetOptions::LessPreciseFPMAD() const {
36 return UnsafeFPMath || LessPreciseFPMADOption;
37 }
38
39 /// HonorSignDependentRoundingFPMath - Return true if the codegen must assume
40 /// that the rounding mode of the FPU can change from its default.
41 bool TargetOptions::HonorSignDependentRoundingFPMath() const {
42 return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption;
43 }
44
45 /// getTrapFunctionName - If this returns a non-empty string, this means isel
46 /// should lower Intrinsic::trap to a call to the specified function name
47 /// instead of an ISD::TRAP node.
48 StringRef TargetOptions::getTrapFunctionName() const {
49 return TrapFuncName;
50 }
51
22 Target.cpp
33 TargetData.cpp
44 TargetELFWriterInfo.cpp
5 TargetFrameLowering.cpp
65 TargetInstrInfo.cpp
76 TargetIntrinsicInfo.cpp
87 TargetLibraryInfo.cpp
98 TargetLoweringObjectFile.cpp
109 TargetMachine.cpp
11 TargetOptions.cpp
1210 TargetRegisterInfo.cpp
1311 TargetSubtargetInfo.cpp
1412 )
+0
-45
lib/Target/TargetFrameLowering.cpp less more
None //===----- TargetFrameLowering.cpp - Implement target frame interface ------==//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Implements the layout of a stack frame on the target machine.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "llvm/CodeGen/MachineFrameInfo.h"
14 #include "llvm/CodeGen/MachineFunction.h"
15 #include "llvm/Target/TargetFrameLowering.h"
16 #include "llvm/Target/TargetMachine.h"
17 #include "llvm/Target/TargetRegisterInfo.h"
18
19 #include
20 using namespace llvm;
21
22 TargetFrameLowering::~TargetFrameLowering() {
23 }
24
25 /// getFrameIndexOffset - Returns the displacement from the frame register to
26 /// the stack frame of the specified index. This is the default implementation
27 /// which is overridden for some targets.
28 int TargetFrameLowering::getFrameIndexOffset(const MachineFunction &MF,
29 int FI) const {
30 const MachineFrameInfo *MFI = MF.getFrameInfo();
31 return MFI->getObjectOffset(FI) + MFI->getStackSize() -
32 getOffsetOfLocalArea() + MFI->getOffsetAdjustment();
33 }
34
35 int TargetFrameLowering::getFrameIndexReference(const MachineFunction &MF,
36 int FI, unsigned &FrameReg) const {
37 const TargetRegisterInfo *RI = MF.getTarget().getRegisterInfo();
38
39 // By default, assume all frame indices are referenced via whatever
40 // getFrameRegister() says. The target can override this if it's doing
41 // something different.
42 FrameReg = RI->getFrameRegister(MF);
43 return getFrameIndexOffset(MF, FI);
44 }
1212
1313 #include "llvm/Target/TargetInstrInfo.h"
1414 #include "llvm/Target/TargetRegisterInfo.h"
15 #include "llvm/CodeGen/SelectionDAGNodes.h"
1615 #include "llvm/MC/MCAsmInfo.h"
1716 #include "llvm/MC/MCInstrItineraries.h"
1817 #include "llvm/Support/ErrorHandling.h"
7271 return ItinData->getOperandLatency(DefClass, DefIdx, UseClass, UseIdx);
7372 }
7473
75 int
76 TargetInstrInfo::getOperandLatency(const InstrItineraryData *ItinData,
77 SDNode *DefNode, unsigned DefIdx,
78 SDNode *UseNode, unsigned UseIdx) const {
79 if (!ItinData || ItinData->isEmpty())
80 return -1;
81
82 if (!DefNode->isMachineOpcode())
83 return -1;
84
85 unsigned DefClass = get(DefNode->getMachineOpcode()).getSchedClass();
86 if (!UseNode->isMachineOpcode())
87 return ItinData->getOperandCycle(DefClass, DefIdx);
88 unsigned UseClass = get(UseNode->getMachineOpcode()).getSchedClass();
89 return ItinData->getOperandLatency(DefClass, DefIdx, UseClass, UseIdx);
90 }
91
9274 int TargetInstrInfo::getInstrLatency(const InstrItineraryData *ItinData,
9375 const MachineInstr *MI,
9476 unsigned *PredCost) const {
9678 return 1;
9779
9880 return ItinData->getStageLatency(MI->getDesc().getSchedClass());
99 }
100
101 int TargetInstrInfo::getInstrLatency(const InstrItineraryData *ItinData,
102 SDNode *N) const {
103 if (!ItinData || ItinData->isEmpty())
104 return 1;
105
106 if (!N->isMachineOpcode())
107 return 1;
108
109 return ItinData->getStageLatency(get(N->getMachineOpcode()).getSchedClass());
11081 }
11182
11283 bool TargetInstrInfo::hasLowDefLatency(const InstrItineraryData *ItinData,
+0
-52
lib/Target/TargetOptions.cpp less more
None //===-- TargetOptions.cpp - Options that apply to all targets --------------==//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the methods in the TargetOptions.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "llvm/CodeGen/MachineFunction.h"
14 #include "llvm/CodeGen/MachineFrameInfo.h"
15 #include "llvm/Target/TargetOptions.h"
16 using namespace llvm;
17
18 /// DisableFramePointerElim - This returns true if frame pointer elimination
19 /// optimization should be disabled for the given machine function.
20 bool TargetOptions::DisableFramePointerElim(const MachineFunction &MF) const {
21 // Check to see if we should eliminate non-leaf frame pointers and then
22 // check to see if we should eliminate all frame pointers.
23 if (NoFramePointerElimNonLeaf && !NoFramePointerElim) {
24 const MachineFrameInfo *MFI = MF.getFrameInfo();
25 return MFI->hasCalls();
26 }
27
28 return NoFramePointerElim;
29 }
30
31 /// LessPreciseFPMAD - This flag return true when -enable-fp-mad option
32 /// is specified on the command line. When this flag is off(default), the
33 /// code generator is not allowed to generate mad (multiply add) if the
34 /// result is "less precise" than doing those operations individually.
35 bool TargetOptions::LessPreciseFPMAD() const {
36 return UnsafeFPMath || LessPreciseFPMADOption;
37 }
38
39 /// HonorSignDependentRoundingFPMath - Return true if the codegen must assume
40 /// that the rounding mode of the FPU can change from its default.
41 bool TargetOptions::HonorSignDependentRoundingFPMath() const {
42 return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption;
43 }
44
45 /// getTrapFunctionName - If this returns a non-empty string, this means isel
46 /// should lower Intrinsic::trap to a call to the specified function name
47 /// instead of an ISD::TRAP node.
48 StringRef TargetOptions::getTrapFunctionName() const {
49 return TrapFuncName;
50 }
51