4184eb6dc5a6a416db85b9622ce975dc9b3dbef1
[oota-llvm.git] / lib / Target / WebAssembly / WebAssemblyISelLowering.cpp
1 //=- WebAssemblyISelLowering.cpp - WebAssembly DAG Lowering Implementation -==//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// \brief This file implements the WebAssemblyTargetLowering class.
12 ///
13 //===----------------------------------------------------------------------===//
14
15 #include "WebAssemblyISelLowering.h"
16 #include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
17 #include "WebAssemblyMachineFunctionInfo.h"
18 #include "WebAssemblySubtarget.h"
19 #include "WebAssemblyTargetMachine.h"
20 #include "WebAssemblyTargetObjectFile.h"
21 #include "llvm/CodeGen/Analysis.h"
22 #include "llvm/CodeGen/MachineRegisterInfo.h"
23 #include "llvm/CodeGen/SelectionDAG.h"
24 #include "llvm/IR/Function.h"
25 #include "llvm/IR/Intrinsics.h"
26 #include "llvm/Support/CommandLine.h"
27 #include "llvm/Support/Debug.h"
28 #include "llvm/Support/ErrorHandling.h"
29 #include "llvm/Support/raw_ostream.h"
30 #include "llvm/Target/TargetOptions.h"
31 using namespace llvm;
32
33 #define DEBUG_TYPE "wasm-lower"
34
35 WebAssemblyTargetLowering::WebAssemblyTargetLowering(
36     const TargetMachine &TM, const WebAssemblySubtarget &STI)
37     : TargetLowering(TM), Subtarget(&STI) {
38   // WebAssembly does not produce floating-point exceptions on normal floating
39   // point operations.
40   setHasFloatingPointExceptions(false);
41   // We don't know the microarchitecture here, so just reduce register pressure.
42   setSchedulingPreference(Sched::RegPressure);
43 }
44
45 //===----------------------------------------------------------------------===//
46 // WebAssembly Lowering private implementation.
47 //===----------------------------------------------------------------------===//
48
49 //===----------------------------------------------------------------------===//
50 // Lowering Code
51 //===----------------------------------------------------------------------===//
52
53 //===----------------------------------------------------------------------===//
54 //  Other Lowering Code
55 //===----------------------------------------------------------------------===//
56
57 //===----------------------------------------------------------------------===//
58 //                          WebAssembly Optimization Hooks
59 //===----------------------------------------------------------------------===//
60
61 MCSection *WebAssemblyTargetObjectFile::SelectSectionForGlobal(
62     const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
63     const TargetMachine &TM) const {
64   return getDataSection();
65 }