LLVM  10.0.0svn
WindowsMachineFlag.cpp
Go to the documentation of this file.
1 //===- WindowsMachineFlag.cpp ---------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Functions for implementing the /machine: flag.
10 //
11 //===----------------------------------------------------------------------===//
12 
14 
15 #include "llvm/ADT/StringRef.h"
16 #include "llvm/ADT/StringSwitch.h"
17 #include "llvm/BinaryFormat/COFF.h"
18 
19 using namespace llvm;
20 
21 // Returns /machine's value.
24  .Cases("x64", "amd64", COFF::IMAGE_FILE_MACHINE_AMD64)
25  .Cases("x86", "i386", COFF::IMAGE_FILE_MACHINE_I386)
29 }
30 
32  switch (MT) {
34  return "arm";
36  return "arm64";
38  return "x64";
40  return "x86";
41  default:
42  llvm_unreachable("unknown machine type");
43  }
44 }
This class represents lattice values for constants.
Definition: AllocatorList.h:23
StringSwitch & Case(StringLiteral S, T Value)
Definition: StringSwitch.h:67
MachineTypes
Definition: COFF.h:93
StringRef machineToStr(COFF::MachineTypes MT)
LLVM_NODISCARD R Default(T Value)
Definition: StringSwitch.h:181
A switch()-like statement whose cases are string literals.
Definition: StringSwitch.h:42
StringSwitch & Cases(StringLiteral S0, StringLiteral S1, T Value)
Definition: StringSwitch.h:88
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
COFF::MachineTypes getMachineType(StringRef S)
LLVM_NODISCARD std::string lower() const
Definition: StringRef.cpp:107
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48