- PM.add(getRegisterAllocator(*this));
-
- PM.add(getPrologEpilogInsertionPass());
-
- if (!DisablePeephole)
- PM.add(createPeepholeOptsPass(*this));
-
- PM.add(MappingInfoForFunction(Out));
-
- // Output assembly language to the .s file. Assembly emission is split into
- // two parts: Function output and Global value output. This is because
- // function output is pipelined with all of the rest of code generation stuff,
- // allowing machine code representations for functions to be free'd after the
- // function has been emitted.
- //
- PM.add(getFunctionAsmPrinterPass(Out));
- PM.add(new FreeMachineCodeForFunction()); // Free stuff no longer needed
-
- // Emit Module level assembly after all of the functions have been processed.
- PM.add(getModuleAsmPrinterPass(Out));
-
- // Emit bytecode to the assembly file into its special section next
- PM.add(getEmitBytecodeToAsmPass(Out));
- PM.add(getFunctionInfo(Out));
-}
-
-
-//---------------------------------------------------------------------------
-// class MachineInstructionInfo
-// Interface to description of machine instructions
-//---------------------------------------------------------------------------
-
-
-/*ctor*/
-MachineInstrInfo::MachineInstrInfo(const TargetMachine& tgt,
- const MachineInstrDescriptor* _desc,
- unsigned int _descSize,
- unsigned int _numRealOpCodes)
- : target(tgt),
- desc(_desc), descSize(_descSize), numRealOpCodes(_numRealOpCodes)
-{
- // FIXME: TargetInstrDescriptors should not be global
- assert(TargetInstrDescriptors == NULL && desc != NULL);
- TargetInstrDescriptors = desc; // initialize global variable
-}
-
-
-MachineInstrInfo::~MachineInstrInfo()
-{
- TargetInstrDescriptors = NULL; // reset global variable
-}
-
-
-bool
-MachineInstrInfo::constantFitsInImmedField(MachineOpCode opCode,
- int64_t intValue) const
-{
- // First, check if opCode has an immed field.
- bool isSignExtended;
- uint64_t maxImmedValue = maxImmedConstant(opCode, isSignExtended);
- if (maxImmedValue != 0)
- {
- // NEED TO HANDLE UNSIGNED VALUES SINCE THEY MAY BECOME MUCH
- // SMALLER AFTER CASTING TO SIGN-EXTENDED int, short, or char.
- // See CreateUIntSetInstruction in SparcInstrInfo.cpp.
-
- // Now check if the constant fits
- if (intValue <= (int64_t) maxImmedValue &&
- intValue >= -((int64_t) maxImmedValue+1))
- return true;
- }
-
- return false;