Changeset 221954 in webkit for trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp
- Timestamp:
- Sep 12, 2017, 6:31:07 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp
r220823 r221954 70 70 namespace JSC { namespace B3 { 71 71 72 using namespace Air;73 74 72 namespace { 75 73 76 const bool verbose = false; 74 namespace B3LowerToAirInternal { 75 static const bool verbose = false; 76 } 77 78 using Arg = Air::Arg; 79 using Inst = Air::Inst; 80 using Code = Air::Code; 81 using Tmp = Air::Tmp; 77 82 78 83 // FIXME: We wouldn't need this if Air supported Width modifiers in Air::Kind. 79 84 // https://bugs.webkit.org/show_bug.cgi?id=169247 80 85 #define OPCODE_FOR_WIDTH(opcode, width) ( \ 81 (width) == Width8 ? opcode ## 8 : \82 (width) == Width16 ? opcode ## 16 :\83 (width) == Width32 ? opcode ## 32 :\84 opcode ## 64)86 (width) == Width8 ? Air::opcode ## 8 : \ 87 (width) == Width16 ? Air::opcode ## 16 : \ 88 (width) == Width32 ? Air::opcode ## 32 : \ 89 Air::opcode ## 64) 85 90 #define OPCODE_FOR_CANONICAL_WIDTH(opcode, width) ( \ 86 (width) == Width64 ? opcode ## 64 :opcode ## 32)91 (width) == Width64 ? Air::opcode ## 64 : Air::opcode ## 32) 87 92 88 93 class LowerToAir { … … 108 113 void run() 109 114 { 115 using namespace Air; 110 116 for (B3::BasicBlock* block : m_procedure) 111 117 m_blockToBlock[block] = m_code.addBlock(block->frequency()); … … 115 121 case Phi: { 116 122 m_phiToTmp[value] = m_code.newTmp(value->resultBank()); 117 if ( verbose)123 if (B3LowerToAirInternal::verbose) 118 124 dataLog("Phi tmp for ", *value, ": ", m_phiToTmp[value], "\n"); 119 125 break; … … 147 153 m_isRare = !m_fastWorklist.saw(block); 148 154 149 if ( verbose)155 if (B3LowerToAirInternal::verbose) 150 156 dataLog("Lowering Block ", *block, ":\n"); 151 157 … … 164 170 continue; 165 171 m_insts.append(Vector<Inst>()); 166 if ( verbose)172 if (B3LowerToAirInternal::verbose) 167 173 dataLog("Lowering ", deepDump(m_procedure, m_value), ":\n"); 168 174 lower(); 169 if ( verbose) {175 if (B3LowerToAirInternal::verbose) { 170 176 for (Inst& inst : m_insts.last()) 171 177 dataLog(" ", inst, "\n"); … … 380 386 if (m_procedure.isFastConstant(value->key())) 381 387 m_code.addFastTmp(realTmp); 382 if ( verbose)388 if (B3LowerToAirInternal::verbose) 383 389 dataLog("Tmp for ", *value, ": ", realTmp, "\n"); 384 390 } … … 907 913 void appendShift(Value* value, Value* amount) 908 914 { 915 using namespace Air; 909 916 Air::Opcode opcode = opcodeForType(opcode32, opcode64, value->type()); 910 917 … … 1020 1027 Inst createStore(Air::Kind move, Value* value, const Arg& dest) 1021 1028 { 1029 using namespace Air; 1022 1030 if (auto imm_value = imm(value)) { 1023 1031 if (isARM64() && imm_value.value() == 0) { … … 1044 1052 Air::Opcode storeOpcode(Width width, Bank bank) 1045 1053 { 1054 using namespace Air; 1046 1055 switch (width) { 1047 1056 case Width8: … … 1074 1083 void appendStore(Value* value, const Arg& dest) 1075 1084 { 1085 using namespace Air; 1076 1086 MemoryValue* memory = value->as<MemoryValue>(); 1077 1087 RELEASE_ASSERT(memory->isStore()); … … 1101 1111 Air::Opcode moveForType(Type type) 1102 1112 { 1113 using namespace Air; 1103 1114 switch (type) { 1104 1115 case Int32: … … 1120 1131 Air::Opcode relaxedMoveForType(Type type) 1121 1132 { 1133 using namespace Air; 1122 1134 switch (type) { 1123 1135 case Int32: … … 1163 1175 { 1164 1176 auto printList = Printer::makePrintRecordList(arguments...); 1165 auto printSpecial = static_cast< PrintSpecial*>(m_code.addSpecial(std::make_unique<PrintSpecial>(printList)));1166 Inst inst( Patch, origin, Arg::special(printSpecial));1177 auto printSpecial = static_cast<Air::PrintSpecial*>(m_code.addSpecial(std::make_unique<Air::PrintSpecial>(printList))); 1178 Inst inst(Air::Patch, origin, Arg::special(printSpecial)); 1167 1179 Printer::appendAirArgs(inst, std::forward<Arguments>(arguments)...); 1168 1180 append(WTFMove(inst)); … … 1763 1775 Inst createBranch(Value* value, bool inverted = false) 1764 1776 { 1777 using namespace Air; 1765 1778 return createGenericCompare( 1766 1779 value, … … 1846 1859 Inst createCompare(Value* value, bool inverted = false) 1847 1860 { 1861 using namespace Air; 1848 1862 return createGenericCompare( 1849 1863 value, … … 1925 1939 Inst createSelect(const MoveConditionallyConfig& config) 1926 1940 { 1941 using namespace Air; 1927 1942 auto createSelectInstruction = [&] (Air::Opcode opcode, const Arg& condition, ArgPromise& left, ArgPromise& right) -> Inst { 1928 1943 if (isValidForm(opcode, condition.kind(), left.kind(), right.kind(), Arg::Tmp, Arg::Tmp, Arg::Tmp)) { … … 1988 2003 bool tryAppendLea() 1989 2004 { 2005 using namespace Air; 1990 2006 Air::Opcode leaOpcode = tryOpcodeForType(Lea32, Lea64, m_value->type()); 1991 2007 if (!isValidForm(leaOpcode, Arg::Index, Arg::Tmp)) … … 2117 2133 void appendX86Div(B3::Opcode op) 2118 2134 { 2135 using namespace Air; 2119 2136 Air::Opcode convertToDoubleWord; 2120 2137 Air::Opcode div; … … 2144 2161 void appendX86UDiv(B3::Opcode op) 2145 2162 { 2163 using namespace Air; 2146 2164 Air::Opcode div = m_value->type() == Int32 ? X86UDiv32 : X86UDiv64; 2147 2165 … … 2179 2197 void appendCAS(Value* atomicValue, bool invert) 2180 2198 { 2199 using namespace Air; 2181 2200 AtomicValue* atomic = atomicValue->as<AtomicValue>(); 2182 2201 RELEASE_ASSERT(atomic); … … 2341 2360 void appendGeneralAtomic(Air::Opcode opcode, Commutativity commutativity = NotCommutative) 2342 2361 { 2362 using namespace Air; 2343 2363 AtomicValue* atomic = m_value->as<AtomicValue>(); 2344 2364 … … 2425 2445 void lower() 2426 2446 { 2447 using namespace Air; 2427 2448 switch (m_value->opcode()) { 2428 2449 case B3::Nop: {
Note:
See TracChangeset
for help on using the changeset viewer.