| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 return IceTargetX8664::create(Func); | 91 return IceTargetX8664::create(Func); |
| 91 if (Target == Target_ARM32) | 92 if (Target == Target_ARM32) |
| 92 return IceTargetARM32::create(Func); | 93 return IceTargetARM32::create(Func); |
| 93 if (Target == Target_ARM64) | 94 if (Target == Target_ARM64) |
| 94 return IceTargetARM64::create(Func); | 95 return IceTargetARM64::create(Func); |
| 95 #endif | 96 #endif |
| 96 Func->setError("Unsupported target"); | 97 Func->setError("Unsupported target"); |
| 97 return NULL; | 98 return NULL; |
| 98 } | 99 } |
| 99 | 100 |
| 101 Assembler *TargetLowering::createAssembler(TargetArch Target, Cfg *Func) { |
| 102 // These statements can be #ifdef'd to specialize the assembler |
| 103 // to a subset of the available targets. TODO: use CRTP. |
| 104 if (Target == Target_X8632) |
| 105 return new x86::AssemblerX86(); |
| 106 Func->setError("Unsupported target"); |
| 107 return NULL; |
| 108 } |
| 109 |
| 100 void TargetLowering::doAddressOpt() { | 110 void TargetLowering::doAddressOpt() { |
| 101 if (llvm::isa<InstLoad>(*Context.getCur())) | 111 if (llvm::isa<InstLoad>(*Context.getCur())) |
| 102 doAddressOptLoad(); | 112 doAddressOptLoad(); |
| 103 else if (llvm::isa<InstStore>(*Context.getCur())) | 113 else if (llvm::isa<InstStore>(*Context.getCur())) |
| 104 doAddressOptStore(); | 114 doAddressOptStore(); |
| 105 Context.advanceCur(); | 115 Context.advanceCur(); |
| 106 Context.advanceNext(); | 116 Context.advanceNext(); |
| 107 } | 117 } |
| 108 | 118 |
| 109 bool TargetLowering::shouldDoNopInsertion() const { return DoNopInsertion; } | 119 bool TargetLowering::shouldDoNopInsertion() const { return DoNopInsertion; } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 if (Target == Target_ARM64) | 255 if (Target == Target_ARM64) |
| 246 return IceTargetGlobalInitARM64::create(Ctx); | 256 return IceTargetGlobalInitARM64::create(Ctx); |
| 247 #endif | 257 #endif |
| 248 llvm_unreachable("Unsupported target"); | 258 llvm_unreachable("Unsupported target"); |
| 249 return NULL; | 259 return NULL; |
| 250 } | 260 } |
| 251 | 261 |
| 252 TargetGlobalInitLowering::~TargetGlobalInitLowering() {} | 262 TargetGlobalInitLowering::~TargetGlobalInitLowering() {} |
| 253 | 263 |
| 254 } // end of namespace Ice | 264 } // end of namespace Ice |
| OLD | NEW |