Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2260)

Side by Side Diff: src/IceFixups.cpp

Issue 1616103002: Subzero. X8664. Enables RIP-based addressing mode. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: make presubmit happy. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 //===- subzero/src/IceFixups.cpp - Implementation of Assembler Fixups -----===// 1 //===- subzero/src/IceFixups.cpp - Implementation of Assembler Fixups -----===//
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 /// \file 10 /// \file
11 /// \brief Implements the AssemblerFixup class, a very basic target-independent 11 /// \brief Implements the AssemblerFixup class, a very basic target-independent
12 /// representation of a fixup or relocation. 12 /// representation of a fixup or relocation.
13 /// 13 ///
14 //===----------------------------------------------------------------------===// 14 //===----------------------------------------------------------------------===//
15 15
16 #include "IceFixups.h" 16 #include "IceFixups.h"
17 17
18 #include "IceOperand.h" 18 #include "IceOperand.h"
19 19
20 namespace Ice { 20 namespace Ice {
21 21
22 const Constant *AssemblerFixup::NullSymbol = nullptr; 22 const Constant *AssemblerFixup::NullSymbol = nullptr;
23 23
24 RelocOffsetT AssemblerFixup::offset() const { 24 RelocOffsetT AssemblerFixup::offset() const {
25 if (isNullSymbol()) 25 if (isNullSymbol())
26 return 0; 26 return addend_;
27 if (const auto *CR = llvm::dyn_cast<ConstantRelocatable>(value_)) 27 if (const auto *CR = llvm::dyn_cast<ConstantRelocatable>(value_))
28 return CR->getOffset(); 28 return CR->getOffset() + addend_;
29 return 0; 29 return addend_;
30 } 30 }
31 31
32 IceString AssemblerFixup::symbol(const GlobalContext *Ctx, 32 IceString AssemblerFixup::symbol(const GlobalContext *Ctx,
33 const Assembler *Asm) const { 33 const Assembler *Asm) const {
34 std::string Buffer; 34 std::string Buffer;
35 llvm::raw_string_ostream Str(Buffer); 35 llvm::raw_string_ostream Str(Buffer);
36 const Constant *C = value_; 36 const Constant *C = value_;
37 assert(!isNullSymbol()); 37 assert(!isNullSymbol());
38 if (const auto *CR = llvm::dyn_cast<ConstantRelocatable>(C)) { 38 if (const auto *CR = llvm::dyn_cast<ConstantRelocatable>(C)) {
39 if (CR->getSuppressMangling()) 39 if (CR->getSuppressMangling())
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 Str << "\n"; 74 Str << "\n";
75 return FixupSize; 75 return FixupSize;
76 } 76 }
77 77
78 size_t AssemblerTextFixup::emit(GlobalContext *Ctx, const Assembler &) const { 78 size_t AssemblerTextFixup::emit(GlobalContext *Ctx, const Assembler &) const {
79 Ctx->getStrEmit() << Message << "\n"; 79 Ctx->getStrEmit() << Message << "\n";
80 return NumBytes; 80 return NumBytes;
81 } 81 }
82 82
83 } // end of namespace Ice 83 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698