llvm.org GIT mirror llvm / c428c29
Merging r196987: ------------------------------------------------------------------------ r196987 | rafael.espindola | 2013-12-10 19:09:06 -0500 (Tue, 10 Dec 2013) | 2 lines Move PPC's getDataLayoutString out of line and document it better. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@205765 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 6 years ago
2 changed file(s) with 39 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
125125 /// selection.
126126 const InstrItineraryData &getInstrItineraryData() const { return InstrItins; }
127127
128 /// getDataLayoutString - Return the pointer size and type alignment
129 /// properties of this subtarget.
130 const char *getDataLayoutString() const {
131 // Note, the alignment values for f64 and i64 on ppc64 in Darwin
132 // documentation are wrong; these are correct (i.e. "what gcc does").
133 if (isPPC64() && isSVR4ABI()) {
134 if (TargetTriple.getOS() == llvm::Triple::FreeBSD)
135 return "E-p:64:64-f64:64:64-i64:64:64-v128:128:128-n32:64";
136 else
137 return "E-p:64:64-f64:64:64-i64:64:64-f128:128:128-v128:128:128-n32:64";
138 }
139
140 return isPPC64() ? "E-p:64:64-f64:64:64-i64:64:64-f128:64:128-n32:64"
141 : "E-p:32:32-f64:64:64-i64:64:64-f128:64:128-n32";
142 }
143
144128 /// \brief Reset the features for the PowerPC target.
145129 virtual void resetSubtargetFeatures(const MachineFunction *MF);
146130 private:
3232 RegisterTargetMachine C(ThePPC64LETarget);
3333 }
3434
35 /// Return the datalayout string of a subtarget.
36 static std::string getDataLayoutString(const PPCSubtarget &ST) {
37 const Triple &T = ST.getTargetTriple();
38
39 // PPC is big endian
40 std::string Ret = "E";
41
42 // PPC64 has 64 bit pointers, PPC32 has 32 bit pointers.
43 if (ST.isPPC64())
44 Ret += "-p:64:64";
45 else
46 Ret += "-p:32:32";
47
48 // Note, the alignment values for f64 and i64 on ppc64 in Darwin
49 // documentation are wrong; these are correct (i.e. "what gcc does").
50 Ret += "-f64:64:64-i64:64:64";
51
52 // Set support for 128 floats depending on the ABI.
53 if (ST.isPPC64() && ST.isSVR4ABI()) {
54 if (T.getOS() != llvm::Triple::FreeBSD)
55 Ret += "-f128:128:128";
56 } else {
57 Ret += "-f128:64:128";
58 }
59
60 // Some ABIs support 128 bit vectors.
61 if (ST.isPPC64() && ST.isSVR4ABI())
62 Ret += "-v128:128:128";
63
64 // PPC64 has 32 and 64 bit register, PPC32 has only 32 bit ones.
65 if (ST.isPPC64())
66 Ret += "-n32:64";
67 else
68 Ret += "-n32";
69
70 return Ret;
71 }
72
3573 PPCTargetMachine::PPCTargetMachine(const Target &T, StringRef TT,
3674 StringRef CPU, StringRef FS,
3775 const TargetOptions &Options,
4078 bool is64Bit)
4179 : LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
4280 Subtarget(TT, CPU, FS, is64Bit),
43 DL(Subtarget.getDataLayoutString()), InstrInfo(*this),
81 DL(getDataLayoutString(Subtarget)), InstrInfo(*this),
4482 FrameLowering(Subtarget), JITInfo(*this, is64Bit),
4583 TLInfo(*this), TSInfo(*this),
4684 InstrItins(Subtarget.getInstrItineraryData()) {