| OLD | NEW |
| 1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===// | 1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===// |
| 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 skeleton of the TargetLowering class, | 10 // This file implements the skeleton of the TargetLowering class, |
| 11 // specifically invoking the appropriate lowering method for a given | 11 // specifically invoking the appropriate lowering method for a given |
| 12 // instruction kind and driving global register allocation. It also | 12 // instruction kind and driving global register allocation. It also |
| 13 // implements the non-deleted instruction iteration in | 13 // implements the non-deleted instruction iteration in |
| 14 // LoweringContext. | 14 // LoweringContext. |
| 15 // | 15 // |
| 16 //===----------------------------------------------------------------------===// | 16 //===----------------------------------------------------------------------===// |
| 17 | 17 |
| 18 #include "assembler_ia32.h" |
| 18 #include "IceCfg.h" // setError() | 19 #include "IceCfg.h" // setError() |
| 19 #include "IceCfgNode.h" | 20 #include "IceCfgNode.h" |
| 20 #include "IceOperand.h" | 21 #include "IceOperand.h" |
| 21 #include "IceRegAlloc.h" | 22 #include "IceRegAlloc.h" |
| 22 #include "IceTargetLowering.h" | 23 #include "IceTargetLowering.h" |
| 23 #include "IceTargetLoweringX8632.h" | 24 #include "IceTargetLoweringX8632.h" |
| 24 | 25 |
| 25 #include "llvm/Support/CommandLine.h" | 26 #include "llvm/Support/CommandLine.h" |
| 26 | 27 |
| 27 namespace Ice { | 28 namespace Ice { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 return IceTargetX8664::create(Func); | 92 return IceTargetX8664::create(Func); |
| 92 if (Target == Target_ARM32) | 93 if (Target == Target_ARM32) |
| 93 return IceTargetARM32::create(Func); | 94 return IceTargetARM32::create(Func); |
| 94 if (Target == Target_ARM64) | 95 if (Target == Target_ARM64) |
| 95 return IceTargetARM64::create(Func); | 96 return IceTargetARM64::create(Func); |
| 96 #endif | 97 #endif |
| 97 Func->setError("Unsupported target"); | 98 Func->setError("Unsupported target"); |
| 98 return NULL; | 99 return NULL; |
| 99 } | 100 } |
| 100 | 101 |
| 102 Assembler *TargetLowering::createAssembler(TargetArch Target, Cfg *Func) { |
| 103 // These statements can be #ifdef'd to specialize the assembler |
| 104 // to a subset of the available targets. TODO: use CRTP. |
| 105 if (Target == Target_X8632) |
| 106 return new x86::AssemblerX86(); |
| 107 Func->setError("Unsupported target"); |
| 108 return NULL; |
| 109 } |
| 110 |
| 101 void TargetLowering::doAddressOpt() { | 111 void TargetLowering::doAddressOpt() { |
| 102 if (llvm::isa<InstLoad>(*Context.getCur())) | 112 if (llvm::isa<InstLoad>(*Context.getCur())) |
| 103 doAddressOptLoad(); | 113 doAddressOptLoad(); |
| 104 else if (llvm::isa<InstStore>(*Context.getCur())) | 114 else if (llvm::isa<InstStore>(*Context.getCur())) |
| 105 doAddressOptStore(); | 115 doAddressOptStore(); |
| 106 Context.advanceCur(); | 116 Context.advanceCur(); |
| 107 Context.advanceNext(); | 117 Context.advanceNext(); |
| 108 } | 118 } |
| 109 | 119 |
| 110 bool TargetLowering::shouldDoNopInsertion() const { return DoNopInsertion; } | 120 bool TargetLowering::shouldDoNopInsertion() const { return DoNopInsertion; } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 if (Target == Target_ARM64) | 252 if (Target == Target_ARM64) |
| 243 return IceTargetGlobalInitARM64::create(Ctx); | 253 return IceTargetGlobalInitARM64::create(Ctx); |
| 244 #endif | 254 #endif |
| 245 llvm_unreachable("Unsupported target"); | 255 llvm_unreachable("Unsupported target"); |
| 246 return NULL; | 256 return NULL; |
| 247 } | 257 } |
| 248 | 258 |
| 249 TargetGlobalInitLowering::~TargetGlobalInitLowering() {} | 259 TargetGlobalInitLowering::~TargetGlobalInitLowering() {} |
| 250 | 260 |
| 251 } // end of namespace Ice | 261 } // end of namespace Ice |
| OLD | NEW |