mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Use forward declarations and move TargetELFWriterInfo impl to a new file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73209 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
33
lib/Target/TargetELFWriterInfo.cpp
Normal file
33
lib/Target/TargetELFWriterInfo.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
//===-- lib/Target/TargetELFWriterInfo.cpp - ELF Writer Info --0-*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the TargetELFWriterInfo class.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/Target/TargetELFWriterInfo.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
using namespace llvm;
|
||||
|
||||
TargetELFWriterInfo::TargetELFWriterInfo(TargetMachine &tm) : TM(tm) {}
|
||||
|
||||
TargetELFWriterInfo::~TargetELFWriterInfo() {}
|
||||
|
||||
/// getFunctionAlignment - Returns the alignment for function 'F', targets
|
||||
/// with different alignment constraints should overload this method
|
||||
unsigned TargetELFWriterInfo::getFunctionAlignment(const Function *F) const {
|
||||
const TargetData *TD = TM.getTargetData();
|
||||
unsigned FnAlign = F->getAlignment();
|
||||
unsigned TDAlign = TD->getPointerABIAlignment();
|
||||
unsigned Align = std::max(FnAlign, TDAlign);
|
||||
assert(!(Align & (Align-1)) && "Alignment is not a power of two!");
|
||||
return Align;
|
||||
}
|
Reference in New Issue
Block a user