mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
Move TargetData to DataLayout.
llvm-svn: 165403
This commit is contained in:
parent
bb1a25cd67
commit
fe3338a7eb
@ -83,8 +83,8 @@ module ExecutionEngine = struct
|
|||||||
external free_machine_code: Llvm.llvalue -> t -> unit
|
external free_machine_code: Llvm.llvalue -> t -> unit
|
||||||
= "llvm_ee_free_machine_code"
|
= "llvm_ee_free_machine_code"
|
||||||
|
|
||||||
external target_data: t -> Llvm_target.TargetData.t
|
external target_data: t -> Llvm_target.DataLayout.t
|
||||||
= "LLVMGetExecutionEngineTargetData"
|
= "LLVMGetExecutionEngineDataLayout"
|
||||||
|
|
||||||
(* The following are not bound. Patches are welcome.
|
(* The following are not bound. Patches are welcome.
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ module ExecutionEngine: sig
|
|||||||
|
|
||||||
(** [target_data ee] is the target data owned by the execution engine
|
(** [target_data ee] is the target data owned by the execution engine
|
||||||
[ee]. *)
|
[ee]. *)
|
||||||
val target_data : t -> Llvm_target.TargetData.t
|
val target_data : t -> Llvm_target.DataLayout.t
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -375,7 +375,7 @@ val module_context : llmodule -> llcontext
|
|||||||
val classify_type : lltype -> TypeKind.t
|
val classify_type : lltype -> TypeKind.t
|
||||||
|
|
||||||
(** [type_is_sized ty] returns whether the type has a size or not.
|
(** [type_is_sized ty] returns whether the type has a size or not.
|
||||||
* If it doesn't then it is not safe to call the [TargetData::] methods on it.
|
* If it doesn't then it is not safe to call the [DataLayout::] methods on it.
|
||||||
* *)
|
* *)
|
||||||
val type_is_sized : lltype -> bool
|
val type_is_sized : lltype -> bool
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ module Endian = struct
|
|||||||
| Little
|
| Little
|
||||||
end
|
end
|
||||||
|
|
||||||
module TargetData = struct
|
module DataLayout = struct
|
||||||
type t
|
type t
|
||||||
|
|
||||||
external create : string -> t = "llvm_targetdata_create"
|
external create : string -> t = "llvm_targetdata_create"
|
||||||
@ -23,20 +23,20 @@ module TargetData = struct
|
|||||||
external dispose : t -> unit = "llvm_targetdata_dispose"
|
external dispose : t -> unit = "llvm_targetdata_dispose"
|
||||||
end
|
end
|
||||||
|
|
||||||
external byte_order : TargetData.t -> Endian.t = "llvm_byte_order"
|
external byte_order : DataLayout.t -> Endian.t = "llvm_byte_order"
|
||||||
external pointer_size : TargetData.t -> int = "llvm_pointer_size"
|
external pointer_size : DataLayout.t -> int = "llvm_pointer_size"
|
||||||
external intptr_type : TargetData.t -> Llvm.lltype = "LLVMIntPtrType"
|
external intptr_type : DataLayout.t -> Llvm.lltype = "LLVMIntPtrType"
|
||||||
external size_in_bits : TargetData.t -> Llvm.lltype -> Int64.t
|
external size_in_bits : DataLayout.t -> Llvm.lltype -> Int64.t
|
||||||
= "llvm_size_in_bits"
|
= "llvm_size_in_bits"
|
||||||
external store_size : TargetData.t -> Llvm.lltype -> Int64.t = "llvm_store_size"
|
external store_size : DataLayout.t -> Llvm.lltype -> Int64.t = "llvm_store_size"
|
||||||
external abi_size : TargetData.t -> Llvm.lltype -> Int64.t = "llvm_abi_size"
|
external abi_size : DataLayout.t -> Llvm.lltype -> Int64.t = "llvm_abi_size"
|
||||||
external abi_align : TargetData.t -> Llvm.lltype -> int = "llvm_abi_align"
|
external abi_align : DataLayout.t -> Llvm.lltype -> int = "llvm_abi_align"
|
||||||
external stack_align : TargetData.t -> Llvm.lltype -> int = "llvm_stack_align"
|
external stack_align : DataLayout.t -> Llvm.lltype -> int = "llvm_stack_align"
|
||||||
external preferred_align : TargetData.t -> Llvm.lltype -> int
|
external preferred_align : DataLayout.t -> Llvm.lltype -> int
|
||||||
= "llvm_preferred_align"
|
= "llvm_preferred_align"
|
||||||
external preferred_align_of_global : TargetData.t -> Llvm.llvalue -> int
|
external preferred_align_of_global : DataLayout.t -> Llvm.llvalue -> int
|
||||||
= "llvm_preferred_align_of_global"
|
= "llvm_preferred_align_of_global"
|
||||||
external element_at_offset : TargetData.t -> Llvm.lltype -> Int64.t -> int
|
external element_at_offset : DataLayout.t -> Llvm.lltype -> Int64.t -> int
|
||||||
= "llvm_element_at_offset"
|
= "llvm_element_at_offset"
|
||||||
external offset_of_element : TargetData.t -> Llvm.lltype -> int -> Int64.t
|
external offset_of_element : DataLayout.t -> Llvm.lltype -> int -> Int64.t
|
||||||
= "llvm_offset_of_element"
|
= "llvm_offset_of_element"
|
||||||
|
@ -18,11 +18,11 @@ module Endian : sig
|
|||||||
| Little
|
| Little
|
||||||
end
|
end
|
||||||
|
|
||||||
module TargetData : sig
|
module DataLayout : sig
|
||||||
type t
|
type t
|
||||||
|
|
||||||
(** [TargetData.create rep] parses the target data string representation [rep].
|
(** [DataLayout.create rep] parses the target data string representation [rep].
|
||||||
See the constructor llvm::TargetData::TargetData. *)
|
See the constructor llvm::DataLayout::DataLayout. *)
|
||||||
external create : string -> t = "llvm_targetdata_create"
|
external create : string -> t = "llvm_targetdata_create"
|
||||||
|
|
||||||
(** [add_target_data td pm] adds the target data [td] to the pass manager [pm].
|
(** [add_target_data td pm] adds the target data [td] to the pass manager [pm].
|
||||||
@ -32,64 +32,64 @@ module TargetData : sig
|
|||||||
= "llvm_targetdata_add"
|
= "llvm_targetdata_add"
|
||||||
|
|
||||||
(** [as_string td] is the string representation of the target data [td].
|
(** [as_string td] is the string representation of the target data [td].
|
||||||
See the constructor llvm::TargetData::TargetData. *)
|
See the constructor llvm::DataLayout::DataLayout. *)
|
||||||
external as_string : t -> string = "llvm_targetdata_as_string"
|
external as_string : t -> string = "llvm_targetdata_as_string"
|
||||||
|
|
||||||
(** Deallocates a TargetData.
|
(** Deallocates a DataLayout.
|
||||||
See the destructor llvm::TargetData::~TargetData. *)
|
See the destructor llvm::DataLayout::~DataLayout. *)
|
||||||
external dispose : t -> unit = "llvm_targetdata_dispose"
|
external dispose : t -> unit = "llvm_targetdata_dispose"
|
||||||
end
|
end
|
||||||
|
|
||||||
(** Returns the byte order of a target, either LLVMBigEndian or
|
(** Returns the byte order of a target, either LLVMBigEndian or
|
||||||
LLVMLittleEndian.
|
LLVMLittleEndian.
|
||||||
See the method llvm::TargetData::isLittleEndian. *)
|
See the method llvm::DataLayout::isLittleEndian. *)
|
||||||
external byte_order : TargetData.t -> Endian.t = "llvm_byte_order"
|
external byte_order : DataLayout.t -> Endian.t = "llvm_byte_order"
|
||||||
|
|
||||||
(** Returns the pointer size in bytes for a target.
|
(** Returns the pointer size in bytes for a target.
|
||||||
See the method llvm::TargetData::getPointerSize. *)
|
See the method llvm::DataLayout::getPointerSize. *)
|
||||||
external pointer_size : TargetData.t -> int = "llvm_pointer_size"
|
external pointer_size : DataLayout.t -> int = "llvm_pointer_size"
|
||||||
|
|
||||||
(** Returns the integer type that is the same size as a pointer on a target.
|
(** Returns the integer type that is the same size as a pointer on a target.
|
||||||
See the method llvm::TargetData::getIntPtrType. *)
|
See the method llvm::DataLayout::getIntPtrType. *)
|
||||||
external intptr_type : TargetData.t -> Llvm.lltype = "LLVMIntPtrType"
|
external intptr_type : DataLayout.t -> Llvm.lltype = "LLVMIntPtrType"
|
||||||
|
|
||||||
(** Computes the size of a type in bytes for a target.
|
(** Computes the size of a type in bytes for a target.
|
||||||
See the method llvm::TargetData::getTypeSizeInBits. *)
|
See the method llvm::DataLayout::getTypeSizeInBits. *)
|
||||||
external size_in_bits : TargetData.t -> Llvm.lltype -> Int64.t
|
external size_in_bits : DataLayout.t -> Llvm.lltype -> Int64.t
|
||||||
= "llvm_size_in_bits"
|
= "llvm_size_in_bits"
|
||||||
|
|
||||||
(** Computes the storage size of a type in bytes for a target.
|
(** Computes the storage size of a type in bytes for a target.
|
||||||
See the method llvm::TargetData::getTypeStoreSize. *)
|
See the method llvm::DataLayout::getTypeStoreSize. *)
|
||||||
external store_size : TargetData.t -> Llvm.lltype -> Int64.t = "llvm_store_size"
|
external store_size : DataLayout.t -> Llvm.lltype -> Int64.t = "llvm_store_size"
|
||||||
|
|
||||||
(** Computes the ABI size of a type in bytes for a target.
|
(** Computes the ABI size of a type in bytes for a target.
|
||||||
See the method llvm::TargetData::getTypeAllocSize. *)
|
See the method llvm::DataLayout::getTypeAllocSize. *)
|
||||||
external abi_size : TargetData.t -> Llvm.lltype -> Int64.t = "llvm_abi_size"
|
external abi_size : DataLayout.t -> Llvm.lltype -> Int64.t = "llvm_abi_size"
|
||||||
|
|
||||||
(** Computes the ABI alignment of a type in bytes for a target.
|
(** Computes the ABI alignment of a type in bytes for a target.
|
||||||
See the method llvm::TargetData::getTypeABISize. *)
|
See the method llvm::DataLayout::getTypeABISize. *)
|
||||||
external abi_align : TargetData.t -> Llvm.lltype -> int = "llvm_abi_align"
|
external abi_align : DataLayout.t -> Llvm.lltype -> int = "llvm_abi_align"
|
||||||
|
|
||||||
(** Computes the call frame alignment of a type in bytes for a target.
|
(** Computes the call frame alignment of a type in bytes for a target.
|
||||||
See the method llvm::TargetData::getTypeABISize. *)
|
See the method llvm::DataLayout::getTypeABISize. *)
|
||||||
external stack_align : TargetData.t -> Llvm.lltype -> int = "llvm_stack_align"
|
external stack_align : DataLayout.t -> Llvm.lltype -> int = "llvm_stack_align"
|
||||||
|
|
||||||
(** Computes the preferred alignment of a type in bytes for a target.
|
(** Computes the preferred alignment of a type in bytes for a target.
|
||||||
See the method llvm::TargetData::getTypeABISize. *)
|
See the method llvm::DataLayout::getTypeABISize. *)
|
||||||
external preferred_align : TargetData.t -> Llvm.lltype -> int
|
external preferred_align : DataLayout.t -> Llvm.lltype -> int
|
||||||
= "llvm_preferred_align"
|
= "llvm_preferred_align"
|
||||||
|
|
||||||
(** Computes the preferred alignment of a global variable in bytes for a target.
|
(** Computes the preferred alignment of a global variable in bytes for a target.
|
||||||
See the method llvm::TargetData::getPreferredAlignment. *)
|
See the method llvm::DataLayout::getPreferredAlignment. *)
|
||||||
external preferred_align_of_global : TargetData.t -> Llvm.llvalue -> int
|
external preferred_align_of_global : DataLayout.t -> Llvm.llvalue -> int
|
||||||
= "llvm_preferred_align_of_global"
|
= "llvm_preferred_align_of_global"
|
||||||
|
|
||||||
(** Computes the structure element that contains the byte offset for a target.
|
(** Computes the structure element that contains the byte offset for a target.
|
||||||
See the method llvm::StructLayout::getElementContainingOffset. *)
|
See the method llvm::StructLayout::getElementContainingOffset. *)
|
||||||
external element_at_offset : TargetData.t -> Llvm.lltype -> Int64.t -> int
|
external element_at_offset : DataLayout.t -> Llvm.lltype -> Int64.t -> int
|
||||||
= "llvm_element_at_offset"
|
= "llvm_element_at_offset"
|
||||||
|
|
||||||
(** Computes the byte offset of the indexed struct element for a target.
|
(** Computes the byte offset of the indexed struct element for a target.
|
||||||
See the method llvm::StructLayout::getElementContainingOffset. *)
|
See the method llvm::StructLayout::getElementContainingOffset. *)
|
||||||
external offset_of_element : TargetData.t -> Llvm.lltype -> int -> Int64.t
|
external offset_of_element : DataLayout.t -> Llvm.lltype -> int -> Int64.t
|
||||||
= "llvm_offset_of_element"
|
= "llvm_offset_of_element"
|
||||||
|
@ -18,85 +18,85 @@
|
|||||||
#include "llvm-c/Target.h"
|
#include "llvm-c/Target.h"
|
||||||
#include "caml/alloc.h"
|
#include "caml/alloc.h"
|
||||||
|
|
||||||
/* string -> TargetData.t */
|
/* string -> DataLayout.t */
|
||||||
CAMLprim LLVMTargetDataRef llvm_targetdata_create(value StringRep) {
|
CAMLprim LLVMDataLayoutRef llvm_targetdata_create(value StringRep) {
|
||||||
return LLVMCreateTargetData(String_val(StringRep));
|
return LLVMCreateDataLayout(String_val(StringRep));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TargetData.t -> [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
|
/* DataLayout.t -> [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
|
||||||
CAMLprim value llvm_targetdata_add(LLVMTargetDataRef TD, LLVMPassManagerRef PM){
|
CAMLprim value llvm_targetdata_add(LLVMDataLayoutRef TD, LLVMPassManagerRef PM){
|
||||||
LLVMAddTargetData(TD, PM);
|
LLVMAddDataLayout(TD, PM);
|
||||||
return Val_unit;
|
return Val_unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TargetData.t -> string */
|
/* DataLayout.t -> string */
|
||||||
CAMLprim value llvm_targetdata_as_string(LLVMTargetDataRef TD) {
|
CAMLprim value llvm_targetdata_as_string(LLVMDataLayoutRef TD) {
|
||||||
char *StringRep = LLVMCopyStringRepOfTargetData(TD);
|
char *StringRep = LLVMCopyStringRepOfDataLayout(TD);
|
||||||
value Copy = copy_string(StringRep);
|
value Copy = copy_string(StringRep);
|
||||||
LLVMDisposeMessage(StringRep);
|
LLVMDisposeMessage(StringRep);
|
||||||
return Copy;
|
return Copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TargetData.t -> unit */
|
/* DataLayout.t -> unit */
|
||||||
CAMLprim value llvm_targetdata_dispose(LLVMTargetDataRef TD) {
|
CAMLprim value llvm_targetdata_dispose(LLVMDataLayoutRef TD) {
|
||||||
LLVMDisposeTargetData(TD);
|
LLVMDisposeDataLayout(TD);
|
||||||
return Val_unit;
|
return Val_unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TargetData.t -> Endian.t */
|
/* DataLayout.t -> Endian.t */
|
||||||
CAMLprim value llvm_byte_order(LLVMTargetDataRef TD) {
|
CAMLprim value llvm_byte_order(LLVMDataLayoutRef TD) {
|
||||||
return Val_int(LLVMByteOrder(TD));
|
return Val_int(LLVMByteOrder(TD));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TargetData.t -> int */
|
/* DataLayout.t -> int */
|
||||||
CAMLprim value llvm_pointer_size(LLVMTargetDataRef TD) {
|
CAMLprim value llvm_pointer_size(LLVMDataLayoutRef TD) {
|
||||||
return Val_int(LLVMPointerSize(TD));
|
return Val_int(LLVMPointerSize(TD));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.lltype -> Int64.t */
|
/* DataLayout.t -> Llvm.lltype -> Int64.t */
|
||||||
CAMLprim value llvm_size_in_bits(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
|
CAMLprim value llvm_size_in_bits(LLVMDataLayoutRef TD, LLVMTypeRef Ty) {
|
||||||
return caml_copy_int64(LLVMSizeOfTypeInBits(TD, Ty));
|
return caml_copy_int64(LLVMSizeOfTypeInBits(TD, Ty));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.lltype -> Int64.t */
|
/* DataLayout.t -> Llvm.lltype -> Int64.t */
|
||||||
CAMLprim value llvm_store_size(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
|
CAMLprim value llvm_store_size(LLVMDataLayoutRef TD, LLVMTypeRef Ty) {
|
||||||
return caml_copy_int64(LLVMStoreSizeOfType(TD, Ty));
|
return caml_copy_int64(LLVMStoreSizeOfType(TD, Ty));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.lltype -> Int64.t */
|
/* DataLayout.t -> Llvm.lltype -> Int64.t */
|
||||||
CAMLprim value llvm_abi_size(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
|
CAMLprim value llvm_abi_size(LLVMDataLayoutRef TD, LLVMTypeRef Ty) {
|
||||||
return caml_copy_int64(LLVMABISizeOfType(TD, Ty));
|
return caml_copy_int64(LLVMABISizeOfType(TD, Ty));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.lltype -> int */
|
/* DataLayout.t -> Llvm.lltype -> int */
|
||||||
CAMLprim value llvm_abi_align(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
|
CAMLprim value llvm_abi_align(LLVMDataLayoutRef TD, LLVMTypeRef Ty) {
|
||||||
return Val_int(LLVMABIAlignmentOfType(TD, Ty));
|
return Val_int(LLVMABIAlignmentOfType(TD, Ty));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.lltype -> int */
|
/* DataLayout.t -> Llvm.lltype -> int */
|
||||||
CAMLprim value llvm_stack_align(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
|
CAMLprim value llvm_stack_align(LLVMDataLayoutRef TD, LLVMTypeRef Ty) {
|
||||||
return Val_int(LLVMCallFrameAlignmentOfType(TD, Ty));
|
return Val_int(LLVMCallFrameAlignmentOfType(TD, Ty));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.lltype -> int */
|
/* DataLayout.t -> Llvm.lltype -> int */
|
||||||
CAMLprim value llvm_preferred_align(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
|
CAMLprim value llvm_preferred_align(LLVMDataLayoutRef TD, LLVMTypeRef Ty) {
|
||||||
return Val_int(LLVMPreferredAlignmentOfType(TD, Ty));
|
return Val_int(LLVMPreferredAlignmentOfType(TD, Ty));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.llvalue -> int */
|
/* DataLayout.t -> Llvm.llvalue -> int */
|
||||||
CAMLprim value llvm_preferred_align_of_global(LLVMTargetDataRef TD,
|
CAMLprim value llvm_preferred_align_of_global(LLVMDataLayoutRef TD,
|
||||||
LLVMValueRef GlobalVar) {
|
LLVMValueRef GlobalVar) {
|
||||||
return Val_int(LLVMPreferredAlignmentOfGlobal(TD, GlobalVar));
|
return Val_int(LLVMPreferredAlignmentOfGlobal(TD, GlobalVar));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.lltype -> Int64.t -> int */
|
/* DataLayout.t -> Llvm.lltype -> Int64.t -> int */
|
||||||
CAMLprim value llvm_element_at_offset(LLVMTargetDataRef TD, LLVMTypeRef Ty,
|
CAMLprim value llvm_element_at_offset(LLVMDataLayoutRef TD, LLVMTypeRef Ty,
|
||||||
value Offset) {
|
value Offset) {
|
||||||
return Val_int(LLVMElementAtOffset(TD, Ty, Int_val(Offset)));
|
return Val_int(LLVMElementAtOffset(TD, Ty, Int_val(Offset)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TargetData.t -> Llvm.lltype -> int -> Int64.t */
|
/* DataLayout.t -> Llvm.lltype -> int -> Int64.t */
|
||||||
CAMLprim value llvm_offset_of_element(LLVMTargetDataRef TD, LLVMTypeRef Ty,
|
CAMLprim value llvm_offset_of_element(LLVMDataLayoutRef TD, LLVMTypeRef Ty,
|
||||||
value Index) {
|
value Index) {
|
||||||
return caml_copy_int64(LLVMOffsetOfElement(TD, Ty, Int_val(Index)));
|
return caml_copy_int64(LLVMOffsetOfElement(TD, Ty, Int_val(Index)));
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ Required components in the code generator
|
|||||||
The two pieces of the LLVM code generator are the high-level interface to the
|
The two pieces of the LLVM code generator are the high-level interface to the
|
||||||
code generator and the set of reusable components that can be used to build
|
code generator and the set of reusable components that can be used to build
|
||||||
target-specific backends. The two most important interfaces (:raw-html:`<tt>`
|
target-specific backends. The two most important interfaces (:raw-html:`<tt>`
|
||||||
`TargetMachine`_ :raw-html:`</tt>` and :raw-html:`<tt>` `TargetData`_
|
`TargetMachine`_ :raw-html:`</tt>` and :raw-html:`<tt>` `DataLayout`_
|
||||||
:raw-html:`</tt>`) are the only ones that are required to be defined for a
|
:raw-html:`</tt>`) are the only ones that are required to be defined for a
|
||||||
backend to fit into the LLVM system, but the others must be defined if the
|
backend to fit into the LLVM system, but the others must be defined if the
|
||||||
reusable code generator components are going to be used.
|
reusable code generator components are going to be used.
|
||||||
@ -197,7 +197,7 @@ any particular client. These classes are designed to capture the *abstract*
|
|||||||
properties of the target (such as the instructions and registers it has), and do
|
properties of the target (such as the instructions and registers it has), and do
|
||||||
not incorporate any particular pieces of code generation algorithms.
|
not incorporate any particular pieces of code generation algorithms.
|
||||||
|
|
||||||
All of the target description classes (except the :raw-html:`<tt>` `TargetData`_
|
All of the target description classes (except the :raw-html:`<tt>` `DataLayout`_
|
||||||
:raw-html:`</tt>` class) are designed to be subclassed by the concrete target
|
:raw-html:`</tt>` class) are designed to be subclassed by the concrete target
|
||||||
implementation, and have virtual methods implemented. To get to these
|
implementation, and have virtual methods implemented. To get to these
|
||||||
implementations, the :raw-html:`<tt>` `TargetMachine`_ :raw-html:`</tt>` class
|
implementations, the :raw-html:`<tt>` `TargetMachine`_ :raw-html:`</tt>` class
|
||||||
@ -214,18 +214,18 @@ the ``get*Info`` methods (``getInstrInfo``, ``getRegisterInfo``,
|
|||||||
``getFrameInfo``, etc.). This class is designed to be specialized by a concrete
|
``getFrameInfo``, etc.). This class is designed to be specialized by a concrete
|
||||||
target implementation (e.g., ``X86TargetMachine``) which implements the various
|
target implementation (e.g., ``X86TargetMachine``) which implements the various
|
||||||
virtual methods. The only required target description class is the
|
virtual methods. The only required target description class is the
|
||||||
:raw-html:`<tt>` `TargetData`_ :raw-html:`</tt>` class, but if the code
|
:raw-html:`<tt>` `DataLayout`_ :raw-html:`</tt>` class, but if the code
|
||||||
generator components are to be used, the other interfaces should be implemented
|
generator components are to be used, the other interfaces should be implemented
|
||||||
as well.
|
as well.
|
||||||
|
|
||||||
.. _TargetData:
|
.. _DataLayout:
|
||||||
|
|
||||||
The ``TargetData`` class
|
The ``DataLayout`` class
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
The ``TargetData`` class is the only required target description class, and it
|
The ``DataLayout`` class is the only required target description class, and it
|
||||||
is the only class that is not extensible (you cannot derived a new class from
|
is the only class that is not extensible (you cannot derived a new class from
|
||||||
it). ``TargetData`` specifies information about how the target lays out memory
|
it). ``DataLayout`` specifies information about how the target lays out memory
|
||||||
for structures, the alignment requirements for various data types, the size of
|
for structures, the alignment requirements for various data types, the size of
|
||||||
pointers in the target, and whether the target is little-endian or
|
pointers in the target, and whether the target is little-endian or
|
||||||
big-endian.
|
big-endian.
|
||||||
|
@ -1253,7 +1253,7 @@ methods. Here's a realistic example:</p>
|
|||||||
>#include "llvm/CodeGen/AsmPrinter.h"
|
>#include "llvm/CodeGen/AsmPrinter.h"
|
||||||
#include "llvm/Function.h"
|
#include "llvm/Function.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/DataLayout.h"
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
|
|
||||||
void MyGCPrinter::beginAssembly(std::ostream &OS, AsmPrinter &AP,
|
void MyGCPrinter::beginAssembly(std::ostream &OS, AsmPrinter &AP,
|
||||||
@ -1266,7 +1266,7 @@ void MyGCPrinter::finishAssembly(std::ostream &OS, AsmPrinter &AP,
|
|||||||
// Set up for emitting addresses.
|
// Set up for emitting addresses.
|
||||||
const char *AddressDirective;
|
const char *AddressDirective;
|
||||||
int AddressAlignLog;
|
int AddressAlignLog;
|
||||||
if (AP.TM.getTargetData()->getPointerSize() == sizeof(int32_t)) {
|
if (AP.TM.getDataLayout()->getPointerSize() == sizeof(int32_t)) {
|
||||||
AddressDirective = TAI.getData32bitsDirective();
|
AddressDirective = TAI.getData32bitsDirective();
|
||||||
AddressAlignLog = 2;
|
AddressAlignLog = 2;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2104,7 +2104,7 @@ in signal handlers).</p>
|
|||||||
<p>Structures may optionally be "packed" structures, which indicate that the
|
<p>Structures may optionally be "packed" structures, which indicate that the
|
||||||
alignment of the struct is one byte, and that there is no padding between
|
alignment of the struct is one byte, and that there is no padding between
|
||||||
the elements. In non-packed structs, padding between field types is inserted
|
the elements. In non-packed structs, padding between field types is inserted
|
||||||
as defined by the TargetData string in the module, which is required to match
|
as defined by the DataLayout string in the module, which is required to match
|
||||||
what the underlying code generator expects.</p>
|
what the underlying code generator expects.</p>
|
||||||
|
|
||||||
<p>Structures can either be "literal" or "identified". A literal structure is
|
<p>Structures can either be "literal" or "identified". A literal structure is
|
||||||
|
@ -314,14 +314,14 @@ represent target components. These methods are named <tt>get*Info</tt>, and are
|
|||||||
intended to obtain the instruction set (<tt>getInstrInfo</tt>), register set
|
intended to obtain the instruction set (<tt>getInstrInfo</tt>), register set
|
||||||
(<tt>getRegisterInfo</tt>), stack frame layout (<tt>getFrameInfo</tt>), and
|
(<tt>getRegisterInfo</tt>), stack frame layout (<tt>getFrameInfo</tt>), and
|
||||||
similar information. <tt>XXXTargetMachine</tt> must also implement the
|
similar information. <tt>XXXTargetMachine</tt> must also implement the
|
||||||
<tt>getTargetData</tt> method to access an object with target-specific data
|
<tt>getDataLayout</tt> method to access an object with target-specific data
|
||||||
characteristics, such as data type size and alignment requirements.
|
characteristics, such as data type size and alignment requirements.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
For instance, for the SPARC target, the header file
|
For instance, for the SPARC target, the header file
|
||||||
<tt>SparcTargetMachine.h</tt> declares prototypes for several <tt>get*Info</tt>
|
<tt>SparcTargetMachine.h</tt> declares prototypes for several <tt>get*Info</tt>
|
||||||
and <tt>getTargetData</tt> methods that simply return a class member.
|
and <tt>getDataLayout</tt> methods that simply return a class member.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="doc_code">
|
<div class="doc_code">
|
||||||
@ -331,7 +331,7 @@ namespace llvm {
|
|||||||
class Module;
|
class Module;
|
||||||
|
|
||||||
class SparcTargetMachine : public LLVMTargetMachine {
|
class SparcTargetMachine : public LLVMTargetMachine {
|
||||||
const TargetData DataLayout; // Calculates type size & alignment
|
const DataLayout DataLayout; // Calculates type size & alignment
|
||||||
SparcSubtarget Subtarget;
|
SparcSubtarget Subtarget;
|
||||||
SparcInstrInfo InstrInfo;
|
SparcInstrInfo InstrInfo;
|
||||||
TargetFrameInfo FrameInfo;
|
TargetFrameInfo FrameInfo;
|
||||||
@ -348,7 +348,7 @@ public:
|
|||||||
virtual const TargetRegisterInfo *getRegisterInfo() const {
|
virtual const TargetRegisterInfo *getRegisterInfo() const {
|
||||||
return &InstrInfo.getRegisterInfo();
|
return &InstrInfo.getRegisterInfo();
|
||||||
}
|
}
|
||||||
virtual const TargetData *getTargetData() const { return &DataLayout; }
|
virtual const DataLayout *getDataLayout() const { return &DataLayout; }
|
||||||
static unsigned getModuleMatchQuality(const Module &M);
|
static unsigned getModuleMatchQuality(const Module &M);
|
||||||
|
|
||||||
// Pass Pipeline Configuration
|
// Pass Pipeline Configuration
|
||||||
@ -364,7 +364,7 @@ public:
|
|||||||
<li><tt>getInstrInfo()</tt></li>
|
<li><tt>getInstrInfo()</tt></li>
|
||||||
<li><tt>getRegisterInfo()</tt></li>
|
<li><tt>getRegisterInfo()</tt></li>
|
||||||
<li><tt>getFrameInfo()</tt></li>
|
<li><tt>getFrameInfo()</tt></li>
|
||||||
<li><tt>getTargetData()</tt></li>
|
<li><tt>getDataLayout()</tt></li>
|
||||||
<li><tt>getSubtargetImpl()</tt></li>
|
<li><tt>getSubtargetImpl()</tt></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ add a set of optimizations to run. The code looks like this:</p>
|
|||||||
|
|
||||||
// Set up the optimizer pipeline. Start with registering info about how the
|
// Set up the optimizer pipeline. Start with registering info about how the
|
||||||
// target lays out data structures.
|
// target lays out data structures.
|
||||||
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
|
OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
|
||||||
// Provide basic AliasAnalysis support for GVN.
|
// Provide basic AliasAnalysis support for GVN.
|
||||||
OurFPM.add(createBasicAliasAnalysisPass());
|
OurFPM.add(createBasicAliasAnalysisPass());
|
||||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||||
@ -523,7 +523,7 @@ at runtime.</p>
|
|||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/Analysis/Verifier.h"
|
#include "llvm/Analysis/Verifier.h"
|
||||||
#include "llvm/Analysis/Passes.h"
|
#include "llvm/Analysis/Passes.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/DataLayout.h"
|
||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "llvm/Support/TargetSelect.h"
|
#include "llvm/Support/TargetSelect.h"
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@ -1103,7 +1103,7 @@ int main() {
|
|||||||
|
|
||||||
// Set up the optimizer pipeline. Start with registering info about how the
|
// Set up the optimizer pipeline. Start with registering info about how the
|
||||||
// target lays out data structures.
|
// target lays out data structures.
|
||||||
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
|
OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
|
||||||
// Provide basic AliasAnalysis support for GVN.
|
// Provide basic AliasAnalysis support for GVN.
|
||||||
OurFPM.add(createBasicAliasAnalysisPass());
|
OurFPM.add(createBasicAliasAnalysisPass());
|
||||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||||
|
@ -901,7 +901,7 @@ clang++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3
|
|||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/Analysis/Verifier.h"
|
#include "llvm/Analysis/Verifier.h"
|
||||||
#include "llvm/Analysis/Passes.h"
|
#include "llvm/Analysis/Passes.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/DataLayout.h"
|
||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "llvm/Support/TargetSelect.h"
|
#include "llvm/Support/TargetSelect.h"
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@ -1723,7 +1723,7 @@ int main() {
|
|||||||
|
|
||||||
// Set up the optimizer pipeline. Start with registering info about how the
|
// Set up the optimizer pipeline. Start with registering info about how the
|
||||||
// target lays out data structures.
|
// target lays out data structures.
|
||||||
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
|
OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
|
||||||
// Provide basic AliasAnalysis support for GVN.
|
// Provide basic AliasAnalysis support for GVN.
|
||||||
OurFPM.add(createBasicAliasAnalysisPass());
|
OurFPM.add(createBasicAliasAnalysisPass());
|
||||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||||
|
@ -840,7 +840,7 @@ library, although doing that will cause problems on Windows.</p>
|
|||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/Analysis/Verifier.h"
|
#include "llvm/Analysis/Verifier.h"
|
||||||
#include "llvm/Analysis/Passes.h"
|
#include "llvm/Analysis/Passes.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/DataLayout.h"
|
||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "llvm/Support/TargetSelect.h"
|
#include "llvm/Support/TargetSelect.h"
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@ -1780,7 +1780,7 @@ int main() {
|
|||||||
|
|
||||||
// Set up the optimizer pipeline. Start with registering info about how the
|
// Set up the optimizer pipeline. Start with registering info about how the
|
||||||
// target lays out data structures.
|
// target lays out data structures.
|
||||||
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
|
OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
|
||||||
// Provide basic AliasAnalysis support for GVN.
|
// Provide basic AliasAnalysis support for GVN.
|
||||||
OurFPM.add(createBasicAliasAnalysisPass());
|
OurFPM.add(createBasicAliasAnalysisPass());
|
||||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||||
|
@ -524,7 +524,7 @@ good codegen once again:</p>
|
|||||||
<pre>
|
<pre>
|
||||||
// Set up the optimizer pipeline. Start with registering info about how the
|
// Set up the optimizer pipeline. Start with registering info about how the
|
||||||
// target lays out data structures.
|
// target lays out data structures.
|
||||||
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
|
OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
|
||||||
<b>// Promote allocas to registers.
|
<b>// Promote allocas to registers.
|
||||||
OurFPM.add(createPromoteMemoryToRegisterPass());</b>
|
OurFPM.add(createPromoteMemoryToRegisterPass());</b>
|
||||||
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
// Do simple "peephole" optimizations and bit-twiddling optzns.
|
||||||
@ -1008,7 +1008,7 @@ clang++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3
|
|||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/Analysis/Verifier.h"
|
#include "llvm/Analysis/Verifier.h"
|
||||||
#include "llvm/Analysis/Passes.h"
|
#include "llvm/Analysis/Passes.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/DataLayout.h"
|
||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "llvm/Support/TargetSelect.h"
|
#include "llvm/Support/TargetSelect.h"
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@ -2113,7 +2113,7 @@ int main() {
|
|||||||
|
|
||||||
// Set up the optimizer pipeline. Start with registering info about how the
|
// Set up the optimizer pipeline. Start with registering info about how the
|
||||||
// target lays out data structures.
|
// target lays out data structures.
|
||||||
OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
|
OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
|
||||||
// Provide basic AliasAnalysis support for GVN.
|
// Provide basic AliasAnalysis support for GVN.
|
||||||
OurFPM.add(createBasicAliasAnalysisPass());
|
OurFPM.add(createBasicAliasAnalysisPass());
|
||||||
// Promote allocas to registers.
|
// Promote allocas to registers.
|
||||||
|
@ -189,7 +189,7 @@ add a set of optimizations to run. The code looks like this:</p>
|
|||||||
|
|
||||||
(* Set up the optimizer pipeline. Start with registering info about how the
|
(* Set up the optimizer pipeline. Start with registering info about how the
|
||||||
* target lays out data structures. *)
|
* target lays out data structures. *)
|
||||||
TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
|
DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
|
||||||
|
|
||||||
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
|
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
|
||||||
add_instruction_combining the_fpm;
|
add_instruction_combining the_fpm;
|
||||||
@ -965,7 +965,7 @@ let main () =
|
|||||||
|
|
||||||
(* Set up the optimizer pipeline. Start with registering info about how the
|
(* Set up the optimizer pipeline. Start with registering info about how the
|
||||||
* target lays out data structures. *)
|
* target lays out data structures. *)
|
||||||
TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
|
DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
|
||||||
|
|
||||||
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
|
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
|
||||||
add_instruction_combination the_fpm;
|
add_instruction_combination the_fpm;
|
||||||
|
@ -1498,7 +1498,7 @@ let main () =
|
|||||||
|
|
||||||
(* Set up the optimizer pipeline. Start with registering info about how the
|
(* Set up the optimizer pipeline. Start with registering info about how the
|
||||||
* target lays out data structures. *)
|
* target lays out data structures. *)
|
||||||
TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
|
DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
|
||||||
|
|
||||||
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
|
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
|
||||||
add_instruction_combination the_fpm;
|
add_instruction_combination the_fpm;
|
||||||
|
@ -1506,7 +1506,7 @@ let main () =
|
|||||||
|
|
||||||
(* Set up the optimizer pipeline. Start with registering info about how the
|
(* Set up the optimizer pipeline. Start with registering info about how the
|
||||||
* target lays out data structures. *)
|
* target lays out data structures. *)
|
||||||
TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
|
DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
|
||||||
|
|
||||||
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
|
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
|
||||||
add_instruction_combination the_fpm;
|
add_instruction_combination the_fpm;
|
||||||
|
@ -545,7 +545,7 @@ let main () =
|
|||||||
|
|
||||||
(* Set up the optimizer pipeline. Start with registering info about how the
|
(* Set up the optimizer pipeline. Start with registering info about how the
|
||||||
* target lays out data structures. *)
|
* target lays out data structures. *)
|
||||||
TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
|
DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
|
||||||
|
|
||||||
<b>(* Promote allocas to registers. *)
|
<b>(* Promote allocas to registers. *)
|
||||||
add_memory_to_register_promotion the_fpm;</b>
|
add_memory_to_register_promotion the_fpm;</b>
|
||||||
@ -1834,7 +1834,7 @@ let main () =
|
|||||||
|
|
||||||
(* Set up the optimizer pipeline. Start with registering info about how the
|
(* Set up the optimizer pipeline. Start with registering info about how the
|
||||||
* target lays out data structures. *)
|
* target lays out data structures. *)
|
||||||
TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
|
DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
|
||||||
|
|
||||||
(* Promote allocas to registers. *)
|
(* Promote allocas to registers. *)
|
||||||
add_memory_to_register_promotion the_fpm;
|
add_memory_to_register_promotion the_fpm;
|
||||||
|
@ -43,10 +43,10 @@ let test_transforms () =
|
|||||||
ignore (build_ret (build_call fn [| |] "" b) b);
|
ignore (build_ret (build_call fn [| |] "" b) b);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
let td = TargetData.create (target_triple m) in
|
let td = DataLayout.create (target_triple m) in
|
||||||
|
|
||||||
ignore (PassManager.create ()
|
ignore (PassManager.create ()
|
||||||
++ TargetData.add td
|
++ DataLayout.add td
|
||||||
++ add_argument_promotion
|
++ add_argument_promotion
|
||||||
++ add_constant_merge
|
++ add_constant_merge
|
||||||
++ add_dead_arg_elimination
|
++ add_dead_arg_elimination
|
||||||
@ -63,7 +63,7 @@ let test_transforms () =
|
|||||||
++ PassManager.run_module m
|
++ PassManager.run_module m
|
||||||
++ PassManager.dispose);
|
++ PassManager.dispose);
|
||||||
|
|
||||||
TargetData.dispose td
|
DataLayout.dispose td
|
||||||
|
|
||||||
|
|
||||||
(*===-- Driver ------------------------------------------------------------===*)
|
(*===-- Driver ------------------------------------------------------------===*)
|
||||||
|
@ -38,10 +38,10 @@ let test_transforms () =
|
|||||||
let fn = define_function "fn" fty m in
|
let fn = define_function "fn" fty m in
|
||||||
ignore (build_ret_void (builder_at_end context (entry_block fn)));
|
ignore (build_ret_void (builder_at_end context (entry_block fn)));
|
||||||
|
|
||||||
let td = TargetData.create (target_triple m) in
|
let td = DataLayout.create (target_triple m) in
|
||||||
|
|
||||||
ignore (PassManager.create_function m
|
ignore (PassManager.create_function m
|
||||||
++ TargetData.add td
|
++ DataLayout.add td
|
||||||
++ add_verifier
|
++ add_verifier
|
||||||
++ add_constant_propagation
|
++ add_constant_propagation
|
||||||
++ add_sccp
|
++ add_sccp
|
||||||
@ -78,7 +78,7 @@ let test_transforms () =
|
|||||||
++ PassManager.finalize
|
++ PassManager.finalize
|
||||||
++ PassManager.dispose);
|
++ PassManager.dispose);
|
||||||
|
|
||||||
TargetData.dispose td
|
DataLayout.dispose td
|
||||||
|
|
||||||
|
|
||||||
(*===-- Driver ------------------------------------------------------------===*)
|
(*===-- Driver ------------------------------------------------------------===*)
|
||||||
|
@ -33,10 +33,10 @@ let m = create_module context filename
|
|||||||
(*===-- Target Data -------------------------------------------------------===*)
|
(*===-- Target Data -------------------------------------------------------===*)
|
||||||
|
|
||||||
let test_target_data () =
|
let test_target_data () =
|
||||||
let td = TargetData.create (target_triple m) in
|
let td = DataLayout.create (target_triple m) in
|
||||||
let sty = struct_type context [| i32_type; i64_type |] in
|
let sty = struct_type context [| i32_type; i64_type |] in
|
||||||
|
|
||||||
ignore (TargetData.as_string td);
|
ignore (DataLayout.as_string td);
|
||||||
ignore (byte_order td);
|
ignore (byte_order td);
|
||||||
ignore (pointer_size td);
|
ignore (pointer_size td);
|
||||||
ignore (intptr_type td);
|
ignore (intptr_type td);
|
||||||
@ -49,7 +49,7 @@ let test_target_data () =
|
|||||||
ignore (element_at_offset td sty (Int64.of_int 1));
|
ignore (element_at_offset td sty (Int64.of_int 1));
|
||||||
ignore (offset_of_element td sty 1);
|
ignore (offset_of_element td sty 1);
|
||||||
|
|
||||||
TargetData.dispose td
|
DataLayout.dispose td
|
||||||
|
|
||||||
|
|
||||||
(*===-- Driver ------------------------------------------------------------===*)
|
(*===-- Driver ------------------------------------------------------------===*)
|
||||||
|
@ -39,11 +39,11 @@
|
|||||||
%"struct.llvm::SymbolTable" = type opaque
|
%"struct.llvm::SymbolTable" = type opaque
|
||||||
%"struct.llvm::SymbolTableListTraits<llvm::Argument,llvm::Function,llvm::Function,llvm::ilist_traits<llvm::Argument> >" = type { %"struct.llvm::Function"*, %"struct.llvm::Function"* }
|
%"struct.llvm::SymbolTableListTraits<llvm::Argument,llvm::Function,llvm::Function,llvm::ilist_traits<llvm::Argument> >" = type { %"struct.llvm::Function"*, %"struct.llvm::Function"* }
|
||||||
%"struct.llvm::SymbolTableListTraits<llvm::Instruction,llvm::BasicBlock,llvm::Function,llvm::ilist_traits<llvm::Instruction> >" = type { %"struct.llvm::Function"*, %"struct.llvm::BasicBlock"* }
|
%"struct.llvm::SymbolTableListTraits<llvm::Instruction,llvm::BasicBlock,llvm::Function,llvm::ilist_traits<llvm::Instruction> >" = type { %"struct.llvm::Function"*, %"struct.llvm::BasicBlock"* }
|
||||||
%"struct.llvm::TargetData" = type { %"struct.llvm::FunctionPass", i1, i8, i8, i8, i8, i8, i8, i8, i8 }
|
%"struct.llvm::DataLayout" = type { %"struct.llvm::FunctionPass", i1, i8, i8, i8, i8, i8, i8, i8, i8 }
|
||||||
%"struct.llvm::TargetFrameInfo" = type { i32 (...)**, i32, i32, i32 }
|
%"struct.llvm::TargetFrameInfo" = type { i32 (...)**, i32, i32, i32 }
|
||||||
%"struct.llvm::TargetInstrDescriptor" = type { i8*, i32, i32, i32, i1, i32, i32, i32, i32, i32, i32*, i32* }
|
%"struct.llvm::TargetInstrDescriptor" = type { i8*, i32, i32, i32, i1, i32, i32, i32, i32, i32, i32*, i32* }
|
||||||
%"struct.llvm::TargetInstrInfo" = type { i32 (...)**, %"struct.llvm::TargetInstrDescriptor"*, i32, i32 }
|
%"struct.llvm::TargetInstrInfo" = type { i32 (...)**, %"struct.llvm::TargetInstrDescriptor"*, i32, i32 }
|
||||||
%"struct.llvm::TargetMachine" = type { i32 (...)**, %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >", %"struct.llvm::TargetData", %"struct.llvm::IntrinsicLowering"* }
|
%"struct.llvm::TargetMachine" = type { i32 (...)**, %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >", %"struct.llvm::DataLayout", %"struct.llvm::IntrinsicLowering"* }
|
||||||
%"struct.llvm::TargetRegClassInfo" = type { i32 (...)**, i32, i32, i32 }
|
%"struct.llvm::TargetRegClassInfo" = type { i32 (...)**, i32, i32, i32 }
|
||||||
%"struct.llvm::TargetRegInfo" = type { i32 (...)**, %"struct.std::vector<const llvm::TargetRegClassInfo*,std::allocator<const llvm::TargetRegClassInfo*> >", %"struct.llvm::TargetMachine"* }
|
%"struct.llvm::TargetRegInfo" = type { i32 (...)**, %"struct.std::vector<const llvm::TargetRegClassInfo*,std::allocator<const llvm::TargetRegClassInfo*> >", %"struct.llvm::TargetMachine"* }
|
||||||
%"struct.llvm::Type" = type { %"struct.llvm::Value", i32, i32, i1, i32, %"struct.llvm::Type"*, %"struct.std::vector<llvm::PATypeHandle,std::allocator<llvm::PATypeHandle> >" }
|
%"struct.llvm::Type" = type { %"struct.llvm::Value", i32, i32, i1, i32, %"struct.llvm::Type"*, %"struct.std::vector<llvm::PATypeHandle,std::allocator<llvm::PATypeHandle> >" }
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include "BugDriver.h"
|
#include "BugDriver.h"
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
|
#include "llvm/DataLayout.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/LLVMContext.h"
|
#include "llvm/LLVMContext.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
@ -25,7 +26,6 @@
|
|||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "llvm/Transforms/Utils/Cloning.h"
|
#include "llvm/Transforms/Utils/Cloning.h"
|
||||||
#include "llvm/Transforms/Utils/CodeExtractor.h"
|
#include "llvm/Transforms/Utils/CodeExtractor.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/FileUtilities.h"
|
#include "llvm/Support/FileUtilities.h"
|
||||||
|
@ -16,11 +16,11 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "BugDriver.h"
|
#include "BugDriver.h"
|
||||||
|
#include "llvm/DataLayout.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/Analysis/Verifier.h"
|
#include "llvm/Analysis/Verifier.h"
|
||||||
#include "llvm/Bitcode/ReaderWriter.h"
|
#include "llvm/Bitcode/ReaderWriter.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
|
||||||
#include "llvm/Support/FileUtilities.h"
|
#include "llvm/Support/FileUtilities.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/SystemUtils.h"
|
#include "llvm/Support/SystemUtils.h"
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "llvm/LLVMContext.h"
|
#include "llvm/LLVMContext.h"
|
||||||
|
#include "llvm/DataLayout.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
@ -34,7 +35,6 @@
|
|||||||
#include "llvm/Support/Signals.h"
|
#include "llvm/Support/Signals.h"
|
||||||
#include "llvm/Support/TargetRegistry.h"
|
#include "llvm/Support/TargetRegistry.h"
|
||||||
#include "llvm/Support/TargetSelect.h"
|
#include "llvm/Support/TargetSelect.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
|
||||||
#include "llvm/Target/TargetLibraryInfo.h"
|
#include "llvm/Target/TargetLibraryInfo.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -506,10 +506,10 @@ int main(int argc, char **argv) {
|
|||||||
PM.add(TLI);
|
PM.add(TLI);
|
||||||
|
|
||||||
// Add the target data from the target machine, if it exists, or the module.
|
// Add the target data from the target machine, if it exists, or the module.
|
||||||
if (const TargetData *TD = Target.getTargetData())
|
if (const DataLayout *TD = Target.getDataLayout())
|
||||||
PM.add(new TargetData(*TD));
|
PM.add(new DataLayout(*TD));
|
||||||
else
|
else
|
||||||
PM.add(new TargetData(mod));
|
PM.add(new DataLayout(mod));
|
||||||
|
|
||||||
// Override default to generate verbose assembly.
|
// Override default to generate verbose assembly.
|
||||||
Target.setAsmVerbosityDefault(true);
|
Target.setAsmVerbosityDefault(true);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "llvm/Assembly/PrintModulePass.h"
|
#include "llvm/Assembly/PrintModulePass.h"
|
||||||
#include "llvm/Bitcode/ReaderWriter.h"
|
#include "llvm/Bitcode/ReaderWriter.h"
|
||||||
#include "llvm/Transforms/IPO.h"
|
#include "llvm/Transforms/IPO.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/DataLayout.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/IRReader.h"
|
#include "llvm/Support/IRReader.h"
|
||||||
#include "llvm/Support/ManagedStatic.h"
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
@ -206,7 +206,7 @@ int main(int argc, char **argv) {
|
|||||||
// In addition to deleting all other functions, we also want to spiff it
|
// In addition to deleting all other functions, we also want to spiff it
|
||||||
// up a little bit. Do this now.
|
// up a little bit. Do this now.
|
||||||
PassManager Passes;
|
PassManager Passes;
|
||||||
Passes.add(new TargetData(M.get())); // Use correct TargetData
|
Passes.add(new DataLayout(M.get())); // Use correct DataLayout
|
||||||
|
|
||||||
std::vector<GlobalValue*> Gvs(GVs.begin(), GVs.end());
|
std::vector<GlobalValue*> Gvs(GVs.begin(), GVs.end());
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "LTOCodeGenerator.h"
|
#include "LTOCodeGenerator.h"
|
||||||
#include "LTOModule.h"
|
#include "LTOModule.h"
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
|
#include "llvm/DataLayout.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/Linker.h"
|
#include "llvm/Linker.h"
|
||||||
#include "llvm/LLVMContext.h"
|
#include "llvm/LLVMContext.h"
|
||||||
@ -29,7 +30,6 @@
|
|||||||
#include "llvm/MC/SubtargetFeature.h"
|
#include "llvm/MC/SubtargetFeature.h"
|
||||||
#include "llvm/Target/Mangler.h"
|
#include "llvm/Target/Mangler.h"
|
||||||
#include "llvm/Target/TargetOptions.h"
|
#include "llvm/Target/TargetOptions.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include "llvm/Target/TargetRegisterInfo.h"
|
#include "llvm/Target/TargetRegisterInfo.h"
|
||||||
#include "llvm/Transforms/IPO.h"
|
#include "llvm/Transforms/IPO.h"
|
||||||
@ -293,7 +293,7 @@ void LTOCodeGenerator::applyScopeRestrictions() {
|
|||||||
|
|
||||||
// mark which symbols can not be internalized
|
// mark which symbols can not be internalized
|
||||||
MCContext Context(*_target->getMCAsmInfo(), *_target->getRegisterInfo(),NULL);
|
MCContext Context(*_target->getMCAsmInfo(), *_target->getRegisterInfo(),NULL);
|
||||||
Mangler mangler(Context, *_target->getTargetData());
|
Mangler mangler(Context, *_target->getDataLayout());
|
||||||
std::vector<const char*> mustPreserveList;
|
std::vector<const char*> mustPreserveList;
|
||||||
SmallPtrSet<GlobalValue*, 8> asmUsed;
|
SmallPtrSet<GlobalValue*, 8> asmUsed;
|
||||||
|
|
||||||
@ -361,8 +361,8 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
|
|||||||
// Start off with a verification pass.
|
// Start off with a verification pass.
|
||||||
passes.add(createVerifierPass());
|
passes.add(createVerifierPass());
|
||||||
|
|
||||||
// Add an appropriate TargetData instance for this module...
|
// Add an appropriate DataLayout instance for this module...
|
||||||
passes.add(new TargetData(*_target->getTargetData()));
|
passes.add(new DataLayout(*_target->getDataLayout()));
|
||||||
|
|
||||||
// Enabling internalize here would use its AllButMain variant. It
|
// Enabling internalize here would use its AllButMain variant. It
|
||||||
// keeps only main if it exists and does nothing for libraries. Instead
|
// keeps only main if it exists and does nothing for libraries. Instead
|
||||||
@ -376,7 +376,7 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
|
|||||||
|
|
||||||
FunctionPassManager *codeGenPasses = new FunctionPassManager(mergedModule);
|
FunctionPassManager *codeGenPasses = new FunctionPassManager(mergedModule);
|
||||||
|
|
||||||
codeGenPasses->add(new TargetData(*_target->getTargetData()));
|
codeGenPasses->add(new DataLayout(*_target->getDataLayout()));
|
||||||
|
|
||||||
formatted_raw_ostream Out(out);
|
formatted_raw_ostream Out(out);
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ SSPBufferSize("stack-protector-buffer-size", cl::init(8),
|
|||||||
LTOModule::LTOModule(llvm::Module *m, llvm::TargetMachine *t)
|
LTOModule::LTOModule(llvm::Module *m, llvm::TargetMachine *t)
|
||||||
: _module(m), _target(t),
|
: _module(m), _target(t),
|
||||||
_context(*_target->getMCAsmInfo(), *_target->getRegisterInfo(), NULL),
|
_context(*_target->getMCAsmInfo(), *_target->getRegisterInfo(), NULL),
|
||||||
_mangler(_context, *_target->getTargetData()) {}
|
_mangler(_context, *_target->getDataLayout()) {}
|
||||||
|
|
||||||
/// isBitcodeFile - Returns 'true' if the file (or memory contents) is LLVM
|
/// isBitcodeFile - Returns 'true' if the file (or memory contents) is LLVM
|
||||||
/// bitcode.
|
/// bitcode.
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "llvm/LLVMContext.h"
|
#include "llvm/LLVMContext.h"
|
||||||
|
#include "llvm/DataLayout.h"
|
||||||
#include "llvm/DebugInfo.h"
|
#include "llvm/DebugInfo.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
@ -23,7 +24,6 @@
|
|||||||
#include "llvm/Analysis/LoopPass.h"
|
#include "llvm/Analysis/LoopPass.h"
|
||||||
#include "llvm/Analysis/RegionPass.h"
|
#include "llvm/Analysis/RegionPass.h"
|
||||||
#include "llvm/Analysis/CallGraph.h"
|
#include "llvm/Analysis/CallGraph.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
|
||||||
#include "llvm/Target/TargetLibraryInfo.h"
|
#include "llvm/Target/TargetLibraryInfo.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include "llvm/ADT/StringSet.h"
|
#include "llvm/ADT/StringSet.h"
|
||||||
@ -568,13 +568,13 @@ int main(int argc, char **argv) {
|
|||||||
TLI->disableAllFunctions();
|
TLI->disableAllFunctions();
|
||||||
Passes.add(TLI);
|
Passes.add(TLI);
|
||||||
|
|
||||||
// Add an appropriate TargetData instance for this module.
|
// Add an appropriate DataLayout instance for this module.
|
||||||
TargetData *TD = 0;
|
DataLayout *TD = 0;
|
||||||
const std::string &ModuleDataLayout = M.get()->getDataLayout();
|
const std::string &ModuleDataLayout = M.get()->getDataLayout();
|
||||||
if (!ModuleDataLayout.empty())
|
if (!ModuleDataLayout.empty())
|
||||||
TD = new TargetData(ModuleDataLayout);
|
TD = new DataLayout(ModuleDataLayout);
|
||||||
else if (!DefaultDataLayout.empty())
|
else if (!DefaultDataLayout.empty())
|
||||||
TD = new TargetData(DefaultDataLayout);
|
TD = new DataLayout(DefaultDataLayout);
|
||||||
|
|
||||||
if (TD)
|
if (TD)
|
||||||
Passes.add(TD);
|
Passes.add(TD);
|
||||||
@ -583,7 +583,7 @@ int main(int argc, char **argv) {
|
|||||||
if (OptLevelO1 || OptLevelO2 || OptLevelOs || OptLevelOz || OptLevelO3) {
|
if (OptLevelO1 || OptLevelO2 || OptLevelOs || OptLevelOz || OptLevelO3) {
|
||||||
FPasses.reset(new FunctionPassManager(M.get()));
|
FPasses.reset(new FunctionPassManager(M.get()));
|
||||||
if (TD)
|
if (TD)
|
||||||
FPasses->add(new TargetData(*TD));
|
FPasses->add(new DataLayout(*TD));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrintBreakpoints) {
|
if (PrintBreakpoints) {
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "llvm/BasicBlock.h"
|
#include "llvm/BasicBlock.h"
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
|
#include "llvm/DataLayout.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/IRBuilder.h"
|
#include "llvm/IRBuilder.h"
|
||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
@ -17,7 +18,6 @@
|
|||||||
#include "llvm/Operator.h"
|
#include "llvm/Operator.h"
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include "llvm/Analysis/ValueTracking.h"
|
#include "llvm/Analysis/ValueTracking.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
@ -183,7 +183,7 @@ TEST(InstructionsTest, VectorGep) {
|
|||||||
EXPECT_NE(S3, Gep3);
|
EXPECT_NE(S3, Gep3);
|
||||||
|
|
||||||
int64_t Offset;
|
int64_t Offset;
|
||||||
TargetData TD("e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3"
|
DataLayout TD("e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3"
|
||||||
"2:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80"
|
"2:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80"
|
||||||
":128:128-n8:16:32:64-S128");
|
":128:128-n8:16:32:64-S128");
|
||||||
// Make sure we don't crash
|
// Make sure we don't crash
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Analysis/LoopPass.h"
|
#include "llvm/Analysis/LoopPass.h"
|
||||||
#include "llvm/CallGraphSCCPass.h"
|
#include "llvm/CallGraphSCCPass.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/DataLayout.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
@ -94,7 +94,7 @@ namespace llvm {
|
|||||||
initializeModuleNDMPass(*PassRegistry::getPassRegistry());
|
initializeModuleNDMPass(*PassRegistry::getPassRegistry());
|
||||||
}
|
}
|
||||||
virtual bool runOnModule(Module &M) {
|
virtual bool runOnModule(Module &M) {
|
||||||
EXPECT_TRUE(getAnalysisIfAvailable<TargetData>());
|
EXPECT_TRUE(getAnalysisIfAvailable<DataLayout>());
|
||||||
run++;
|
run++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -167,7 +167,7 @@ namespace llvm {
|
|||||||
initializeCGPassPass(*PassRegistry::getPassRegistry());
|
initializeCGPassPass(*PassRegistry::getPassRegistry());
|
||||||
}
|
}
|
||||||
virtual bool runOnSCC(CallGraphSCC &SCMM) {
|
virtual bool runOnSCC(CallGraphSCC &SCMM) {
|
||||||
EXPECT_TRUE(getAnalysisIfAvailable<TargetData>());
|
EXPECT_TRUE(getAnalysisIfAvailable<DataLayout>());
|
||||||
run();
|
run();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -177,7 +177,7 @@ namespace llvm {
|
|||||||
public:
|
public:
|
||||||
virtual bool runOnFunction(Function &F) {
|
virtual bool runOnFunction(Function &F) {
|
||||||
// FIXME: PR4112
|
// FIXME: PR4112
|
||||||
// EXPECT_TRUE(getAnalysisIfAvailable<TargetData>());
|
// EXPECT_TRUE(getAnalysisIfAvailable<DataLayout>());
|
||||||
run();
|
run();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ namespace llvm {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
virtual bool runOnLoop(Loop *L, LPPassManager &LPM) {
|
virtual bool runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||||
EXPECT_TRUE(getAnalysisIfAvailable<TargetData>());
|
EXPECT_TRUE(getAnalysisIfAvailable<DataLayout>());
|
||||||
run();
|
run();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -241,7 +241,7 @@ namespace llvm {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
virtual bool runOnBasicBlock(BasicBlock &BB) {
|
virtual bool runOnBasicBlock(BasicBlock &BB) {
|
||||||
EXPECT_TRUE(getAnalysisIfAvailable<TargetData>());
|
EXPECT_TRUE(getAnalysisIfAvailable<DataLayout>());
|
||||||
run();
|
run();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -266,7 +266,7 @@ namespace llvm {
|
|||||||
initializeFPassPass(*PassRegistry::getPassRegistry());
|
initializeFPassPass(*PassRegistry::getPassRegistry());
|
||||||
}
|
}
|
||||||
virtual bool runOnModule(Module &M) {
|
virtual bool runOnModule(Module &M) {
|
||||||
EXPECT_TRUE(getAnalysisIfAvailable<TargetData>());
|
EXPECT_TRUE(getAnalysisIfAvailable<DataLayout>());
|
||||||
for (Module::iterator I=M.begin(),E=M.end(); I != E; ++I) {
|
for (Module::iterator I=M.begin(),E=M.end(); I != E; ++I) {
|
||||||
Function &F = *I;
|
Function &F = *I;
|
||||||
{
|
{
|
||||||
@ -292,7 +292,7 @@ namespace llvm {
|
|||||||
mNDM->run = mNDNM->run = mDNM->run = mNDM2->run = 0;
|
mNDM->run = mNDNM->run = mDNM->run = mNDM2->run = 0;
|
||||||
|
|
||||||
PassManager Passes;
|
PassManager Passes;
|
||||||
Passes.add(new TargetData(&M));
|
Passes.add(new DataLayout(&M));
|
||||||
Passes.add(mNDM2);
|
Passes.add(mNDM2);
|
||||||
Passes.add(mNDM);
|
Passes.add(mNDM);
|
||||||
Passes.add(mNDNM);
|
Passes.add(mNDNM);
|
||||||
@ -316,7 +316,7 @@ namespace llvm {
|
|||||||
mNDM->run = mNDNM->run = mDNM->run = mNDM2->run = 0;
|
mNDM->run = mNDNM->run = mDNM->run = mNDM2->run = 0;
|
||||||
|
|
||||||
PassManager Passes;
|
PassManager Passes;
|
||||||
Passes.add(new TargetData(&M));
|
Passes.add(new DataLayout(&M));
|
||||||
Passes.add(mNDM);
|
Passes.add(mNDM);
|
||||||
Passes.add(mNDNM);
|
Passes.add(mNDNM);
|
||||||
Passes.add(mNDM2);// invalidates mNDM needed by mDNM
|
Passes.add(mNDM2);// invalidates mNDM needed by mDNM
|
||||||
@ -338,7 +338,7 @@ namespace llvm {
|
|||||||
OwningPtr<Module> M(makeLLVMModule());
|
OwningPtr<Module> M(makeLLVMModule());
|
||||||
T *P = new T();
|
T *P = new T();
|
||||||
PassManager Passes;
|
PassManager Passes;
|
||||||
Passes.add(new TargetData(M.get()));
|
Passes.add(new DataLayout(M.get()));
|
||||||
Passes.add(P);
|
Passes.add(P);
|
||||||
Passes.run(*M);
|
Passes.run(*M);
|
||||||
T::finishedOK(run);
|
T::finishedOK(run);
|
||||||
@ -349,7 +349,7 @@ namespace llvm {
|
|||||||
Module *M = makeLLVMModule();
|
Module *M = makeLLVMModule();
|
||||||
T *P = new T();
|
T *P = new T();
|
||||||
PassManager Passes;
|
PassManager Passes;
|
||||||
Passes.add(new TargetData(M));
|
Passes.add(new DataLayout(M));
|
||||||
Passes.add(P);
|
Passes.add(P);
|
||||||
Passes.run(*M);
|
Passes.run(*M);
|
||||||
T::finishedOK(run, N);
|
T::finishedOK(run, N);
|
||||||
@ -387,7 +387,7 @@ namespace llvm {
|
|||||||
SCOPED_TRACE("Running OnTheFlyTest");
|
SCOPED_TRACE("Running OnTheFlyTest");
|
||||||
struct OnTheFlyTest *O = new OnTheFlyTest();
|
struct OnTheFlyTest *O = new OnTheFlyTest();
|
||||||
PassManager Passes;
|
PassManager Passes;
|
||||||
Passes.add(new TargetData(M));
|
Passes.add(new DataLayout(M));
|
||||||
Passes.add(O);
|
Passes.add(O);
|
||||||
Passes.run(*M);
|
Passes.run(*M);
|
||||||
|
|
||||||
|
@ -177,12 +177,12 @@ void CallingConvEmitter::EmitAction(Record *Action,
|
|||||||
if (Size)
|
if (Size)
|
||||||
O << Size << ", ";
|
O << Size << ", ";
|
||||||
else
|
else
|
||||||
O << "\n" << IndentStr << " State.getTarget().getTargetData()"
|
O << "\n" << IndentStr << " State.getTarget().getDataLayout()"
|
||||||
"->getTypeAllocSize(EVT(LocVT).getTypeForEVT(State.getContext())), ";
|
"->getTypeAllocSize(EVT(LocVT).getTypeForEVT(State.getContext())), ";
|
||||||
if (Align)
|
if (Align)
|
||||||
O << Align;
|
O << Align;
|
||||||
else
|
else
|
||||||
O << "\n" << IndentStr << " State.getTarget().getTargetData()"
|
O << "\n" << IndentStr << " State.getTarget().getDataLayout()"
|
||||||
"->getABITypeAlignment(EVT(LocVT).getTypeForEVT(State.getContext()))";
|
"->getABITypeAlignment(EVT(LocVT).getTypeForEVT(State.getContext()))";
|
||||||
if (Action->isSubClassOf("CCAssignToStackWithShadow"))
|
if (Action->isSubClassOf("CCAssignToStackWithShadow"))
|
||||||
O << ", " << getQualifiedName(Action->getValueAsDef("ShadowReg"));
|
O << ", " << getQualifiedName(Action->getValueAsDef("ShadowReg"));
|
||||||
|
Loading…
Reference in New Issue
Block a user