1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/lib/MC
Pavel Labath 3e3b10a540 MCRegisterInfo: Merge getLLVMRegNum and getLLVMRegNumFromEH
Summary:
The functions different in two ways:
- getLLVMRegNum could return both "eh" and "other" dwarf register
  numbers, while getLLVMRegNumFromEH only returned the "eh" number.
- getLLVMRegNum asserted if the register was not found, while the second
  function returned -1.

The second distinction was pretty important, but it was very hard to
infer that from the function name. Aditionally, for the use case of
dumping dwarf expressions, we needed a function which can work with both
kinds of number, but does not assert.

This patch solves both of these issues by merging the two functions into
one, returning an Optional<unsigned> value. While the same thing could
be achieved by adding an "IsEH" argument to the (renamed)
getLLVMRegNumFromEH function, it seemed better to avoid the confusion of
two functions and put the choice of asserting into the hands of the
caller -- if he checks the Optional value, he can safely process
"untrusted" input, and if he blindly dereferences the Optional, he gets
the assertion.

I've updated all call sites to the new API, choosing between the two
options according to the function they were calling originally, except
that I've updated the usage in DWARFExpression.cpp to use the "safe"
method instead, and added a test case which would have previously
triggered an assertion failure when processing (incorrect?) dwarf
expressions.

Reviewers: dsanders, arsenm, JDevlieghere

Subscribers: wdng, aprantl, javed.absar, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67154

llvm-svn: 372710
2019-09-24 09:31:02 +00:00
..
MCDisassembler Fix leaks in LLVMCreateDisasmCPUFeatures 2019-06-26 16:13:17 +00:00
MCParser [MC] Avoid crashes from improperly nested or wrong target .seh_handlerdata directives 2019-08-30 22:25:55 +00:00
CMakeLists.txt Boilerplate for producing XCOFF object files from the PowerPC backend. 2019-07-09 19:21:01 +00:00
ConstantPools.cpp
ELFObjectWriter.cpp [Alignment] Introduce llvm::Align to MCSection 2019-09-13 09:29:59 +00:00
LLVMBuild.txt
MachObjectWriter.cpp [Alignment] Move OffsetToAlignment to Alignment.h 2019-09-12 15:20:36 +00:00
MCAsmBackend.cpp [DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame. 2019-07-19 02:03:34 +00:00
MCAsmInfo.cpp Move addInitialFrameState out of line and remove the MCDwarf.h include. 2019-04-12 06:57:45 +00:00
MCAsmInfoCOFF.cpp
MCAsmInfoDarwin.cpp
MCAsmInfoELF.cpp
MCAsmInfoWasm.cpp
MCAsmInfoXCOFF.cpp [PowerPC][AIX] Adds support for writing the .data section in assembly files 2019-08-25 15:17:25 +00:00
MCAsmMacro.cpp MCAsmMacro: add #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) to some dump() declarations 2019-08-20 04:14:43 +00:00
MCAsmStreamer.cpp MCRegisterInfo: Merge getLLVMRegNum and getLLVMRegNumFromEH 2019-09-24 09:31:02 +00:00
MCAssembler.cpp [Alignment] Move OffsetToAlignment to Alignment.h 2019-09-12 15:20:36 +00:00
MCCodeEmitter.cpp
MCCodePadder.cpp
MCCodeView.cpp [codeview] Revert inline line table change of r362264 2019-05-31 22:55:03 +00:00
MCContext.cpp Adds support for writing the .bss section for XCOFF object files. 2019-08-20 22:03:18 +00:00
MCDwarf.cpp Do a sweep of symbol internalization. NFC. 2019-08-23 19:59:23 +00:00
MCELFObjectTargetWriter.cpp
MCELFStreamer.cpp [Alignment] Introduce llvm::Align to MCSection 2019-09-13 09:29:59 +00:00
MCExpr.cpp [MC] Delete an overload of MCExpr::evaluateKnownAbsolute and its associated hack 2019-08-20 07:42:04 +00:00
MCFragment.cpp
MCInst.cpp
MCInstPrinter.cpp [MC] Fix undefined behavior in MCInstPrinter::formatHex 2019-09-06 01:13:32 +00:00
MCInstrAnalysis.cpp [MC] Add MCInstrAnalysis::evaluateMemoryOperandAddress 2019-07-25 06:57:09 +00:00
MCInstrDesc.cpp
MCLabel.cpp
MCLinkerOptimizationHint.cpp
MCMachObjectTargetWriter.cpp
MCMachOStreamer.cpp
MCNullStreamer.cpp
MCObjectFileInfo.cpp AArch64: support arm64_32, an ILP32 slice for watchOS. 2019-09-12 10:22:23 +00:00
MCObjectStreamer.cpp [Alignment] Introduce llvm::Align to MCSection 2019-09-13 09:29:59 +00:00
MCObjectWriter.cpp
MCRegisterInfo.cpp MCRegisterInfo: Merge getLLVMRegNum and getLLVMRegNumFromEH 2019-09-24 09:31:02 +00:00
MCSchedule.cpp
MCSection.cpp
MCSectionCOFF.cpp
MCSectionELF.cpp Add IR support, ELF section and user documentation for partitioning feature. 2019-05-29 03:29:01 +00:00
MCSectionMachO.cpp
MCSectionWasm.cpp [WebAssembly] Update MC for bulk memory 2019-02-19 22:56:19 +00:00
MCSectionXCOFF.cpp [PowerPC][AIX] Adds support for writing the .data section in assembly files 2019-08-25 15:17:25 +00:00
MCStreamer.cpp [X86] Print register names in .seh_* directives 2019-08-30 21:23:05 +00:00
MCSubtargetInfo.cpp Revert "[System Model] [TTI] Update cache and prefetch TTI interfaces" 2019-07-10 18:25:58 +00:00
MCSymbol.cpp
MCSymbolELF.cpp MCSymbolicELF: simplify. (Flags & (x << s)) >> s is equivalent to Flags >> s & x 2019-04-10 10:30:22 +00:00
MCTargetOptions.cpp Remove ASan asm instrumentation. 2019-03-11 21:50:10 +00:00
MCValue.cpp
MCWasmObjectTargetWriter.cpp [WebAssembly] Make __attribute__((used)) not imply export. 2019-08-29 22:40:00 +00:00
MCWasmStreamer.cpp [WebAssembly] Make __attribute__((used)) not imply export. 2019-08-29 22:40:00 +00:00
MCWin64EH.cpp [AArch64][Windows] Compute function length correctly in unwind tables. 2019-05-03 00:10:45 +00:00
MCWinCOFFStreamer.cpp [Alignment] Introduce llvm::Align to MCSection 2019-09-13 09:29:59 +00:00
MCWinEH.cpp
MCXCOFFObjectTargetWriter.cpp Boilerplate for producing XCOFF object files from the PowerPC backend. 2019-07-09 19:21:01 +00:00
MCXCOFFStreamer.cpp Handle local commons for XCOFF object file writing 2019-08-27 15:14:45 +00:00
StringTableBuilder.cpp Adds support for writing the .bss section for XCOFF object files. 2019-08-20 22:03:18 +00:00
SubtargetFeature.cpp [Subtarget] Move SubtargetFeatureKV/SubtargetInfoKV from SubtargetFeature.h to MCSubtargetInfo.h. Move all code that operates on ProcFeatures and ProcDesc arrays to MCSubtargetInfo. 2019-03-05 18:54:30 +00:00
WasmObjectWriter.cpp [WebAssembly] Make __attribute__((used)) not imply export. 2019-08-29 22:40:00 +00:00
WinCOFFObjectWriter.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
XCOFFObjectWriter.cpp Handle local commons for XCOFF object file writing 2019-08-27 15:14:45 +00:00