1 //===-- SparcSubtarget.cpp - SPARC Subtarget Information ------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the SPARC specific subclass of TargetSubtargetInfo.
12 //===----------------------------------------------------------------------===//
14 #include "SparcSubtarget.h"
16 #include "llvm/Support/MathExtras.h"
17 #include "llvm/Support/TargetRegistry.h"
19 #define GET_SUBTARGETINFO_TARGET_DESC
20 #define GET_SUBTARGETINFO_CTOR
21 #include "SparcGenSubtargetInfo.inc"
25 void SparcSubtarget::anchor() { }
27 SparcSubtarget::SparcSubtarget(const std::string &TT, const std::string &CPU,
28 const std::string &FS, bool is64Bit) :
29 SparcGenSubtargetInfo(TT, CPU, FS),
31 V8DeprecatedInsts(false),
35 // Determine default and user specified characteristics
36 std::string CPUName = CPU;
37 if (CPUName.empty()) {
43 IsV9 = CPUName == "v9";
45 // Parse features string.
46 ParseSubtargetFeatures(CPUName, FS);
50 int SparcSubtarget::getAdjustedFrameSize(int frameSize) const {
53 // All 64-bit stack frames must be 16-byte aligned, and must reserve space
54 // for spilling the 16 window registers at %sp+BIAS..%sp+BIAS+128.
56 // Frames with calls must also reserve space for 6 outgoing arguments
57 // whether they are used or not. LowerCall_64 takes care of that.
58 assert(frameSize % 16 == 0 && "Stack size not 16-byte aligned");
60 // Emit the correct save instruction based on the number of bytes in
61 // the frame. Minimum stack frame size according to V8 ABI is:
62 // 16 words for register window spill
63 // 1 word for address of returned aggregate-value
64 // + 6 words for passing parameters on the stack
66 // 23 words * 4 bytes per word = 92 bytes
69 // Round up to next doubleword boundary -- a double-word boundary
70 // is required by the ABI.
71 frameSize = RoundUpToAlignment(frameSize, 8);