blob: 5539aa4f34701e1833fc043d08ffbd9d5faf1dde [file] [log] [blame]
Chris Lattner035dfbe2002-08-09 20:08:06 +00001//===-- SparcInternals.h ----------------------------------------*- C++ -*-===//
Vikram S. Adve7f37fe52001-11-08 04:55:13 +00002//
Chris Lattner035dfbe2002-08-09 20:08:06 +00003// This file defines stuff that is to be private to the Sparc backend, but is
4// shared among different portions of the backend.
5//
6//===----------------------------------------------------------------------===//
Chris Lattnerc6495ee2001-09-14 03:56:45 +00007
8#ifndef SPARC_INTERNALS_H
9#define SPARC_INTERNALS_H
10
Misha Brukmane9d88382003-05-24 00:09:50 +000011#include "llvm/CodeGen/MachineInstrBuilder.h"
Ruchira Sasanka89fb46b2001-09-18 22:52:44 +000012#include "llvm/Target/TargetMachine.h"
Chris Lattnerd0f166a2002-12-29 03:13:05 +000013#include "llvm/Target/TargetSchedInfo.h"
Chris Lattner8bd66e62002-12-28 21:00:25 +000014#include "llvm/Target/TargetFrameInfo.h"
Chris Lattnerdde12622002-12-29 02:50:33 +000015#include "llvm/Target/TargetCacheInfo.h"
Chris Lattnerd0f166a2002-12-29 03:13:05 +000016#include "llvm/Target/TargetRegInfo.h"
Chris Lattnerdde12622002-12-29 02:50:33 +000017#include "llvm/Target/TargetOptInfo.h"
Chris Lattnerc6495ee2001-09-14 03:56:45 +000018#include "llvm/Type.h"
Misha Brukmane9d88382003-05-24 00:09:50 +000019#include "SparcRegClassInfo.h"
John Criswell7a73b802003-06-30 21:59:07 +000020#include "Config/sys/types.h"
Chris Lattnerc6495ee2001-09-14 03:56:45 +000021
Chris Lattner4387e312002-02-03 23:42:19 +000022class LiveRange;
Chris Lattnerf6e0e282001-09-14 04:32:55 +000023class UltraSparc;
Chris Lattner4387e312002-02-03 23:42:19 +000024class PhyRegAlloc;
Chris Lattner9aa697b2002-04-09 05:16:36 +000025class Pass;
Chris Lattner4387e312002-02-03 23:42:19 +000026
Chris Lattnerc6495ee2001-09-14 03:56:45 +000027enum SparcInstrSchedClass {
28 SPARC_NONE, /* Instructions with no scheduling restrictions */
29 SPARC_IEUN, /* Integer class that can use IEU0 or IEU1 */
30 SPARC_IEU0, /* Integer class IEU0 */
31 SPARC_IEU1, /* Integer class IEU1 */
32 SPARC_FPM, /* FP Multiply or Divide instructions */
33 SPARC_FPA, /* All other FP instructions */
34 SPARC_CTI, /* Control-transfer instructions */
35 SPARC_LD, /* Load instructions */
36 SPARC_ST, /* Store instructions */
37 SPARC_SINGLE, /* Instructions that must issue by themselves */
38
39 SPARC_INV, /* This should stay at the end for the next value */
40 SPARC_NUM_SCHED_CLASSES = SPARC_INV
41};
42
Chris Lattnerc6495ee2001-09-14 03:56:45 +000043
44//---------------------------------------------------------------------------
45// enum SparcMachineOpCode.
Chris Lattner3501fea2003-01-14 22:00:31 +000046// const TargetInstrDescriptor SparcMachineInstrDesc[]
Chris Lattnerc6495ee2001-09-14 03:56:45 +000047//
48// Purpose:
49// Description of UltraSparc machine instructions.
50//
51//---------------------------------------------------------------------------
52
Misha Brukmana98cd452003-05-20 20:32:24 +000053namespace V9 {
54 enum SparcMachineOpCode {
Chris Lattner9a3d63b2001-09-19 15:56:23 +000055#define I(ENUM, OPCODESTRING, NUMOPERANDS, RESULTPOS, MAXIMM, IMMSE, \
56 NUMDELAYSLOTS, LATENCY, SCHEDCLASS, INSTFLAGS) \
57 ENUM,
58#include "SparcInstr.def"
Chris Lattnerc6495ee2001-09-14 03:56:45 +000059
Misha Brukmana98cd452003-05-20 20:32:24 +000060 // End-of-array marker
61 INVALID_OPCODE,
62 NUM_REAL_OPCODES = PHI, // number of valid opcodes
63 NUM_TOTAL_OPCODES = INVALID_OPCODE
64 };
65}
Chris Lattnerc6495ee2001-09-14 03:56:45 +000066
Chris Lattnerc6495ee2001-09-14 03:56:45 +000067
Chris Lattner9a3d63b2001-09-19 15:56:23 +000068// Array of machine instruction descriptions...
Chris Lattner3501fea2003-01-14 22:00:31 +000069extern const TargetInstrDescriptor SparcMachineInstrDesc[];
Chris Lattnerc6495ee2001-09-14 03:56:45 +000070
71
72//---------------------------------------------------------------------------
73// class UltraSparcInstrInfo
74//
75// Purpose:
76// Information about individual instructions.
77// Most information is stored in the SparcMachineInstrDesc array above.
78// Other information is computed on demand, and most such functions
Chris Lattner3501fea2003-01-14 22:00:31 +000079// default to member functions in base class TargetInstrInfo.
Chris Lattnerc6495ee2001-09-14 03:56:45 +000080//---------------------------------------------------------------------------
81
Chris Lattner3501fea2003-01-14 22:00:31 +000082struct UltraSparcInstrInfo : public TargetInstrInfo {
Chris Lattner047bbaf2002-10-29 15:45:20 +000083 UltraSparcInstrInfo();
Vikram S. Adve4c5fe2d2001-11-14 18:48:36 +000084
85 //
Vikram S. Advedd558992002-03-18 03:02:42 +000086 // All immediate constants are in position 1 except the
Vikram S. Advee1f72802002-09-16 15:39:26 +000087 // store instructions and SETxx.
Vikram S. Adve4c5fe2d2001-11-14 18:48:36 +000088 //
Vikram S. Advedd558992002-03-18 03:02:42 +000089 virtual int getImmedConstantPos(MachineOpCode opCode) const {
Vikram S. Adve4c5fe2d2001-11-14 18:48:36 +000090 bool ignore;
Misha Brukmana98cd452003-05-20 20:32:24 +000091 if (this->maxImmedConstant(opCode, ignore) != 0) {
92 // 1st store opcode
Misha Brukman3c4cf152003-05-27 22:44:44 +000093 assert(! this->isStore((MachineOpCode) V9::STBr - 1));
Misha Brukmana98cd452003-05-20 20:32:24 +000094 // last store opcode
Misha Brukman3c4cf152003-05-27 22:44:44 +000095 assert(! this->isStore((MachineOpCode) V9::STXFSRi + 1));
Misha Brukmana98cd452003-05-20 20:32:24 +000096
97 if (opCode == V9::SETSW || opCode == V9::SETUW ||
98 opCode == V9::SETX || opCode == V9::SETHI)
99 return 0;
Misha Brukman3c4cf152003-05-27 22:44:44 +0000100 if (opCode >= V9::STBr && opCode <= V9::STXFSRi)
Misha Brukmana98cd452003-05-20 20:32:24 +0000101 return 2;
102 return 1;
103 }
Vikram S. Adve4c5fe2d2001-11-14 18:48:36 +0000104 else
105 return -1;
106 }
Misha Brukmane9d88382003-05-24 00:09:50 +0000107
108 /// createNOPinstr - returns the target's implementation of NOP, which is
109 /// usually a pseudo-instruction, implemented by a degenerate version of
Misha Brukman79caf1f2003-05-27 22:01:10 +0000110 /// another instruction, e.g. X86: xchg ax, ax; SparcV9: sethi 0, g0
Misha Brukmane9d88382003-05-24 00:09:50 +0000111 ///
112 MachineInstr* createNOPinstr() const {
Misha Brukman79caf1f2003-05-27 22:01:10 +0000113 return BuildMI(V9::SETHI, 2).addZImm(0).addReg(SparcIntRegClass::g0);
Misha Brukmane9d88382003-05-24 00:09:50 +0000114 }
115
Misha Brukman12745c52003-05-24 01:08:43 +0000116 /// isNOPinstr - not having a special NOP opcode, we need to know if a given
117 /// instruction is interpreted as an `official' NOP instr, i.e., there may be
118 /// more than one way to `do nothing' but only one canonical way to slack off.
Misha Brukmane9d88382003-05-24 00:09:50 +0000119 ///
120 bool isNOPinstr(const MachineInstr &MI) const {
121 // Make sure the instruction is EXACTLY `sethi g0, 0'
122 if (MI.getOpcode() == V9::SETHI && MI.getNumOperands() == 2) {
123 const MachineOperand &op0 = MI.getOperand(0), &op1 = MI.getOperand(1);
Misha Brukman79caf1f2003-05-27 22:01:10 +0000124 if (op0.isImmediate() && op0.getImmedValue() == 0 &&
125 op1.isMachineRegister() &&
126 op1.getMachineRegNum() == SparcIntRegClass::g0)
Misha Brukmane9d88382003-05-24 00:09:50 +0000127 {
128 return true;
129 }
130 }
131 return false;
132 }
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000133
Misha Brukmana98cd452003-05-20 20:32:24 +0000134 virtual bool hasResultInterlock(MachineOpCode opCode) const
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000135 {
136 // All UltraSPARC instructions have interlocks (note that delay slots
137 // are not considered here).
138 // However, instructions that use the result of an FCMP produce a
139 // 9-cycle stall if they are issued less than 3 cycles after the FCMP.
140 // Force the compiler to insert a software interlock (i.e., gap of
141 // 2 other groups, including NOPs if necessary).
Misha Brukmana98cd452003-05-20 20:32:24 +0000142 return (opCode == V9::FCMPS || opCode == V9::FCMPD || opCode == V9::FCMPQ);
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000143 }
144
Vikram S. Adve5684c4e2001-10-18 00:02:06 +0000145 //-------------------------------------------------------------------------
Vikram S. Advee1f72802002-09-16 15:39:26 +0000146 // Queries about representation of LLVM quantities (e.g., constants)
147 //-------------------------------------------------------------------------
148
149 virtual bool ConstantMayNotFitInImmedField(const Constant* CV,
150 const Instruction* I) const;
151
152 //-------------------------------------------------------------------------
Vikram S. Adve5684c4e2001-10-18 00:02:06 +0000153 // Code generation support for creating individual machine instructions
154 //-------------------------------------------------------------------------
Vikram S. Adved55697c2002-09-20 00:52:09 +0000155
156 // Get certain common op codes for the current target. This and all the
157 // Create* methods below should be moved to a machine code generation class
158 //
Misha Brukmana98cd452003-05-20 20:32:24 +0000159 virtual MachineOpCode getNOPOpCode() const { return V9::NOP; }
Vikram S. Adved55697c2002-09-20 00:52:09 +0000160
Vikram S. Adve5684c4e2001-10-18 00:02:06 +0000161 // Create an instruction sequence to put the constant `val' into
Vikram S. Adve242a8082002-05-19 15:25:51 +0000162 // the virtual register `dest'. `val' may be a Constant or a
163 // GlobalValue, viz., the constant address of a global variable or function.
164 // The generated instructions are returned in `mvec'.
165 // Any temp. registers (TmpInstruction) created are recorded in mcfi.
166 // Any stack space required is allocated via mcff.
Vikram S. Adve5684c4e2001-10-18 00:02:06 +0000167 //
Vikram S. Adve242a8082002-05-19 15:25:51 +0000168 virtual void CreateCodeToLoadConst(const TargetMachine& target,
169 Function* F,
Vikram S. Advedd558992002-03-18 03:02:42 +0000170 Value* val,
Vikram S. Adve5684c4e2001-10-18 00:02:06 +0000171 Instruction* dest,
Vikram S. Adve242a8082002-05-19 15:25:51 +0000172 std::vector<MachineInstr*>& mvec,
173 MachineCodeForInstruction& mcfi) const;
Vikram S. Adve7f37fe52001-11-08 04:55:13 +0000174
Vikram S. Adve5afff3b2001-11-09 02:15:52 +0000175 // Create an instruction sequence to copy an integer value `val'
176 // to a floating point value `dest' by copying to memory and back.
177 // val must be an integral type. dest must be a Float or Double.
Vikram S. Adve242a8082002-05-19 15:25:51 +0000178 // The generated instructions are returned in `mvec'.
179 // Any temp. registers (TmpInstruction) created are recorded in mcfi.
180 // Any stack space required is allocated via mcff.
Vikram S. Adve7f37fe52001-11-08 04:55:13 +0000181 //
Vikram S. Adve242a8082002-05-19 15:25:51 +0000182 virtual void CreateCodeToCopyIntToFloat(const TargetMachine& target,
183 Function* F,
184 Value* val,
185 Instruction* dest,
186 std::vector<MachineInstr*>& mvec,
187 MachineCodeForInstruction& mcfi) const;
Vikram S. Adve5afff3b2001-11-09 02:15:52 +0000188
189 // Similarly, create an instruction sequence to copy an FP value
190 // `val' to an integer value `dest' by copying to memory and back.
Vikram S. Adve242a8082002-05-19 15:25:51 +0000191 // The generated instructions are returned in `mvec'.
192 // Any temp. registers (TmpInstruction) created are recorded in mcfi.
193 // Any stack space required is allocated via mcff.
Vikram S. Adve5afff3b2001-11-09 02:15:52 +0000194 //
Vikram S. Adve242a8082002-05-19 15:25:51 +0000195 virtual void CreateCodeToCopyFloatToInt(const TargetMachine& target,
196 Function* F,
197 Value* val,
198 Instruction* dest,
199 std::vector<MachineInstr*>& mvec,
200 MachineCodeForInstruction& mcfi) const;
201
202 // Create instruction(s) to copy src to dest, for arbitrary types
203 // The generated instructions are returned in `mvec'.
204 // Any temp. registers (TmpInstruction) created are recorded in mcfi.
205 // Any stack space required is allocated via mcff.
206 //
Vikram S. Advedd558992002-03-18 03:02:42 +0000207 virtual void CreateCopyInstructionsByType(const TargetMachine& target,
Vikram S. Adve242a8082002-05-19 15:25:51 +0000208 Function* F,
209 Value* src,
210 Instruction* dest,
211 std::vector<MachineInstr*>& mvec,
212 MachineCodeForInstruction& mcfi) const;
213
214 // Create instruction sequence to produce a sign-extended register value
215 // from an arbitrary sized value (sized in bits, not bytes).
Vikram S. Advef36f06b2002-09-05 18:34:31 +0000216 // The generated instructions are appended to `mvec'.
217 // Any temp. registers (TmpInstruction) created are recorded in mcfi.
Vikram S. Adve242a8082002-05-19 15:25:51 +0000218 // Any stack space required is allocated via mcff.
219 //
220 virtual void CreateSignExtensionInstructions(const TargetMachine& target,
221 Function* F,
Vikram S. Advef36f06b2002-09-05 18:34:31 +0000222 Value* srcVal,
Vikram S. Adve5cedede2002-09-27 14:29:45 +0000223 Value* destVal,
224 unsigned int numLowBits,
Vikram S. Advef36f06b2002-09-05 18:34:31 +0000225 std::vector<MachineInstr*>& mvec,
226 MachineCodeForInstruction& mcfi) const;
227
228 // Create instruction sequence to produce a zero-extended register value
229 // from an arbitrary sized value (sized in bits, not bytes).
230 // The generated instructions are appended to `mvec'.
231 // Any temp. registers (TmpInstruction) created are recorded in mcfi.
232 // Any stack space required is allocated via mcff.
233 //
234 virtual void CreateZeroExtensionInstructions(const TargetMachine& target,
235 Function* F,
236 Value* srcVal,
Vikram S. Adve5cedede2002-09-27 14:29:45 +0000237 Value* destVal,
238 unsigned int numLowBits,
Vikram S. Adve242a8082002-05-19 15:25:51 +0000239 std::vector<MachineInstr*>& mvec,
240 MachineCodeForInstruction& mcfi) const;
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000241};
242
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000243
Ruchira Sasanka20c82b12001-10-28 18:15:12 +0000244//----------------------------------------------------------------------------
245// class UltraSparcRegInfo
246//
Chris Lattnerd0f166a2002-12-29 03:13:05 +0000247// This class implements the virtual class TargetRegInfo for Sparc.
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000248//
Ruchira Sasanka20c82b12001-10-28 18:15:12 +0000249//----------------------------------------------------------------------------
250
Chris Lattnerd0f166a2002-12-29 03:13:05 +0000251class UltraSparcRegInfo : public TargetRegInfo {
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000252
Vikram S. Adve46d3f8e2003-07-06 19:53:59 +0000253private:
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000254
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000255 // Number of registers used for passing int args (usually 6: %o0 - %o5)
256 //
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000257 unsigned const NumOfIntArgRegs;
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000258
259 // Number of registers used for passing float args (usually 32: %f0 - %f31)
260 //
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000261 unsigned const NumOfFloatArgRegs;
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000262
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000263 // ======================== Private Methods =============================
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000264
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000265 // The following methods are used to color special live ranges (e.g.
Chris Lattnerf57b8452002-04-27 06:56:12 +0000266 // function args and return values etc.) with specific hardware registers
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000267 // as required. See SparcRegInfo.cpp for the implementation.
268 //
Vikram S. Advefe09fb22002-07-08 23:34:10 +0000269 void suggestReg4RetAddr(MachineInstr *RetMI,
Chris Lattner699683c2002-02-04 05:59:25 +0000270 LiveRangeInfo &LRI) const;
Ruchira Sasankacc3ccac2001-10-15 16:25:28 +0000271
Vikram S. Adve106604e2002-09-28 16:56:59 +0000272 void suggestReg4CallAddr(MachineInstr *CallMI, LiveRangeInfo &LRI) const;
Vikram S. Advefe09fb22002-07-08 23:34:10 +0000273
274 void InitializeOutgoingArg(MachineInstr* CallMI, AddedInstrns *CallAI,
Vikram S. Adve242a8082002-05-19 15:25:51 +0000275 PhyRegAlloc &PRA, LiveRange* LR,
276 unsigned regType, unsigned RegClassID,
277 int UniArgReg, unsigned int argNo,
278 std::vector<MachineInstr *>& AddedInstrnsBefore)
279 const;
Vikram S. Adved0d06ad2003-05-31 07:32:01 +0000280
281 // Helper used by the all the getRegType() functions.
Vikram S. Adve78a4f232003-05-27 00:02:22 +0000282 int getRegTypeForClassAndType(unsigned regClassID, const Type* type) const;
Ruchira Sasanka3839e6e2001-11-03 19:59:59 +0000283
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000284 // Used to generate a copy instruction based on the register class of
285 // value.
286 //
Chris Lattner699683c2002-02-04 05:59:25 +0000287 MachineInstr *cpValue2RegMI(Value *Val, unsigned DestReg,
288 int RegType) const;
Ruchira Sasankaae4bcd72001-11-10 21:20:43 +0000289
290
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000291 // The following 2 methods are used to order the instructions addeed by
Chris Lattnerf57b8452002-04-27 06:56:12 +0000292 // the register allocator in association with function calling. See
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000293 // SparcRegInfo.cpp for more details
294 //
Chris Lattner697954c2002-01-20 22:54:45 +0000295 void moveInst2OrdVec(std::vector<MachineInstr *> &OrdVec,
296 MachineInstr *UnordInst,
297 PhyRegAlloc &PRA) const;
Ruchira Sasankaae4bcd72001-11-10 21:20:43 +0000298
Chris Lattner697954c2002-01-20 22:54:45 +0000299 void OrderAddedInstrns(std::vector<MachineInstr *> &UnordVec,
300 std::vector<MachineInstr *> &OrdVec,
301 PhyRegAlloc &PRA) const;
Ruchira Sasankaae4bcd72001-11-10 21:20:43 +0000302
Chris Lattner699683c2002-02-04 05:59:25 +0000303public:
Misha Brukmand3d97be2003-05-30 20:12:42 +0000304 // Type of registers available in Sparc. There can be several reg types
305 // in the same class. For instace, the float reg class has Single/Double
306 // types
307 //
308 enum RegTypes {
309 IntRegType,
310 FPSingleRegType,
311 FPDoubleRegType,
312 IntCCRegType,
313 FloatCCRegType,
314 SpecialRegType
315 };
316
Misha Brukmande11f2d2003-07-07 16:52:39 +0000317 // The actual register classes in the Sparc
318 //
319 // **** WARNING: If this enum order is changed, also modify
320 // getRegisterClassOfValue method below since it assumes this particular
321 // order for efficiency.
322 //
323 enum RegClassIDs {
324 IntRegClassID, // Integer
325 FloatRegClassID, // Float (both single/double)
326 IntCCRegClassID, // Int Condition Code
327 FloatCCRegClassID, // Float Condition code
328 SpecialRegClassID // Special (unallocated) registers
329 };
330
Chris Lattner699683c2002-02-04 05:59:25 +0000331 UltraSparcRegInfo(const UltraSparc &tgt);
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000332
Vikram S. Advedd558992002-03-18 03:02:42 +0000333 // To find the register class used for a specified Type
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000334 //
Vikram S. Advefe09fb22002-07-08 23:34:10 +0000335 unsigned getRegClassIDOfType(const Type *type,
336 bool isCCReg = false) const;
Ruchira Sasankae38bd5332001-09-15 00:30:44 +0000337
Vikram S. Advefe09fb22002-07-08 23:34:10 +0000338 // To find the register class to which a specified register belongs
339 //
Vikram S. Advefe09fb22002-07-08 23:34:10 +0000340 unsigned getRegClassIDOfRegType(int regType) const;
Vikram S. Advedd558992002-03-18 03:02:42 +0000341
Chris Lattner699683c2002-02-04 05:59:25 +0000342 // getZeroRegNum - returns the register that contains always zero this is the
343 // unified register number
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000344 //
Chris Lattner699683c2002-02-04 05:59:25 +0000345 virtual int getZeroRegNum() const;
Ruchira Sasanka89fb46b2001-09-18 22:52:44 +0000346
Chris Lattner699683c2002-02-04 05:59:25 +0000347 // getCallAddressReg - returns the reg used for pushing the address when a
Chris Lattnerf57b8452002-04-27 06:56:12 +0000348 // function is called. This can be used for other purposes between calls
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000349 //
Chris Lattner699683c2002-02-04 05:59:25 +0000350 unsigned getCallAddressReg() const;
Ruchira Sasanka89fb46b2001-09-18 22:52:44 +0000351
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000352 // Returns the register containing the return address.
353 // It should be made sure that this register contains the return
354 // value when a return instruction is reached.
355 //
Chris Lattner699683c2002-02-04 05:59:25 +0000356 unsigned getReturnAddressReg() const;
Ruchira Sasanka89fb46b2001-09-18 22:52:44 +0000357
Vikram S. Adve242a8082002-05-19 15:25:51 +0000358 // Number of registers used for passing int args (usually 6: %o0 - %o5)
359 // and float args (usually 32: %f0 - %f31)
360 //
Vikram S. Adve5b1b47b2003-05-25 15:59:47 +0000361 unsigned const getNumOfIntArgRegs() const { return NumOfIntArgRegs; }
362 unsigned const getNumOfFloatArgRegs() const { return NumOfFloatArgRegs; }
Vikram S. Adve242a8082002-05-19 15:25:51 +0000363
Vikram S. Adved0d06ad2003-05-31 07:32:01 +0000364 // Compute which register can be used for an argument, if any
365 //
366 int regNumForIntArg(bool inCallee, bool isVarArgsCall,
367 unsigned argNo, unsigned& regClassId) const;
368
369 int regNumForFPArg(unsigned RegType, bool inCallee, bool isVarArgsCall,
370 unsigned argNo, unsigned& regClassId) const;
371
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000372 // The following methods are used to color special live ranges (e.g.
Chris Lattnerf57b8452002-04-27 06:56:12 +0000373 // function args and return values etc.) with specific hardware registers
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000374 // as required. See SparcRegInfo.cpp for the implementation for Sparc.
375 //
Chris Lattnerb7653df2002-04-08 22:03:57 +0000376 void suggestRegs4MethodArgs(const Function *Meth,
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000377 LiveRangeInfo& LRI) const;
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000378
Vikram S. Advefe09fb22002-07-08 23:34:10 +0000379 void suggestRegs4CallArgs(MachineInstr *CallMI,
Vikram S. Adve106604e2002-09-28 16:56:59 +0000380 LiveRangeInfo& LRI) const;
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000381
Vikram S. Advefe09fb22002-07-08 23:34:10 +0000382 void suggestReg4RetValue(MachineInstr *RetMI,
Chris Lattner697954c2002-01-20 22:54:45 +0000383 LiveRangeInfo& LRI) const;
Vikram S. Advefe09fb22002-07-08 23:34:10 +0000384
Chris Lattnerb7653df2002-04-08 22:03:57 +0000385 void colorMethodArgs(const Function *Meth, LiveRangeInfo &LRI,
Chris Lattner699683c2002-02-04 05:59:25 +0000386 AddedInstrns *FirstAI) const;
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000387
Vikram S. Adve7dc7de52003-07-25 21:12:15 +0000388 // This method inserts the caller saving code for call instructions
389 //
390 void insertCallerSavingCode(std::vector<MachineInstr*>& instrnsBefore,
391 std::vector<MachineInstr*>& instrnsAfter,
392 MachineInstr *CallMI,
393 const BasicBlock *BB,
394 PhyRegAlloc &PRA ) const;
Ruchira Sasankaab304c42001-09-30 23:19:57 +0000395
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000396 // method used for printing a register for debugging purposes
397 //
Vikram S. Adve78a4f232003-05-27 00:02:22 +0000398 void printReg(const LiveRange *LR) const;
Vikram S. Advefe09fb22002-07-08 23:34:10 +0000399
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000400 // returns the # of bytes of stack space allocated for each register
401 // type. For Sparc, currently we allocate 8 bytes on stack for all
402 // register types. We can optimize this later if necessary to save stack
403 // space (However, should make sure that stack alignment is correct)
404 //
Chris Lattner699683c2002-02-04 05:59:25 +0000405 inline int getSpilledRegSize(int RegType) const {
Ruchira Sasankad00982a2002-01-07 19:20:28 +0000406 return 8;
Ruchira Sasankad00982a2002-01-07 19:20:28 +0000407 }
408
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000409
Vikram S. Advea44c6c02002-03-31 19:04:50 +0000410 // To obtain the return value and the indirect call address (if any)
411 // contained in a CALL machine instruction
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000412 //
Ruchira Sasankab3b6f532001-10-21 16:43:41 +0000413 const Value * getCallInstRetVal(const MachineInstr *CallMI) const;
Vikram S. Advea44c6c02002-03-31 19:04:50 +0000414 const Value * getCallInstIndirectAddrVal(const MachineInstr *CallMI) const;
Ruchira Sasankab3b6f532001-10-21 16:43:41 +0000415
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000416 // The following methods are used to generate "copy" machine instructions
417 // for an architecture.
418 //
Vikram S. Advefe09fb22002-07-08 23:34:10 +0000419 // The function regTypeNeedsScratchReg() can be used to check whether a
420 // scratch register is needed to copy a register of type `regType' to
421 // or from memory. If so, such a scratch register can be provided by
422 // the caller (e.g., if it knows which regsiters are free); otherwise
423 // an arbitrary one will be chosen and spilled by the copy instructions.
424 //
425 bool regTypeNeedsScratchReg(int RegType,
426 int& scratchRegClassId) const;
Ruchira Sasankac4d4b762001-10-16 01:23:19 +0000427
Vikram S. Advefe09fb22002-07-08 23:34:10 +0000428 void cpReg2RegMI(std::vector<MachineInstr*>& mvec,
429 unsigned SrcReg, unsigned DestReg,
430 int RegType) const;
431
432 void cpReg2MemMI(std::vector<MachineInstr*>& mvec,
433 unsigned SrcReg, unsigned DestPtrReg,
434 int Offset, int RegType, int scratchReg = -1) const;
435
436 void cpMem2RegMI(std::vector<MachineInstr*>& mvec,
437 unsigned SrcPtrReg, int Offset, unsigned DestReg,
438 int RegType, int scratchReg = -1) const;
Ruchira Sasankac4d4b762001-10-16 01:23:19 +0000439
Vikram S. Adve242a8082002-05-19 15:25:51 +0000440 void cpValue2Value(Value *Src, Value *Dest,
Anand Shuklacfb22d32002-06-25 20:55:50 +0000441 std::vector<MachineInstr*>& mvec) const;
Ruchira Sasankaef1b0cb2001-11-03 17:13:27 +0000442
Ruchira Sasanka2563a982002-01-07 20:28:49 +0000443 // To see whether a register is a volatile (i.e., whehter it must be
444 // preserved acorss calls)
445 //
Chris Lattner699683c2002-02-04 05:59:25 +0000446 inline bool isRegVolatile(int RegClassID, int Reg) const {
447 return MachineRegClassArr[RegClassID]->isRegVolatile(Reg);
Ruchira Sasankac4d4b762001-10-16 01:23:19 +0000448 }
449
Anand Shukla6da69e72003-07-20 15:39:30 +0000450 inline bool modifiedByCall(int RegClassID, int Reg) const {
451 return MachineRegClassArr[RegClassID]->modifiedByCall(Reg);
452 }
453
Vikram S. Adved0d06ad2003-05-31 07:32:01 +0000454 // Get the register type for a register identified different ways.
Vikram S. Adve7dc7de52003-07-25 21:12:15 +0000455 // Note that getRegTypeForLR(LR) != getRegTypeForDataType(LR->getType())!
456 // The reg class of a LR depends both on the Value types in it and whether
457 // they are CC registers or not (for example).
458 int getRegTypeForDataType(const Type* type) const;
459 int getRegTypeForLR(const LiveRange *LR) const;
Vikram S. Adved0d06ad2003-05-31 07:32:01 +0000460 int getRegType(int unifiedRegNum) const;
Ruchira Sasankac4d4b762001-10-16 01:23:19 +0000461
Chris Lattner699683c2002-02-04 05:59:25 +0000462 virtual unsigned getFramePointer() const;
463 virtual unsigned getStackPointer() const;
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000464};
465
466
467
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000468
469//---------------------------------------------------------------------------
470// class UltraSparcSchedInfo
471//
472// Purpose:
473// Interface to instruction scheduling information for UltraSPARC.
474// The parameter values above are based on UltraSPARC IIi.
475//---------------------------------------------------------------------------
476
477
Chris Lattnerd0f166a2002-12-29 03:13:05 +0000478class UltraSparcSchedInfo: public TargetSchedInfo {
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000479public:
Chris Lattner699683c2002-02-04 05:59:25 +0000480 UltraSparcSchedInfo(const TargetMachine &tgt);
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000481protected:
Chris Lattner699683c2002-02-04 05:59:25 +0000482 virtual void initializeResources();
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000483};
484
Chris Lattnerf6e0e282001-09-14 04:32:55 +0000485
486//---------------------------------------------------------------------------
Vikram S. Advec1521632001-10-22 13:31:53 +0000487// class UltraSparcFrameInfo
488//
489// Purpose:
490// Interface to stack frame layout info for the UltraSPARC.
Vikram S. Adve00521d72001-11-12 23:26:35 +0000491// Starting offsets for each area of the stack frame are aligned at
492// a multiple of getStackFrameSizeAlignment().
Vikram S. Advec1521632001-10-22 13:31:53 +0000493//---------------------------------------------------------------------------
494
Chris Lattnerda62ac62002-12-28 20:20:24 +0000495class UltraSparcFrameInfo: public TargetFrameInfo {
496 const TargetMachine &target;
Vikram S. Advec1521632001-10-22 13:31:53 +0000497public:
Chris Lattnerda62ac62002-12-28 20:20:24 +0000498 UltraSparcFrameInfo(const TargetMachine &TM)
499 : TargetFrameInfo(StackGrowsDown, StackFrameSizeAlignment, 0), target(TM) {}
Vikram S. Adve7f37fe52001-11-08 04:55:13 +0000500
501public:
Vikram S. Advee1f72802002-09-16 15:39:26 +0000502 // These methods provide constant parameters of the frame layout.
503 //
Chris Lattnerf57b8452002-04-27 06:56:12 +0000504 int getStackFrameSizeAlignment() const { return StackFrameSizeAlignment;}
505 int getMinStackFrameSize() const { return MinStackFrameSize; }
506 int getNumFixedOutgoingArgs() const { return NumFixedOutgoingArgs; }
507 int getSizeOfEachArgOnStack() const { return SizeOfEachArgOnStack; }
508 bool argsOnStackHaveFixedSize() const { return true; }
Vikram S. Adve7f37fe52001-11-08 04:55:13 +0000509
Vikram S. Advee1f72802002-09-16 15:39:26 +0000510 // This method adjusts a stack offset to meet alignment rules of target.
511 // The fixed OFFSET (0x7ff) must be subtracted and the result aligned.
512 virtual int adjustAlignment (int unalignedOffset,
513 bool growUp,
514 unsigned int align) const {
515 return unalignedOffset + (growUp? +1:-1)*((unalignedOffset-OFFSET) % align);
516 }
517
Vikram S. Adve7f37fe52001-11-08 04:55:13 +0000518 // These methods compute offsets using the frame contents for a
Chris Lattnerf57b8452002-04-27 06:56:12 +0000519 // particular function. The frame contents are obtained from the
520 // MachineCodeInfoForMethod object for the given function.
Vikram S. Adve7f37fe52001-11-08 04:55:13 +0000521 //
Misha Brukmanfce11432002-10-28 00:28:31 +0000522 int getFirstIncomingArgOffset (MachineFunction& mcInfo,
Vikram S. Adve6d783112002-04-25 04:40:24 +0000523 bool& growUp) const
Vikram S. Adve7f37fe52001-11-08 04:55:13 +0000524 {
Vikram S. Adve6d783112002-04-25 04:40:24 +0000525 growUp = true; // arguments area grows upwards
Vikram S. Adve7f37fe52001-11-08 04:55:13 +0000526 return FirstIncomingArgOffsetFromFP;
527 }
Misha Brukmanfce11432002-10-28 00:28:31 +0000528 int getFirstOutgoingArgOffset (MachineFunction& mcInfo,
Vikram S. Adve6d783112002-04-25 04:40:24 +0000529 bool& growUp) const
Vikram S. Adve7f37fe52001-11-08 04:55:13 +0000530 {
Vikram S. Adve6d783112002-04-25 04:40:24 +0000531 growUp = true; // arguments area grows upwards
Vikram S. Adve7f37fe52001-11-08 04:55:13 +0000532 return FirstOutgoingArgOffsetFromSP;
533 }
Misha Brukmanfce11432002-10-28 00:28:31 +0000534 int getFirstOptionalOutgoingArgOffset(MachineFunction& mcInfo,
Vikram S. Adve6d783112002-04-25 04:40:24 +0000535 bool& growUp)const
Vikram S. Adve7f37fe52001-11-08 04:55:13 +0000536 {
Vikram S. Adve6d783112002-04-25 04:40:24 +0000537 growUp = true; // arguments area grows upwards
Vikram S. Adve7f37fe52001-11-08 04:55:13 +0000538 return FirstOptionalOutgoingArgOffsetFromSP;
539 }
540
Misha Brukmanfce11432002-10-28 00:28:31 +0000541 int getFirstAutomaticVarOffset (MachineFunction& mcInfo,
Vikram S. Adve6d783112002-04-25 04:40:24 +0000542 bool& growUp) const;
Misha Brukmanfce11432002-10-28 00:28:31 +0000543 int getRegSpillAreaOffset (MachineFunction& mcInfo,
Vikram S. Adve6d783112002-04-25 04:40:24 +0000544 bool& growUp) const;
Misha Brukmanfce11432002-10-28 00:28:31 +0000545 int getTmpAreaOffset (MachineFunction& mcInfo,
Vikram S. Adve6d783112002-04-25 04:40:24 +0000546 bool& growUp) const;
Misha Brukmanfce11432002-10-28 00:28:31 +0000547 int getDynamicAreaOffset (MachineFunction& mcInfo,
Vikram S. Adve6d783112002-04-25 04:40:24 +0000548 bool& growUp) const;
Vikram S. Adve7f37fe52001-11-08 04:55:13 +0000549
550 //
551 // These methods specify the base register used for each stack area
552 // (generally FP or SP)
553 //
554 virtual int getIncomingArgBaseRegNum() const {
555 return (int) target.getRegInfo().getFramePointer();
556 }
557 virtual int getOutgoingArgBaseRegNum() const {
558 return (int) target.getRegInfo().getStackPointer();
559 }
560 virtual int getOptionalOutgoingArgBaseRegNum() const {
561 return (int) target.getRegInfo().getStackPointer();
562 }
563 virtual int getAutomaticVarBaseRegNum() const {
564 return (int) target.getRegInfo().getFramePointer();
565 }
566 virtual int getRegSpillAreaBaseRegNum() const {
567 return (int) target.getRegInfo().getFramePointer();
568 }
569 virtual int getDynamicAreaBaseRegNum() const {
570 return (int) target.getRegInfo().getStackPointer();
571 }
Chris Lattnerda62ac62002-12-28 20:20:24 +0000572
573 virtual int getIncomingArgOffset(MachineFunction& mcInfo,
574 unsigned argNum) const {
575 assert(argsOnStackHaveFixedSize());
576
577 unsigned relativeOffset = argNum * getSizeOfEachArgOnStack();
578 bool growUp; // do args grow up or down
579 int firstArg = getFirstIncomingArgOffset(mcInfo, growUp);
580 return growUp ? firstArg + relativeOffset : firstArg - relativeOffset;
581 }
582
583 virtual int getOutgoingArgOffset(MachineFunction& mcInfo,
584 unsigned argNum) const {
585 assert(argsOnStackHaveFixedSize());
586 //assert(((int) argNum - this->getNumFixedOutgoingArgs())
587 // <= (int) mcInfo.getInfo()->getMaxOptionalNumArgs());
588
589 unsigned relativeOffset = argNum * getSizeOfEachArgOnStack();
590 bool growUp; // do args grow up or down
591 int firstArg = getFirstOutgoingArgOffset(mcInfo, growUp);
592 return growUp ? firstArg + relativeOffset : firstArg - relativeOffset;
593 }
Vikram S. Adve7f37fe52001-11-08 04:55:13 +0000594
595private:
Vikram S. Advee1f72802002-09-16 15:39:26 +0000596 /*----------------------------------------------------------------------
597 This diagram shows the stack frame layout used by llc on Sparc V9.
598 Note that only the location of automatic variables, spill area,
599 temporary storage, and dynamically allocated stack area are chosen
600 by us. The rest conform to the Sparc V9 ABI.
601 All stack addresses are offset by OFFSET = 0x7ff (2047).
602
Chris Lattnerda62ac62002-12-28 20:20:24 +0000603 Alignment assumptions and other invariants:
Vikram S. Advee1f72802002-09-16 15:39:26 +0000604 (1) %sp+OFFSET and %fp+OFFSET are always aligned on 16-byte boundary
605 (2) Variables in automatic, spill, temporary, or dynamic regions
606 are aligned according to their size as in all memory accesses.
607 (3) Everything below the dynamically allocated stack area is only used
608 during a call to another function, so it is never needed when
609 the current function is active. This is why space can be allocated
610 dynamically by incrementing %sp any time within the function.
611
612 STACK FRAME LAYOUT:
613
614 ...
615 %fp+OFFSET+176 Optional extra incoming arguments# 1..N
616 %fp+OFFSET+168 Incoming argument #6
617 ... ...
618 %fp+OFFSET+128 Incoming argument #1
619 ... ...
620 ---%fp+OFFSET-0--------Bottom of caller's stack frame--------------------
621 %fp+OFFSET-8 Automatic variables <-- ****TOP OF STACK FRAME****
622 Spill area
623 Temporary storage
624 ...
625
626 %sp+OFFSET+176+8N Bottom of dynamically allocated stack area
627 %sp+OFFSET+168+8N Optional extra outgoing argument# N
628 ... ...
629 %sp+OFFSET+176 Optional extra outgoing argument# 1
630 %sp+OFFSET+168 Outgoing argument #6
631 ... ...
632 %sp+OFFSET+128 Outgoing argument #1
633 %sp+OFFSET+120 Save area for %i7
634 ... ...
635 %sp+OFFSET+0 Save area for %l0 <-- ****BOTTOM OF STACK FRAME****
636
637 *----------------------------------------------------------------------*/
638
Vikram S. Adve5afff3b2001-11-09 02:15:52 +0000639 // All stack addresses must be offset by 0x7ff (2047) on Sparc V9.
640 static const int OFFSET = (int) 0x7ff;
Vikram S. Adve7f37fe52001-11-08 04:55:13 +0000641 static const int StackFrameSizeAlignment = 16;
Vikram S. Advec1521632001-10-22 13:31:53 +0000642 static const int MinStackFrameSize = 176;
Vikram S. Adve7f37fe52001-11-08 04:55:13 +0000643 static const int NumFixedOutgoingArgs = 6;
644 static const int SizeOfEachArgOnStack = 8;
Vikram S. Adve5afff3b2001-11-09 02:15:52 +0000645 static const int FirstIncomingArgOffsetFromFP = 128 + OFFSET;
646 static const int FirstOptionalIncomingArgOffsetFromFP = 176 + OFFSET;
Vikram S. Advee1f72802002-09-16 15:39:26 +0000647 static const int StaticAreaOffsetFromFP = 0 + OFFSET;
Vikram S. Adve5afff3b2001-11-09 02:15:52 +0000648 static const int FirstOutgoingArgOffsetFromSP = 128 + OFFSET;
649 static const int FirstOptionalOutgoingArgOffsetFromSP = 176 + OFFSET;
Vikram S. Advec1521632001-10-22 13:31:53 +0000650};
651
652
Vikram S. Adve5afff3b2001-11-09 02:15:52 +0000653//---------------------------------------------------------------------------
654// class UltraSparcCacheInfo
655//
656// Purpose:
657// Interface to cache parameters for the UltraSPARC.
658// Just use defaults for now.
659//---------------------------------------------------------------------------
660
Chris Lattnerdde12622002-12-29 02:50:33 +0000661struct UltraSparcCacheInfo: public TargetCacheInfo {
662 UltraSparcCacheInfo(const TargetMachine &T) : TargetCacheInfo(T) {}
Vikram S. Adve5afff3b2001-11-09 02:15:52 +0000663};
664
Vikram S. Advec1521632001-10-22 13:31:53 +0000665
666//---------------------------------------------------------------------------
Vikram S. Adved55697c2002-09-20 00:52:09 +0000667// class UltraSparcOptInfo
668//
669// Purpose:
670// Interface to machine-level optimization routines for the UltraSPARC.
671//---------------------------------------------------------------------------
672
Chris Lattnerdde12622002-12-29 02:50:33 +0000673struct UltraSparcOptInfo: public TargetOptInfo {
674 UltraSparcOptInfo(const TargetMachine &T) : TargetOptInfo(T) {}
Vikram S. Adved55697c2002-09-20 00:52:09 +0000675
676 virtual bool IsUselessCopy (const MachineInstr* MI) const;
677};
678
Misha Brukman79caf1f2003-05-27 22:01:10 +0000679/// createAddRegNumToValuesPass - this pass adds unsigned register numbers to
680/// instructions, since that's not done by the Sparc InstSelector, but that's
681/// how the target-independent register allocator in the JIT likes to see
682/// instructions. This pass enables the usage of the JIT register allocator(s).
683Pass *createAddRegNumToValuesPass();
684
Vikram S. Adved55697c2002-09-20 00:52:09 +0000685//---------------------------------------------------------------------------
Chris Lattnerf6e0e282001-09-14 04:32:55 +0000686// class UltraSparcMachine
687//
688// Purpose:
689// Primary interface to machine description for the UltraSPARC.
690// Primarily just initializes machine-dependent parameters in
691// class TargetMachine, and creates machine-dependent subclasses
Vikram S. Adve339084b2001-09-18 13:04:24 +0000692// for classes such as InstrInfo, SchedInfo and RegInfo.
Chris Lattnerf6e0e282001-09-14 04:32:55 +0000693//---------------------------------------------------------------------------
694
695class UltraSparc : public TargetMachine {
Vikram S. Adve339084b2001-09-18 13:04:24 +0000696 UltraSparcInstrInfo instrInfo;
697 UltraSparcSchedInfo schedInfo;
698 UltraSparcRegInfo regInfo;
Vikram S. Advec1521632001-10-22 13:31:53 +0000699 UltraSparcFrameInfo frameInfo;
Vikram S. Adve5afff3b2001-11-09 02:15:52 +0000700 UltraSparcCacheInfo cacheInfo;
Vikram S. Adved55697c2002-09-20 00:52:09 +0000701 UltraSparcOptInfo optInfo;
Chris Lattnerf6e0e282001-09-14 04:32:55 +0000702public:
703 UltraSparc();
Vikram S. Adved55697c2002-09-20 00:52:09 +0000704
Chris Lattner3501fea2003-01-14 22:00:31 +0000705 virtual const TargetInstrInfo &getInstrInfo() const { return instrInfo; }
Chris Lattnerd0f166a2002-12-29 03:13:05 +0000706 virtual const TargetSchedInfo &getSchedInfo() const { return schedInfo; }
707 virtual const TargetRegInfo &getRegInfo() const { return regInfo; }
Chris Lattnerda62ac62002-12-28 20:20:24 +0000708 virtual const TargetFrameInfo &getFrameInfo() const { return frameInfo; }
Chris Lattnerdde12622002-12-29 02:50:33 +0000709 virtual const TargetCacheInfo &getCacheInfo() const { return cacheInfo; }
710 virtual const TargetOptInfo &getOptInfo() const { return optInfo; }
Chris Lattner32f600a2001-09-19 13:47:12 +0000711
Chris Lattner63342052002-10-29 21:12:46 +0000712 virtual bool addPassesToEmitAssembly(PassManager &PM, std::ostream &Out);
Misha Brukman79caf1f2003-05-27 22:01:10 +0000713 virtual bool addPassesToJITCompile(PassManager &PM);
714 virtual bool addPassesToEmitMachineCode(PassManager &PM,
715 MachineCodeEmitter &MCE);
Chris Lattner4f946372002-10-28 01:03:43 +0000716
Chris Lattnerc66583e2002-10-29 22:01:44 +0000717 // getPrologEpilogInsertionPass - Inserts prolog/epilog code.
718 Pass* getPrologEpilogInsertionPass();
Chris Lattnerf6e0e282001-09-14 04:32:55 +0000719
Vikram S. Advee1f72802002-09-16 15:39:26 +0000720 // getFunctionAsmPrinterPass - Writes out machine code for a single function
Chris Lattnerc66583e2002-10-29 22:01:44 +0000721 Pass* getFunctionAsmPrinterPass(std::ostream &Out);
Vikram S. Advee1f72802002-09-16 15:39:26 +0000722
723 // getModuleAsmPrinterPass - Writes generated machine code to assembly file.
Chris Lattnerc66583e2002-10-29 22:01:44 +0000724 Pass* getModuleAsmPrinterPass(std::ostream &Out);
Vikram S. Advee1f72802002-09-16 15:39:26 +0000725
726 // getEmitBytecodeToAsmPass - Emits final LLVM bytecode to assembly file.
Chris Lattnerc66583e2002-10-29 22:01:44 +0000727 Pass* getEmitBytecodeToAsmPass(std::ostream &Out);
Chris Lattner6edfcc52002-02-03 07:51:17 +0000728};
Chris Lattnerf6e0e282001-09-14 04:32:55 +0000729
Chris Lattner795ba6c2003-01-15 21:36:50 +0000730int64_t GetConstantValueAsSignedInt(const Value *V, bool &isValidConstant);
731
Chris Lattnerfb4d20b2003-06-16 15:31:09 +0000732Pass *getFunctionInfo(std::ostream &out);
733
Chris Lattnerc6495ee2001-09-14 03:56:45 +0000734#endif