forked from rust-lang/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SOL] Reworked the SBF textual assembly syntax to match the rbpf-styl…
…e syntax. (#54) - Update the syntax of every instruction in SBFInstrInfo.td (currently using the asm variants feature to temporarily support both). - Update AsmParser for the new syntax (add new operand, memory, instruction, and directive parse routines). - Add error checking for unresolved 16-bit branch relocations and emit error message for graceful exit (the old BPF back-end crashes) and corresponding lit unit test. - Add new lit unit tests in MC/SBF and MC/Disassembler/SBF to cover disassembly, object emission, and parsing of every single instruction. This is more extensive coverage than existed previously. - Remaster all CodeGen/SBF unit tests accordingly. - A minor TableGen patch was needed to support asm strings containing '|' within variant strings ('|' happens to be the variant separator). The patch is a bit more complex than it otherwise might be in that we currently support both syntaxes to ease the verification (e.g., being able to see and compare each instruction and object code side-by-side within each unit test). After some 'soak time' for the new functionality, I intend to remove the old syntax altogether and otherwise clean-up. We'll also remove the TableGen patch at that time.
- Loading branch information
Showing
103 changed files
with
2,873 additions
and
753 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
//===-- SBFMCAsmInfo.cpp - SBF Asm properties -----------------------------===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file contains the declarations of the SBFMCAsmInfo properties. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "SBFMCAsmInfo.h" | ||
#include "llvm/BinaryFormat/Dwarf.h" | ||
#include "llvm/MC/MCStreamer.h" | ||
#include "llvm/Support/CommandLine.h" | ||
|
||
using namespace llvm; | ||
|
||
cl::opt<unsigned> SBFAsmWriterVariant( | ||
"sbf-output-asm-variant", cl::Hidden, cl::init(0), | ||
cl::desc("Choose output assembly variant (0 = sbf[default], 1 = legacy)")); | ||
|
||
SBFMCAsmInfo::SBFMCAsmInfo(const Triple &TT, const MCTargetOptions &Options) { | ||
AssemblerDialect = SBFAsmWriterVariant; | ||
|
||
PrivateGlobalPrefix = ".L"; | ||
WeakRefDirective = "\t.weak\t"; | ||
|
||
UsesELFSectionDirectiveForBSS = true; | ||
HasSingleParameterDotFile = true; | ||
HasDotTypeDotSizeDirective = true; | ||
|
||
SupportsDebugInformation = true; | ||
ExceptionsType = ExceptionHandling::DwarfCFI; | ||
MinInstAlignment = 8; | ||
|
||
// The default is 4 and it only affects dwarf elf output. | ||
// If not set correctly, the dwarf data will be | ||
// messed up in random places by 4 bytes. .debug_line | ||
// section will be parsable, but with odd offsets and | ||
// line numbers, etc. | ||
CodePointerSize = 8; | ||
|
||
UseIntegratedAssembler = false; | ||
} |
Oops, something went wrong.