John Porto | aff4ccf | 2015-06-10 16:35:06 -0700 | [diff] [blame] | 1 | //===- subzero/src/IceAssemblerARM32.h - Assembler for ARM32 ----*- C++ -*-===// |
Jan Voung | b36ad9b | 2015-04-21 17:01:49 -0700 | [diff] [blame] | 2 | // |
| 3 | // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 4 | // for details. All rights reserved. Use of this source code is governed by a |
| 5 | // BSD-style license that can be found in the LICENSE file. |
| 6 | // |
| 7 | // Modified by the Subzero authors. |
| 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | // |
| 11 | // The Subzero Code Generator |
| 12 | // |
| 13 | // This file is distributed under the University of Illinois Open Source |
| 14 | // License. See LICENSE.TXT for details. |
| 15 | // |
| 16 | //===----------------------------------------------------------------------===// |
Andrew Scull | 9612d32 | 2015-07-06 14:53:25 -0700 | [diff] [blame] | 17 | /// |
| 18 | /// \file |
| 19 | /// This file implements the Assembler class for ARM32. |
| 20 | /// |
Jan Voung | b36ad9b | 2015-04-21 17:01:49 -0700 | [diff] [blame] | 21 | //===----------------------------------------------------------------------===// |
| 22 | |
John Porto | aff4ccf | 2015-06-10 16:35:06 -0700 | [diff] [blame] | 23 | #ifndef SUBZERO_SRC_ICEASSEMBLERARM32_H |
| 24 | #define SUBZERO_SRC_ICEASSEMBLERARM32_H |
Jan Voung | b36ad9b | 2015-04-21 17:01:49 -0700 | [diff] [blame] | 25 | |
John Porto | aff4ccf | 2015-06-10 16:35:06 -0700 | [diff] [blame] | 26 | #include "IceAssembler.h" |
Jan Voung | b36ad9b | 2015-04-21 17:01:49 -0700 | [diff] [blame] | 27 | #include "IceDefs.h" |
| 28 | #include "IceFixups.h" |
| 29 | |
Jan Voung | b36ad9b | 2015-04-21 17:01:49 -0700 | [diff] [blame] | 30 | namespace Ice { |
Jan Voung | 90ccc3f | 2015-04-30 14:15:10 -0700 | [diff] [blame] | 31 | namespace ARM32 { |
Jan Voung | b36ad9b | 2015-04-21 17:01:49 -0700 | [diff] [blame] | 32 | |
| 33 | class AssemblerARM32 : public Assembler { |
| 34 | AssemblerARM32(const AssemblerARM32 &) = delete; |
| 35 | AssemblerARM32 &operator=(const AssemblerARM32 &) = delete; |
| 36 | |
| 37 | public: |
John Porto | 2da710c | 2015-06-29 07:57:02 -0700 | [diff] [blame] | 38 | explicit AssemblerARM32(bool use_far_branches = false) |
| 39 | : Assembler(Asm_ARM32) { |
Jan Voung | b36ad9b | 2015-04-21 17:01:49 -0700 | [diff] [blame] | 40 | // This mode is only needed and implemented for MIPS and ARM. |
| 41 | assert(!use_far_branches); |
| 42 | (void)use_far_branches; |
| 43 | } |
| 44 | ~AssemblerARM32() override = default; |
| 45 | |
Jan Voung | b2d5084 | 2015-05-12 09:53:50 -0700 | [diff] [blame] | 46 | void alignFunction() override { llvm_unreachable("Not yet implemented."); } |
Jan Voung | b36ad9b | 2015-04-21 17:01:49 -0700 | [diff] [blame] | 47 | |
| 48 | SizeT getBundleAlignLog2Bytes() const override { return 4; } |
| 49 | |
Andrew Scull | 86df4e9 | 2015-07-30 13:54:44 -0700 | [diff] [blame] | 50 | const char *getAlignDirective() const override { return ".p2alignl"; } |
Jan Voung | b2d5084 | 2015-05-12 09:53:50 -0700 | [diff] [blame] | 51 | |
Jan Voung | b36ad9b | 2015-04-21 17:01:49 -0700 | [diff] [blame] | 52 | llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const override { |
Jan Voung | b2d5084 | 2015-05-12 09:53:50 -0700 | [diff] [blame] | 53 | // Use a particular UDF encoding -- TRAPNaCl in LLVM: 0xE7FEDEF0 |
| 54 | // http://llvm.org/viewvc/llvm-project?view=revision&revision=173943 |
| 55 | static const uint8_t Padding[] = {0xE7, 0xFE, 0xDE, 0xF0}; |
| 56 | return llvm::ArrayRef<uint8_t>(Padding, 4); |
Jan Voung | b36ad9b | 2015-04-21 17:01:49 -0700 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | void padWithNop(intptr_t Padding) override { |
| 60 | (void)Padding; |
Jan Voung | b2d5084 | 2015-05-12 09:53:50 -0700 | [diff] [blame] | 61 | llvm_unreachable("Not yet implemented."); |
Jan Voung | b36ad9b | 2015-04-21 17:01:49 -0700 | [diff] [blame] | 62 | } |
| 63 | |
Jan Voung | c2ec581 | 2015-08-05 09:35:18 -0700 | [diff] [blame] | 64 | Ice::Label *getCfgNodeLabel(SizeT NodeNumber) override { |
Andrew Scull | 86df4e9 | 2015-07-30 13:54:44 -0700 | [diff] [blame] | 65 | (void)NodeNumber; |
| 66 | llvm_unreachable("Not yet implemented."); |
| 67 | } |
| 68 | |
John Porto | aff4ccf | 2015-06-10 16:35:06 -0700 | [diff] [blame] | 69 | void bindCfgNodeLabel(SizeT NodeNumber) override { |
Jan Voung | b36ad9b | 2015-04-21 17:01:49 -0700 | [diff] [blame] | 70 | (void)NodeNumber; |
Jan Voung | b2d5084 | 2015-05-12 09:53:50 -0700 | [diff] [blame] | 71 | llvm_unreachable("Not yet implemented."); |
Jan Voung | b36ad9b | 2015-04-21 17:01:49 -0700 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | bool fixupIsPCRel(FixupKind Kind) const override { |
| 75 | (void)Kind; |
Jan Voung | b2d5084 | 2015-05-12 09:53:50 -0700 | [diff] [blame] | 76 | llvm_unreachable("Not yet implemented."); |
Jan Voung | b36ad9b | 2015-04-21 17:01:49 -0700 | [diff] [blame] | 77 | } |
John Porto | 2da710c | 2015-06-29 07:57:02 -0700 | [diff] [blame] | 78 | |
| 79 | static bool classof(const Assembler *Asm) { |
| 80 | return Asm->getKind() == Asm_ARM32; |
| 81 | } |
Jan Voung | b36ad9b | 2015-04-21 17:01:49 -0700 | [diff] [blame] | 82 | }; |
| 83 | |
Jan Voung | 90ccc3f | 2015-04-30 14:15:10 -0700 | [diff] [blame] | 84 | } // end of namespace ARM32 |
Jan Voung | b36ad9b | 2015-04-21 17:01:49 -0700 | [diff] [blame] | 85 | } // end of namespace Ice |
| 86 | |
John Porto | aff4ccf | 2015-06-10 16:35:06 -0700 | [diff] [blame] | 87 | #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H |