X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=lib%2FTarget%2FWebAssembly%2FWebAssemblyISelLowering.cpp;h=21a322241a8b2fdd8c7c95fd746a4cc6eb550a29;hp=4360116a7f19122864a5c3cf2a9083cd5da31769;hb=5f53aadd9c9fa073ce5eabc630002b77f9663cf9;hpb=5bcfe245f9d9c0624685571fdbd398a5e1e5118a diff --git a/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp index 4360116a7f1..21a322241a8 100644 --- a/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp +++ b/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp @@ -92,6 +92,8 @@ int DiagnosticInfoUnsupported::KindID = 0; WebAssemblyTargetLowering::WebAssemblyTargetLowering( const TargetMachine &TM, const WebAssemblySubtarget &STI) : TargetLowering(TM), Subtarget(&STI) { + // Booleans always contain 0 or 1. + setBooleanContents(ZeroOrOneBooleanContent); // WebAssembly does not produce floating-point exceptions on normal floating // point operations. setHasFloatingPointExceptions(false); @@ -108,7 +110,16 @@ WebAssemblyTargetLowering::WebAssemblyTargetLowering( // Compute derived properties from the register classes. computeRegisterProperties(Subtarget->getRegisterInfo()); - // FIXME: setOperationAction... + // FIXME: many setOperationAction are missing... + + for (auto T : {MVT::f32, MVT::f64}) { + // Don't expand the floating-point types to constant pools. + setOperationAction(ISD::ConstantFP, T, Legal); + // Expand floating-point comparisons. + for (auto CC : {ISD::SETO, ISD::SETUO, ISD::SETUEQ, ISD::SETONE, + ISD::SETULT, ISD::SETULE, ISD::SETUGT, ISD::SETUGE}) + setCondCodeAction(CC, T, Expand); + } } MVT WebAssemblyTargetLowering::getScalarShiftAmountTy(const DataLayout &DL, @@ -116,6 +127,16 @@ MVT WebAssemblyTargetLowering::getScalarShiftAmountTy(const DataLayout &DL, return VT.getSimpleVT(); } +const char * +WebAssemblyTargetLowering::getTargetNodeName(unsigned Opcode) const { + switch (static_cast(Opcode)) { + case WebAssemblyISD::FIRST_NUMBER: break; + case WebAssemblyISD::RETURN: return "WebAssemblyISD::RETURN"; + case WebAssemblyISD::ARGUMENT: return "WebAssemblyISD::ARGUMENT"; + } + return nullptr; +} + //===----------------------------------------------------------------------===// // WebAssembly Lowering private implementation. //===----------------------------------------------------------------------===//