2012-02-18 12:03:15 +00:00
|
|
|
//===-- SparcSubtarget.cpp - SPARC Subtarget Information ------------------===//
|
2006-01-26 06:51:21 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2006-01-26 06:51:21 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2011-07-01 21:01:15 +00:00
|
|
|
// This file implements the SPARC specific subclass of TargetSubtargetInfo.
|
2006-01-26 06:51:21 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2006-02-05 05:50:24 +00:00
|
|
|
#include "SparcSubtarget.h"
|
2011-07-09 05:47:46 +00:00
|
|
|
#include "Sparc.h"
|
2013-06-01 04:51:18 +00:00
|
|
|
#include "llvm/Support/MathExtras.h"
|
2011-08-24 18:08:43 +00:00
|
|
|
#include "llvm/Support/TargetRegistry.h"
|
2011-07-01 20:45:01 +00:00
|
|
|
|
|
|
|
#define GET_SUBTARGETINFO_TARGET_DESC
|
2011-07-08 01:53:10 +00:00
|
|
|
#define GET_SUBTARGETINFO_CTOR
|
2011-07-01 22:36:09 +00:00
|
|
|
#include "SparcGenSubtargetInfo.inc"
|
2011-07-01 20:45:01 +00:00
|
|
|
|
2006-01-26 06:51:21 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
2011-12-20 02:50:00 +00:00
|
|
|
void SparcSubtarget::anchor() { }
|
|
|
|
|
2011-06-30 01:53:36 +00:00
|
|
|
SparcSubtarget::SparcSubtarget(const std::string &TT, const std::string &CPU,
|
|
|
|
const std::string &FS, bool is64Bit) :
|
2011-07-07 07:07:08 +00:00
|
|
|
SparcGenSubtargetInfo(TT, CPU, FS),
|
2010-02-04 06:34:01 +00:00
|
|
|
IsV9(false),
|
|
|
|
V8DeprecatedInsts(false),
|
|
|
|
IsVIS(false),
|
2013-08-25 18:30:06 +00:00
|
|
|
Is64Bit(is64Bit),
|
|
|
|
HasHardQuad(false) {
|
2013-06-04 18:33:25 +00:00
|
|
|
|
2006-01-26 06:51:21 +00:00
|
|
|
// Determine default and user specified characteristics
|
2011-06-30 01:53:36 +00:00
|
|
|
std::string CPUName = CPU;
|
|
|
|
if (CPUName.empty()) {
|
|
|
|
if (is64Bit)
|
|
|
|
CPUName = "v9";
|
|
|
|
else
|
|
|
|
CPUName = "v8";
|
2010-02-04 06:34:01 +00:00
|
|
|
}
|
2011-06-30 01:53:36 +00:00
|
|
|
IsV9 = CPUName == "v9";
|
2006-01-26 06:51:21 +00:00
|
|
|
|
|
|
|
// Parse features string.
|
2011-07-07 07:07:08 +00:00
|
|
|
ParseSubtargetFeatures(CPUName, FS);
|
2006-05-24 17:04:05 +00:00
|
|
|
}
|
2013-06-01 04:51:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
int SparcSubtarget::getAdjustedFrameSize(int frameSize) const {
|
|
|
|
|
|
|
|
if (is64Bit()) {
|
|
|
|
// All 64-bit stack frames must be 16-byte aligned, and must reserve space
|
|
|
|
// for spilling the 16 window registers at %sp+BIAS..%sp+BIAS+128.
|
|
|
|
frameSize += 128;
|
|
|
|
// Frames with calls must also reserve space for 6 outgoing arguments
|
|
|
|
// whether they are used or not. LowerCall_64 takes care of that.
|
|
|
|
assert(frameSize % 16 == 0 && "Stack size not 16-byte aligned");
|
|
|
|
} else {
|
|
|
|
// Emit the correct save instruction based on the number of bytes in
|
|
|
|
// the frame. Minimum stack frame size according to V8 ABI is:
|
|
|
|
// 16 words for register window spill
|
|
|
|
// 1 word for address of returned aggregate-value
|
|
|
|
// + 6 words for passing parameters on the stack
|
|
|
|
// ----------
|
|
|
|
// 23 words * 4 bytes per word = 92 bytes
|
|
|
|
frameSize += 92;
|
|
|
|
|
|
|
|
// Round up to next doubleword boundary -- a double-word boundary
|
|
|
|
// is required by the ABI.
|
|
|
|
frameSize = RoundUpToAlignment(frameSize, 8);
|
|
|
|
}
|
|
|
|
return frameSize;
|
|
|
|
}
|