Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceTargetLoweringARM32.cpp - ARM32 lowering ------------===// | 1 //===- subzero/src/IceTargetLoweringARM32.cpp - ARM32 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 TargetLoweringARM32 class, which consists almost | 10 // This file implements the TargetLoweringARM32 class, which consists almost |
| (...skipping 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1918 Variable *ValueR = legalizeToVar(Value); | 1918 Variable *ValueR = legalizeToVar(Value); |
| 1919 _str(ValueR, NewAddr); | 1919 _str(ValueR, NewAddr); |
| 1920 } | 1920 } |
| 1921 } | 1921 } |
| 1922 | 1922 |
| 1923 void TargetARM32::doAddressOptStore() { | 1923 void TargetARM32::doAddressOptStore() { |
| 1924 UnimplementedError(Func->getContext()->getFlags()); | 1924 UnimplementedError(Func->getContext()->getFlags()); |
| 1925 } | 1925 } |
| 1926 | 1926 |
| 1927 void TargetARM32::lowerSwitch(const InstSwitch *Inst) { | 1927 void TargetARM32::lowerSwitch(const InstSwitch *Inst) { |
| 1928 (void)Inst; | 1928 // This implements the most naive possible lowering. |
| 1929 UnimplementedError(Func->getContext()->getFlags()); | 1929 // cmp a,val[0]; jeq label[0]; cmp a,val[1]; jeq label[1]; ... jmp default |
| 1930 Operand *Src0 = Inst->getComparison(); | |
| 1931 SizeT NumCases = Inst->getNumCases(); | |
| 1932 if (Src0->getType() == IceType_i64) { | |
| 1933 Variable *Src0Lo = legalizeToVar(loOperand(Src0)); | |
|
jvoung (off chromium)
2015/06/25 21:24:50
Hmm maybe why the X86 version had "legalize(Src0);
jvoung (off chromium)
2015/06/29 16:51:47
Well, there are other places in the ARM code which
ascull
2015/06/29 17:00:03
Done.
| |
| 1934 Variable *Src0Hi = legalizeToVar(hiOperand(Src0)); | |
| 1935 for (SizeT I = 0; I < NumCases; ++I) { | |
| 1936 Operand *ValueLo = Ctx->getConstantInt32(Inst->getValue(I)); | |
| 1937 Operand *ValueHi = Ctx->getConstantInt32(Inst->getValue(I) >> 32); | |
| 1938 ValueLo = legalize(ValueLo, Legal_Reg | Legal_Flex); | |
| 1939 ValueHi = legalize(ValueHi, Legal_Reg | Legal_Flex); | |
| 1940 _cmp(Src0Lo, ValueLo); | |
| 1941 _cmp(Src0Hi, ValueHi, CondARM32::EQ); | |
|
jvoung (off chromium)
2015/06/25 21:24:50
nice, use that predication =)
| |
| 1942 _br(Inst->getLabel(I), CondARM32::EQ); | |
| 1943 } | |
| 1944 _br(Inst->getLabelDefault()); | |
| 1945 return; | |
| 1946 } | |
| 1947 | |
| 1948 // 32 bit integer | |
| 1949 Variable *Src0Var = legalizeToVar(Src0); | |
| 1950 for (SizeT I = 0; I < NumCases; ++I) { | |
| 1951 Operand *Value = Ctx->getConstantInt32(Inst->getValue(I)); | |
| 1952 Value = legalize(Value, Legal_Reg | Legal_Flex); | |
| 1953 _cmp(Src0Var, Value); | |
| 1954 _br(Inst->getLabel(I), CondARM32::EQ); | |
| 1955 } | |
| 1956 _br(Inst->getLabelDefault()); | |
| 1930 } | 1957 } |
| 1931 | 1958 |
| 1932 void TargetARM32::lowerUnreachable(const InstUnreachable * /*Inst*/) { | 1959 void TargetARM32::lowerUnreachable(const InstUnreachable * /*Inst*/) { |
| 1933 UnimplementedError(Func->getContext()->getFlags()); | 1960 UnimplementedError(Func->getContext()->getFlags()); |
| 1934 } | 1961 } |
| 1935 | 1962 |
| 1936 // Turn an i64 Phi instruction into a pair of i32 Phi instructions, to | 1963 // Turn an i64 Phi instruction into a pair of i32 Phi instructions, to |
| 1937 // preserve integrity of liveness analysis. Undef values are also | 1964 // preserve integrity of liveness analysis. Undef values are also |
| 1938 // turned into zeroes, since loOperand() and hiOperand() don't expect | 1965 // turned into zeroes, since loOperand() and hiOperand() don't expect |
| 1939 // Undef input. | 1966 // Undef input. |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2266 << ".eabi_attribute 36, 1 @ Tag_FP_HP_extension\n" | 2293 << ".eabi_attribute 36, 1 @ Tag_FP_HP_extension\n" |
| 2267 << ".eabi_attribute 38, 1 @ Tag_ABI_FP_16bit_format\n" | 2294 << ".eabi_attribute 38, 1 @ Tag_ABI_FP_16bit_format\n" |
| 2268 << ".eabi_attribute 42, 1 @ Tag_MPextension_use\n" | 2295 << ".eabi_attribute 42, 1 @ Tag_MPextension_use\n" |
| 2269 << ".eabi_attribute 68, 1 @ Tag_Virtualization_use\n"; | 2296 << ".eabi_attribute 68, 1 @ Tag_Virtualization_use\n"; |
| 2270 // Technically R9 is used for TLS with Sandboxing, and we reserve it. | 2297 // Technically R9 is used for TLS with Sandboxing, and we reserve it. |
| 2271 // However, for compatibility with current NaCl LLVM, don't claim that. | 2298 // However, for compatibility with current NaCl LLVM, don't claim that. |
| 2272 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; | 2299 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; |
| 2273 } | 2300 } |
| 2274 | 2301 |
| 2275 } // end of namespace Ice | 2302 } // end of namespace Ice |
| OLD | NEW |