mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
WebAssembly: handle more than int32 argument/return
Summary: Also test 64-bit integers, except shifts for now which are broken because isel dislikes the 32-bit truncate that precedes them. Reviewers: sunfish Subscribers: llvm-commits, jfb Differential Revision: http://reviews.llvm.org/D11699 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243822 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -92,10 +92,23 @@ void WebAssemblyAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
|
||||
bool PrintOperands = true;
|
||||
switch (MI->getOpcode()) {
|
||||
case WebAssembly::ARGUMENT:
|
||||
case WebAssembly::ARGUMENT_Int32:
|
||||
case WebAssembly::ARGUMENT_Int64:
|
||||
case WebAssembly::ARGUMENT_Float32:
|
||||
case WebAssembly::ARGUMENT_Float64:
|
||||
OS << "argument " << MI->getOperand(1).getImm();
|
||||
PrintOperands = false;
|
||||
break;
|
||||
case WebAssembly::RETURN_Int32:
|
||||
case WebAssembly::RETURN_Int64:
|
||||
case WebAssembly::RETURN_Float32:
|
||||
case WebAssembly::RETURN_Float64:
|
||||
case WebAssembly::RETURN_VOID:
|
||||
// FIXME This is here only so "return" prints nicely, instead of printing
|
||||
// the isel name. Other operations have the same problem, fix this in
|
||||
// a generic way instead.
|
||||
OS << "return";
|
||||
break;
|
||||
default:
|
||||
OS << TII->getName(MI->getOpcode());
|
||||
break;
|
||||
|
@@ -188,8 +188,6 @@ SDValue WebAssemblyTargetLowering::LowerFormalArguments(
|
||||
fail(DL, DAG, "WebAssembly hasn't implemented cons regs last arguments");
|
||||
if (In.Flags.isSplit())
|
||||
fail(DL, DAG, "WebAssembly hasn't implemented split arguments");
|
||||
if (In.VT != MVT::i32)
|
||||
fail(DL, DAG, "WebAssembly hasn't implemented non-i32 arguments");
|
||||
// FIXME Do something with In.getOrigAlign()?
|
||||
InVals.push_back(
|
||||
In.Used
|
||||
|
@@ -25,10 +25,15 @@
|
||||
* switch: switch statement with fallthrough
|
||||
*/
|
||||
|
||||
multiclass RETURN<WebAssemblyRegClass vt> {
|
||||
def RETURN_#vt : I<(outs), (ins vt:$val), [(WebAssemblyreturn vt:$val)]>;
|
||||
}
|
||||
let hasSideEffects = 1, isReturn = 1, isTerminator = 1, hasCtrlDep = 1,
|
||||
isBarrier = 1 in {
|
||||
//FIXME return more than just int32.
|
||||
def RETURN : I<(outs), (ins Int32:$val), [(WebAssemblyreturn Int32:$val)]>;
|
||||
def RETURN_VOID : I<(outs), (ins), [(WebAssemblyreturn)]>;
|
||||
defm : RETURN<Int32>;
|
||||
defm : RETURN<Int64>;
|
||||
defm : RETURN<Float32>;
|
||||
defm : RETURN<Float64>;
|
||||
def RETURN_VOID : I<(outs), (ins), [(WebAssemblyreturn)]>;
|
||||
} // hasSideEffects = 1, isReturn = 1, isTerminator = 1, hasCtrlDep = 1,
|
||||
// isBarrier = 1
|
||||
|
@@ -55,8 +55,14 @@ def WebAssemblyreturn : SDNode<"WebAssemblyISD::RETURN",
|
||||
|
||||
include "WebAssemblyInstrFormats.td"
|
||||
|
||||
def ARGUMENT : I<(outs Int32:$res), (ins i32imm:$argno),
|
||||
[(set Int32:$res, (WebAssemblyargument timm:$argno))]>;
|
||||
multiclass ARGUMENT<WebAssemblyRegClass vt> {
|
||||
def ARGUMENT_#vt : I<(outs vt:$res), (ins i32imm:$argno),
|
||||
[(set vt:$res, (WebAssemblyargument timm:$argno))]>;
|
||||
}
|
||||
defm : ARGUMENT<Int32>;
|
||||
defm : ARGUMENT<Int64>;
|
||||
defm : ARGUMENT<Float32>;
|
||||
defm : ARGUMENT<Float64>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Additional sets of instructions.
|
||||
|
Reference in New Issue
Block a user