2017-02-10 02:33:54 +01:00
|
|
|
//===- MCTargetOptions.h - MC Target Options --------------------*- C++ -*-===//
|
2014-04-23 13:16:03 +02:00
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2014-04-23 13:16:03 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_MC_MCTARGETOPTIONS_H
|
|
|
|
#define LLVM_MC_MCTARGETOPTIONS_H
|
|
|
|
|
2020-06-18 14:57:50 +02:00
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
2015-01-14 01:50:31 +01:00
|
|
|
#include <string>
|
2017-01-05 06:56:39 +01:00
|
|
|
#include <vector>
|
2015-01-14 01:50:31 +01:00
|
|
|
|
2014-04-23 13:16:03 +02:00
|
|
|
namespace llvm {
|
|
|
|
|
2016-07-27 18:03:57 +02:00
|
|
|
enum class ExceptionHandling {
|
2019-04-04 22:35:57 +02:00
|
|
|
None, ///< No exception support
|
|
|
|
DwarfCFI, ///< DWARF-like instruction based exceptions
|
|
|
|
SjLj, ///< setjmp/longjmp based exceptions
|
|
|
|
ARM, ///< ARM EHABI
|
|
|
|
WinEH, ///< Windows Exception Handling
|
|
|
|
Wasm, ///< WebAssembly Exception Handling
|
2020-12-02 15:48:52 +01:00
|
|
|
AIX, ///< AIX Exception Handling
|
2016-07-27 18:03:57 +02:00
|
|
|
};
|
|
|
|
|
2017-06-09 02:40:19 +02:00
|
|
|
enum class DebugCompressionType {
|
2019-04-04 22:35:57 +02:00
|
|
|
None, ///< No compression
|
|
|
|
GNU, ///< zlib-gnu style compression
|
|
|
|
Z, ///< zlib style complession
|
2017-06-09 02:40:19 +02:00
|
|
|
};
|
|
|
|
|
2015-01-14 01:50:31 +01:00
|
|
|
class StringRef;
|
|
|
|
|
2014-04-23 13:16:03 +02:00
|
|
|
class MCTargetOptions {
|
|
|
|
public:
|
|
|
|
enum AsmInstrumentation {
|
|
|
|
AsmInstrumentationNone,
|
|
|
|
AsmInstrumentationAddress
|
|
|
|
};
|
|
|
|
|
2014-05-23 01:09:57 +02:00
|
|
|
bool MCRelaxAll : 1;
|
|
|
|
bool MCNoExecStack : 1;
|
2014-08-26 20:39:50 +02:00
|
|
|
bool MCFatalWarnings : 1;
|
2015-07-28 00:39:14 +02:00
|
|
|
bool MCNoWarn : 1;
|
2016-12-06 00:55:13 +01:00
|
|
|
bool MCNoDeprecatedWarn : 1;
|
[WebAssembly] Added initial type checker to MC Assembler
This to protect against non-sensical instruction sequences being assembled,
which would either cause asserts/crashes further down, or a Wasm module being output that doesn't validate.
Unlike a validator, this type checker is able to give type-errors as part of the parsing process, which makes the assembler much friendlier to be used by humans writing manual input.
Because the MC system is single pass (instructions aren't even stored in MC format, they are directly output) the type checker has to be single pass as well, which means that from now on .globaltype and .functype decls must come before their use. An extra pass is added to Codegen to collect information for this purpose, since AsmPrinter is normally single pass / streaming as well, and would otherwise generate this information on the fly.
A `-no-type-check` flag was added to llvm-mc (and any other tools that take asm input) that surpresses type errors, as a quick escape hatch for tests that were not intended to be type correct.
This is a first version of the type checker that ignores control flow, i.e. it checks that types are correct along the linear path, but not the branch path. This will still catch most errors. Branch checking could be added in the future.
Differential Revision: https://reviews.llvm.org/D104945
2021-06-07 21:10:47 +02:00
|
|
|
bool MCNoTypeCheck : 1;
|
2014-05-23 01:09:57 +02:00
|
|
|
bool MCSaveTempLabels : 1;
|
|
|
|
bool MCUseDwarfDirectory : 1;
|
2015-12-21 23:09:27 +01:00
|
|
|
bool MCIncrementalLinkerCompatible : 1;
|
2014-05-23 01:09:57 +02:00
|
|
|
bool ShowMCEncoding : 1;
|
|
|
|
bool ShowMCInst : 1;
|
|
|
|
bool AsmVerbose : 1;
|
2016-07-11 14:42:14 +02:00
|
|
|
|
|
|
|
/// Preserve Comments in Assembly.
|
|
|
|
bool PreserveAsmComments : 1;
|
|
|
|
|
2020-06-03 08:15:51 +02:00
|
|
|
bool Dwarf64 : 1;
|
2017-02-10 02:33:54 +01:00
|
|
|
int DwarfVersion = 0;
|
2017-01-05 06:56:39 +01:00
|
|
|
|
2015-01-14 01:50:31 +01:00
|
|
|
std::string ABIName;
|
[ms] [llvm-ml] Add a draft MASM parser
Summary:
Many directives are unavailable, and support for others may be limited.
This first draft has preliminary support for:
- conditional directives (including errors),
- data allocation (unsigned types up to 8 bytes, and ALIGN),
- equates/variables (numeric and text),
- and procedure directives (without parameters),
as well as COMMENT, ECHO, INCLUDE, INCLUDELIB, PUBLIC, and EXTERN. Text variables (aka text macros) are expanded in-place wherever the identifier occurs.
We deliberately ignore all ml.exe processor directives.
Prominent features not yet supported:
- structs
- macros (both procedures and functions)
- procedures (with specified parameters)
- substitution & expansion operators
Conditional directives are complicated by the fact that "ifdef rax" is a valid way to check if a file is being assembled for a 64-bit x86 processor; we add support for "ifdef <register>" in general, which requires adding a tryParseRegister method to all MCTargetAsmParsers. (Some targets require backtracking in the non-register case.)
Reviewers: rnk, thakis
Reviewed By: thakis
Subscribers: kerbowa, merge_guards_bot, wuzish, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, mgorny, sbc100, jgravelle-google, hiraditya, aheejin, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, Jim, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72680
2020-02-16 18:29:51 +01:00
|
|
|
std::string AssemblyLanguage;
|
2017-04-22 01:35:26 +02:00
|
|
|
std::string SplitDwarfFile;
|
2017-01-05 06:56:39 +01:00
|
|
|
|
2020-06-18 14:57:50 +02:00
|
|
|
const char *Argv0 = nullptr;
|
|
|
|
ArrayRef<const char *> CommandLineArgs;
|
|
|
|
|
2017-01-05 06:56:39 +01:00
|
|
|
/// Additional paths to search for `.include` directives when using the
|
|
|
|
/// integrated assembler.
|
|
|
|
std::vector<std::string> IASSearchPaths;
|
|
|
|
|
2014-04-23 13:16:03 +02:00
|
|
|
MCTargetOptions();
|
2017-02-10 02:33:54 +01:00
|
|
|
|
|
|
|
/// getABIName - If this returns a non-empty string this represents the
|
|
|
|
/// textual name of the ABI that we want the backend to use, e.g. o32, or
|
|
|
|
/// aapcs-linux.
|
|
|
|
StringRef getABIName() const;
|
[ms] [llvm-ml] Add a draft MASM parser
Summary:
Many directives are unavailable, and support for others may be limited.
This first draft has preliminary support for:
- conditional directives (including errors),
- data allocation (unsigned types up to 8 bytes, and ALIGN),
- equates/variables (numeric and text),
- and procedure directives (without parameters),
as well as COMMENT, ECHO, INCLUDE, INCLUDELIB, PUBLIC, and EXTERN. Text variables (aka text macros) are expanded in-place wherever the identifier occurs.
We deliberately ignore all ml.exe processor directives.
Prominent features not yet supported:
- structs
- macros (both procedures and functions)
- procedures (with specified parameters)
- substitution & expansion operators
Conditional directives are complicated by the fact that "ifdef rax" is a valid way to check if a file is being assembled for a 64-bit x86 processor; we add support for "ifdef <register>" in general, which requires adding a tryParseRegister method to all MCTargetAsmParsers. (Some targets require backtracking in the non-register case.)
Reviewers: rnk, thakis
Reviewed By: thakis
Subscribers: kerbowa, merge_guards_bot, wuzish, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, mgorny, sbc100, jgravelle-google, hiraditya, aheejin, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, Jim, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72680
2020-02-16 18:29:51 +01:00
|
|
|
|
|
|
|
/// getAssemblyLanguage - If this returns a non-empty string this represents
|
|
|
|
/// the textual name of the assembly language that we will use for this
|
|
|
|
/// target, e.g. masm.
|
|
|
|
StringRef getAssemblyLanguage() const;
|
2014-04-23 13:16:03 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace llvm
|
|
|
|
|
2017-02-10 02:33:54 +01:00
|
|
|
#endif // LLVM_MC_MCTARGETOPTIONS_H
|