Vikram S. Adve | a21cf20 | 2001-07-21 12:42:19 +0000 | [diff] [blame] | 1 | // $Id$ |
| 2 | //*************************************************************************** |
| 3 | // File: |
| 4 | // Sparc.cpp |
| 5 | // |
| 6 | // Purpose: |
| 7 | // |
| 8 | // History: |
| 9 | // 7/15/01 - Vikram Adve - Created |
| 10 | //**************************************************************************/ |
| 11 | |
Chris Lattner | 7e583cf | 2001-07-21 20:58:30 +0000 | [diff] [blame] | 12 | #include "llvm/CodeGen/Sparc.h" |
Vikram S. Adve | a21cf20 | 2001-07-21 12:42:19 +0000 | [diff] [blame] | 13 | |
Vikram S. Adve | a21cf20 | 2001-07-21 12:42:19 +0000 | [diff] [blame] | 14 | //************************ Class Implementations **************************/ |
| 15 | |
| 16 | |
Vikram S. Adve | 24084be | 2001-08-28 23:10:41 +0000 | [diff] [blame] | 17 | //--------------------------------------------------------------------------- |
| 18 | // class UltraSparcInstrInfo |
| 19 | // |
| 20 | // Purpose: |
| 21 | // Information about individual instructions. |
| 22 | // Most information is stored in the SparcMachineInstrDesc array above. |
| 23 | // Other information is computed on demand, and most such functions |
| 24 | // default to member functions in base class MachineInstrInfo. |
| 25 | //--------------------------------------------------------------------------- |
| 26 | |
| 27 | /*ctor*/ |
| 28 | UltraSparcInstrInfo::UltraSparcInstrInfo() |
| 29 | : MachineInstrInfo(SparcMachineInstrDesc, |
| 30 | /*descSize = */ NUM_TOTAL_OPCODES, |
| 31 | /*numRealOpCodes = */ NUM_REAL_OPCODES) |
| 32 | { |
| 33 | } |
| 34 | |
| 35 | |
| 36 | //--------------------------------------------------------------------------- |
| 37 | // class UltraSparcSchedInfo |
| 38 | // |
| 39 | // Purpose: |
| 40 | // Scheduling information for the UltraSPARC. |
| 41 | // Primarily just initializes machine-dependent parameters in |
| 42 | // class MachineSchedInfo. |
| 43 | //--------------------------------------------------------------------------- |
| 44 | |
| 45 | /*ctor*/ |
| 46 | UltraSparcSchedInfo::UltraSparcSchedInfo(const MachineInstrInfo* mii) |
| 47 | : MachineSchedInfo((unsigned int) SPARC_NUM_SCHED_CLASSES, |
| 48 | mii, |
| 49 | SparcRUsageDesc, |
| 50 | SparcInstrUsageDeltas, |
| 51 | SparcInstrIssueDeltas, |
| 52 | sizeof(SparcInstrUsageDeltas)/sizeof(InstrRUsageDelta), |
| 53 | sizeof(SparcInstrIssueDeltas)/sizeof(InstrIssueDelta)) |
| 54 | { |
| 55 | maxNumIssueTotal = 4; |
| 56 | longestIssueConflict = 0; // computed from issuesGaps[] |
| 57 | |
| 58 | branchMispredictPenalty = 4; // 4 for SPARC IIi |
| 59 | branchTargetUnknownPenalty = 2; // 2 for SPARC IIi |
| 60 | l1DCacheMissPenalty = 8; // 7 or 9 for SPARC IIi |
| 61 | l1ICacheMissPenalty = 8; // ? for SPARC IIi |
| 62 | |
| 63 | inOrderLoads = true; // true for SPARC IIi |
| 64 | inOrderIssue = true; // true for SPARC IIi |
| 65 | inOrderExec = false; // false for most architectures |
| 66 | inOrderRetire= true; // true for most architectures |
| 67 | |
| 68 | // must be called after above parameters are initialized. |
| 69 | this->initializeResources(); |
| 70 | } |
| 71 | |
| 72 | void |
| 73 | UltraSparcSchedInfo::initializeResources() |
| 74 | { |
| 75 | // Compute MachineSchedInfo::instrRUsages and MachineSchedInfo::issueGaps |
| 76 | MachineSchedInfo::initializeResources(); |
| 77 | |
| 78 | // Machine-dependent fixups go here. None for now. |
| 79 | } |
| 80 | |
Vikram S. Adve | 3c3b713 | 2001-07-28 04:19:10 +0000 | [diff] [blame] | 81 | |
Vikram S. Adve | a21cf20 | 2001-07-21 12:42:19 +0000 | [diff] [blame] | 82 | //--------------------------------------------------------------------------- |
| 83 | // class UltraSparcMachine |
| 84 | // |
| 85 | // Purpose: |
Vikram S. Adve | 3c3b713 | 2001-07-28 04:19:10 +0000 | [diff] [blame] | 86 | // Primary interface to machine description for the UltraSPARC. |
| 87 | // Primarily just initializes machine-dependent parameters in |
| 88 | // class TargetMachine, and creates machine-dependent subclasses |
| 89 | // for classes such as MachineInstrInfo. |
Vikram S. Adve | a21cf20 | 2001-07-21 12:42:19 +0000 | [diff] [blame] | 90 | // |
| 91 | //--------------------------------------------------------------------------- |
| 92 | |
| 93 | UltraSparc::UltraSparc() |
Vikram S. Adve | 24084be | 2001-08-28 23:10:41 +0000 | [diff] [blame] | 94 | : TargetMachine("UltraSparc-Native") |
| 95 | { |
| 96 | machineInstrInfo = new UltraSparcInstrInfo; |
| 97 | machineSchedInfo = new UltraSparcSchedInfo(machineInstrInfo); |
| 98 | |
Vikram S. Adve | a21cf20 | 2001-07-21 12:42:19 +0000 | [diff] [blame] | 99 | optSizeForSubWordData = 4; |
Vikram S. Adve | a21cf20 | 2001-07-21 12:42:19 +0000 | [diff] [blame] | 100 | minMemOpWordSize = 8; |
| 101 | maxAtomicMemOpWordSize = 8; |
Vikram S. Adve | a21cf20 | 2001-07-21 12:42:19 +0000 | [diff] [blame] | 102 | zeroRegNum = 0; // %g0 always gives 0 on Sparc |
| 103 | } |
| 104 | |
Vikram S. Adve | 24084be | 2001-08-28 23:10:41 +0000 | [diff] [blame] | 105 | UltraSparc::~UltraSparc() |
| 106 | { |
| 107 | delete (UltraSparcInstrInfo*) machineInstrInfo; |
| 108 | delete (UltraSparcSchedInfo*) machineSchedInfo; |
Vikram S. Adve | 3c3b713 | 2001-07-28 04:19:10 +0000 | [diff] [blame] | 109 | } |
| 110 | |
Vikram S. Adve | a21cf20 | 2001-07-21 12:42:19 +0000 | [diff] [blame] | 111 | //**************************************************************************/ |