mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 15:13:49 -04:00
[WebAssembly] Basic support for Wasm object file encoding.
With the "wasm32-unknown-unknown-wasm" triple, this allows writing out simple wasm object files, and is another step in a larger series toward migrating from ELF to general wasm object support. Note that this code and the binary format itself is still experimental. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296190 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -488,6 +488,15 @@ static void FixEndsAtEndOfFunction(
|
||||
}
|
||||
}
|
||||
|
||||
// WebAssembly functions end with an end instruction, as if the function body
|
||||
// were a block.
|
||||
static void AppendEndToFunction(
|
||||
MachineFunction &MF,
|
||||
const WebAssemblyInstrInfo &TII) {
|
||||
BuildMI(MF.back(), MF.back().end(), DebugLoc(),
|
||||
TII.get(WebAssembly::END_FUNCTION));
|
||||
}
|
||||
|
||||
/// Insert LOOP and BLOCK markers at appropriate places.
|
||||
static void PlaceMarkers(MachineFunction &MF, const MachineLoopInfo &MLI,
|
||||
const WebAssemblyInstrInfo &TII,
|
||||
@@ -555,6 +564,11 @@ static void PlaceMarkers(MachineFunction &MF, const MachineLoopInfo &MLI,
|
||||
// Fix up block/loop signatures at the end of the function to conform to
|
||||
// WebAssembly's rules.
|
||||
FixEndsAtEndOfFunction(MF, MFI, BlockTops, LoopTops);
|
||||
|
||||
// Add an end instruction at the end of the function body.
|
||||
if (!MF.getSubtarget<WebAssemblySubtarget>()
|
||||
.getTargetTriple().isOSBinFormatELF())
|
||||
AppendEndToFunction(MF, TII);
|
||||
}
|
||||
|
||||
bool WebAssemblyCFGStackify::runOnMachineFunction(MachineFunction &MF) {
|
||||
|
||||
Reference in New Issue
Block a user