LLVM: lib/BinaryFormat/XCOFF.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

16

17using namespace llvm;

18

19#define SMC_CASE(A) \

20 case XCOFF::XMC_##A: \

21 return #A;

23 switch (SMC) {

45#undef SMC_CASE

46 }

47

48

49 return "Unknown";

50}

51

52#define RELOC_CASE(A) \

53 case XCOFF::A: \

54 return #A;

56 switch (Type) {

80 }

81 return "Unknown";

82}

83#undef RELOC_CASE

84

85#define LANG_CASE(A) \

86 case XCOFF::TracebackTable::A: \

87 return #A;

88

91 switch (LangId) {

107 }

108 return "Unknown";

109}

110#undef LANG_CASE

111

137

138#define TCPU_CASE(A) \

139 case XCOFF::TCPU_##A: \

140 return #A;

142 switch (TCPU) {

164 }

165 return "INVALID";

166}

167#undef TCPU_CASE

168

170 unsigned FixedParmsNum,

171 unsigned FloatingParmsNum) {

173 int Bits = 0;

174 unsigned ParsedFixedNum = 0;

175 unsigned ParsedFloatingNum = 0;

176 unsigned ParsedNum = 0;

177 unsigned ParmsNum = FixedParmsNum + FloatingParmsNum;

178

179

180

181

182

183

184

185

186

187 while (Bits < 31 && ParsedNum < ParmsNum) {

188 if (++ParsedNum > 1)

189 ParmsType += ", ";

191

192 ParmsType += "i";

193 ++ParsedFixedNum;

195 ++Bits;

196 } else {

198

199 ParmsType += "f";

200 else

201

202 ParmsType += "d";

203 ++ParsedFloatingNum;

205 Bits += 2;

206 }

207 }

208

209

210 if (ParsedNum < ParmsNum)

211 ParmsType += ", ...";

212

213 if (Value != 0u || ParsedFixedNum > FixedParmsNum ||

214 ParsedFloatingNum > FloatingParmsNum)

216 "ParmsType encodes can not map to ParmsNum "

217 "parameters in parseParmsType.");

218 return ParmsType;

219}

220

223

225 Res += "TB_OS1 ";

227 Res += "TB_RESERVED ";

229 Res += "TB_SSP_CANARY ";

231 Res += "TB_OS2 ";

233 Res += "TB_EH_INFO ";

235 Res += "TB_LONGTBTABLE2 ";

236

237

238 if (Flag & 0x06)

239 Res += "Unknown ";

240

241

243 return Res;

244}

245

248 unsigned FloatingParmsNum,

249 unsigned VectorParmsNum) {

251

252 unsigned ParsedFixedNum = 0;

253 unsigned ParsedFloatingNum = 0;

254 unsigned ParsedVectorNum = 0;

255 unsigned ParsedNum = 0;

256 unsigned ParmsNum = FixedParmsNum + FloatingParmsNum + VectorParmsNum;

257

258 for (int Bits = 0; Bits < 32 && ParsedNum < ParmsNum; Bits += 2) {

259 if (++ParsedNum > 1)

260 ParmsType += ", ";

261

264 ParmsType += "i";

265 ++ParsedFixedNum;

266 break;

268 ParmsType += "v";

269 ++ParsedVectorNum;

270 break;

272 ParmsType += "f";

273 ++ParsedFloatingNum;

274 break;

276 ParmsType += "d";

277 ++ParsedFloatingNum;

278 break;

279 default:

280 assert(false && "Unrecognized bits in ParmsType.");

281 }

283 }

284

285

286 if (ParsedNum < ParmsNum)

287 ParmsType += ", ...";

288

289 if (Value != 0u || ParsedFixedNum > FixedParmsNum ||

290 ParsedFloatingNum > FloatingParmsNum || ParsedVectorNum > VectorParmsNum)

293 "ParmsType encodes can not map to ParmsNum parameters "

294 "in parseParmsTypeWithVecInfo.");

295

296 return ParmsType;

297}

298

300 unsigned ParmsNum) {

302 unsigned ParsedNum = 0;

303 for (int Bits = 0; ParsedNum < ParmsNum && Bits < 32; Bits += 2) {

304 if (++ParsedNum > 1)

305 ParmsType += ", ";

308 ParmsType += "vc";

309 break;

310

312 ParmsType += "vs";

313 break;

314

316 ParmsType += "vi";

317 break;

318

320 ParmsType += "vf";

321 break;

322 }

323

325 }

326

327

328 if (ParsedNum < ParmsNum)

329 ParmsType += ", ...";

330

333 "ParmsType encodes more than ParmsNum parameters "

334 "in parseVectorParmsType.");

335 return ParmsType;

336}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

#define LANG_CASE(A)

Definition XCOFF.cpp:85

#define SMC_CASE(A)

Definition XCOFF.cpp:19

#define RELOC_CASE(A)

Definition XCOFF.cpp:52

#define TCPU_CASE(A)

Definition XCOFF.cpp:138

This file defines the SmallString class.

This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...

Tagged union holding either a T or a Error.

SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...

StringRef - Represent a constant reference to a string, i.e.

A switch()-like statement whose cases are string literals.

StringSwitch & Case(StringLiteral S, T Value)

StringSwitch & Cases(std::initializer_list< StringLiteral > CaseStrings, T Value)

The instances of the Type class are immutable: once they are created, they are never changed.

LLVM Value Representation.

@ C

The default llvm calling convention, compatible with C.

Define some predicates that are used for node matching.

LLVM_ABI StringRef normalizeCPUName(StringRef CPUName)

LLVM_ABI SmallString< 32 > getExtendedTBTableFlagString(uint8_t Flag)

Definition XCOFF.cpp:221

LLVM_ABI XCOFF::CFileCpuId getCpuID(StringRef CPU)

Definition XCOFF.cpp:112

LLVM_ABI Expected< SmallString< 32 > > parseParmsTypeWithVecInfo(uint32_t Value, unsigned FixedParmsNum, unsigned FloatingParmsNum, unsigned VectorParmsNum)

Definition XCOFF.cpp:247

LLVM_ABI StringRef getRelocationTypeString(XCOFF::RelocationType Type)

Definition XCOFF.cpp:55

LLVM_ABI Expected< SmallString< 32 > > parseParmsType(uint32_t Value, unsigned FixedParmsNum, unsigned FloatingParmsNum)

Definition XCOFF.cpp:169

LLVM_ABI StringRef getMappingClassString(XCOFF::StorageMappingClass SMC)

Definition XCOFF.cpp:22

LLVM_ABI Expected< SmallString< 32 > > parseVectorParmsType(uint32_t Value, unsigned ParmsNum)

Definition XCOFF.cpp:299

@ R_RBR

Branch relative to self relocation.

@ R_TOC

Relative to the TOC relocation.

@ R_RLA

Positive load address relocation. Modifiable instruction.

@ R_TLSML

Module reference to the local TLS storage.

@ R_TRL

TOC relative indirect load relocation.

@ R_BR

Branch relative to self relocation.

@ R_POS

Positive relocation.

@ R_RBA

Branch absolute relocation.

@ R_BA

Branch absolute relocation.

@ R_REL

Relative to self relocation.

@ R_NEG

Negative relocation.

@ R_TLS_IE

Initial-exec reference to TLS symbol.

@ R_TLSM

Module reference to TLS.

@ R_GL

Global linkage-external TOC address relocation.

@ R_REF

A non-relocating relocation.

@ R_RL

Positive indirect load relocation. Modifiable instruction.

@ R_TRLA

Relative to the TOC or to the thread-local storage base relocation.

@ R_TCL

Local object TOC address relocation.

@ R_TOCL

Relative to TOC lower.

@ R_TOCU

Relative to TOC upper.

@ R_TLS_LD

Local-dynamic reference to TLS symbol.

@ R_TLS

General-dynamic reference to TLS symbol.

@ R_TLS_LE

Local-exec reference to TLS symbol.

@ TB_EH_INFO

Exception handling info present.

@ TB_OS1

Reserved for OS use.

@ TB_SSP_CANARY

stack smasher canary present on stack.

@ TB_LONGTBTABLE2

Additional tbtable extension exists.

@ TB_OS2

Reserved for OS use.

@ TB_RESERVED

Reserved for compiler.

@ TCPU_604

604 implementation of PowerPC architecture.

@ TCPU_ANY

Mixture of any incompatable POWER and PowerPC architecture implementations.

@ TCPU_COM

POWER and PowerPC architecture common.

@ TCPU_603

603 implementation of PowerPC architecture.

@ TCPU_601

601 implementation of PowerPC architecture.

@ TCPU_INVALID

Invalid id - assumes POWER for old objects.

StorageMappingClass

Storage Mapping Class definitions.

LLVM_ABI StringRef getTCPUString(XCOFF::CFileCpuId TCPU)

Definition XCOFF.cpp:141

LLVM_ABI StringRef getNameForTracebackTableLanguageId(TracebackTable::LanguageID LangId)

Definition XCOFF.cpp:89

This is an optimization pass for GlobalISel generic memory operations.

Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)

Create formatted StringError object.

@ Default

The result values are uniform if and only if all operands are uniform.

static constexpr uint32_t ParmTypeFloatingIsDoubleBit

static constexpr uint32_t ParmTypeIsFloatingBit

static constexpr uint32_t ParmTypeIsVectorShortBit

static constexpr uint32_t ParmTypeMask

static constexpr uint32_t ParmTypeIsDoubleBits

static constexpr uint32_t ParmTypeIsVectorIntBit

static constexpr uint32_t ParmTypeIsFixedBits

static constexpr uint32_t ParmTypeIsVectorBits

static constexpr uint32_t ParmTypeIsVectorCharBit

static constexpr uint32_t ParmTypeIsVectorFloatBit

static constexpr uint32_t ParmTypeIsFloatingBits