OLD | NEW |
1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// | 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file implements the TargetLoweringX8632 class, which | 10 // This file implements the TargetLoweringX8632 class, which |
11 // consists almost entirely of the lowering sequence for each | 11 // consists almost entirely of the lowering sequence for each |
12 // high-level instruction. It also implements | 12 // high-level instruction. It also implements |
13 // TargetX8632Fast::postLower() which does the simplest possible | 13 // TargetX8632Fast::postLower() which does the simplest possible |
14 // register allocation for the "fast" target. | 14 // register allocation for the "fast" target. |
15 // | 15 // |
16 //===----------------------------------------------------------------------===// | 16 //===----------------------------------------------------------------------===// |
17 | 17 |
18 #include "IceDefs.h" | 18 #include "IceDefs.h" |
19 #include "IceCfg.h" | 19 #include "IceCfg.h" |
20 #include "IceCfgNode.h" | 20 #include "IceCfgNode.h" |
| 21 #include "IceClFlags.h" |
21 #include "IceInstX8632.h" | 22 #include "IceInstX8632.h" |
22 #include "IceOperand.h" | 23 #include "IceOperand.h" |
23 #include "IceTargetLoweringX8632.def" | 24 #include "IceTargetLoweringX8632.def" |
24 #include "IceTargetLoweringX8632.h" | 25 #include "IceTargetLoweringX8632.h" |
25 #include "llvm/ADT/DenseMap.h" | 26 #include "llvm/ADT/DenseMap.h" |
26 #include "llvm/Support/CommandLine.h" | 27 #include "llvm/Support/CommandLine.h" |
27 | 28 |
28 #include <strings.h> | 29 #include <strings.h> |
29 | 30 |
30 namespace Ice { | 31 namespace Ice { |
(...skipping 3014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3045 Variable *ValExt = Func->makeVariable(stackSlotType(), Context.getNode()); | 3046 Variable *ValExt = Func->makeVariable(stackSlotType(), Context.getNode()); |
3046 lowerCast(InstCast::create(Func, InstCast::Zext, ValExt, ValOp)); | 3047 lowerCast(InstCast::create(Func, InstCast::Zext, ValExt, ValOp)); |
3047 InstCall *Call = makeHelperCall("memset", NULL, 3); | 3048 InstCall *Call = makeHelperCall("memset", NULL, 3); |
3048 Call->addArg(Instr->getArg(0)); | 3049 Call->addArg(Instr->getArg(0)); |
3049 Call->addArg(ValExt); | 3050 Call->addArg(ValExt); |
3050 Call->addArg(Instr->getArg(2)); | 3051 Call->addArg(Instr->getArg(2)); |
3051 lowerCall(Call); | 3052 lowerCall(Call); |
3052 return; | 3053 return; |
3053 } | 3054 } |
3054 case Intrinsics::NaClReadTP: { | 3055 case Intrinsics::NaClReadTP: { |
3055 Constant *Zero = Ctx->getConstantZero(IceType_i32); | 3056 if (Ctx->getFlags().UseSandboxing) { |
3056 Operand *Src = OperandX8632Mem::create(Func, IceType_i32, NULL, Zero, NULL, | 3057 Constant *Zero = Ctx->getConstantZero(IceType_i32); |
3057 0, OperandX8632Mem::SegReg_GS); | 3058 Operand *Src = |
3058 Variable *Dest = Instr->getDest(); | 3059 OperandX8632Mem::create(Func, IceType_i32, NULL, Zero, NULL, |
3059 Variable *T = NULL; | 3060 0, OperandX8632Mem::SegReg_GS); |
3060 _mov(T, Src); | 3061 Variable *Dest = Instr->getDest(); |
3061 _mov(Dest, T); | 3062 Variable *T = NULL; |
| 3063 _mov(T, Src); |
| 3064 _mov(Dest, T); |
| 3065 } else { |
| 3066 InstCall *Call = makeHelperCall("__nacl_read_tp", Instr->getDest(), 0); |
| 3067 lowerCall(Call); |
| 3068 } |
3062 return; | 3069 return; |
3063 } | 3070 } |
3064 case Intrinsics::Setjmp: { | 3071 case Intrinsics::Setjmp: { |
3065 InstCall *Call = makeHelperCall("setjmp", Instr->getDest(), 1); | 3072 InstCall *Call = makeHelperCall("setjmp", Instr->getDest(), 1); |
3066 Call->addArg(Instr->getArg(0)); | 3073 Call->addArg(Instr->getArg(0)); |
3067 lowerCall(Call); | 3074 lowerCall(Call); |
3068 return; | 3075 return; |
3069 } | 3076 } |
3070 case Intrinsics::Sqrt: { | 3077 case Intrinsics::Sqrt: { |
3071 Operand *Src = legalize(Instr->getArg(0)); | 3078 Operand *Src = legalize(Instr->getArg(0)); |
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4376 Str << "\t.align\t" << Align << "\n"; | 4383 Str << "\t.align\t" << Align << "\n"; |
4377 Str << MangledName << ":\n"; | 4384 Str << MangledName << ":\n"; |
4378 for (SizeT i = 0; i < Size; ++i) { | 4385 for (SizeT i = 0; i < Size; ++i) { |
4379 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; | 4386 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; |
4380 } | 4387 } |
4381 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; | 4388 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; |
4382 } | 4389 } |
4383 } | 4390 } |
4384 | 4391 |
4385 } // end of namespace Ice | 4392 } // end of namespace Ice |
OLD | NEW |