summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2019-09-05 10:00:22 +0000
committerGuillaume Chatelet <gchatelet@google.com>2019-09-05 10:00:22 +0000
commitaff45e4b235dd7f369c7054761ccb3853fafdfac (patch)
tree853efb2cdf987f6e8ea14f2f26cea29769328ece /llvm/include
parent84dd9f4d5bbde123d422c1a39676aaee9602843a (diff)
downloadbcm5719-llvm-aff45e4b235dd7f369c7054761ccb3853fafdfac.tar.gz
bcm5719-llvm-aff45e4b235dd7f369c7054761ccb3853fafdfac.zip
[LLVM][Alignment] Make functions using log of alignment explicit
Summary: This patch renames functions that takes or returns alignment as log2, this patch will help with the transition to llvm::Align. The renaming makes it explicit that we deal with log(alignment) instead of a power of two alignment. A few renames uncovered dubious assignments: - `MirParser`/`MirPrinter` was expecting powers of two but `MachineFunction` and `MachineBasicBlock` were using deal with log2(align). This patch fixes it and updates the documentation. - `MachineBlockPlacement` exposes two flags (`align-all-blocks` and `align-all-nofallthru-blocks`) supposedly interpreted as power of two alignments, internally these values are interpreted as log2(align). This patch updates the documentation, - `MachineFunctionexposes` exposes `align-all-functions` also interpreted as power of two alignment, internally this value is interpreted as log2(align). This patch updates the documentation, Reviewers: lattner, thegameg, courbet Subscribers: dschuff, arsenm, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, javed.absar, hiraditya, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, dexonsmith, PkmX, jocewei, jsji, Jim, s.egerton, llvm-commits, courbet Tags: #llvm Differential Revision: https://reviews.llvm.org/D65945 llvm-svn: 371045
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/CodeGen/MachineBasicBlock.h6
-rw-r--r--llvm/include/llvm/CodeGen/MachineFunction.h15
-rw-r--r--llvm/include/llvm/CodeGen/TargetLowering.h32
3 files changed, 27 insertions, 26 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineBasicBlock.h b/llvm/include/llvm/CodeGen/MachineBasicBlock.h
index 5bf78138f5d..e3947f4a8f1 100644
--- a/llvm/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/llvm/include/llvm/CodeGen/MachineBasicBlock.h
@@ -105,7 +105,7 @@ private:
/// Alignment of the basic block. Zero if the basic block does not need to be
/// aligned. The alignment is specified as log2(bytes).
- unsigned Alignment = 0;
+ unsigned LogAlignment = 0;
/// Indicate that this basic block is entered via an exception handler.
bool IsEHPad = false;
@@ -374,11 +374,11 @@ public:
/// Return alignment of the basic block. The alignment is specified as
/// log2(bytes).
- unsigned getAlignment() const { return Alignment; }
+ unsigned getLogAlignment() const { return LogAlignment; }
/// Set alignment of the basic block. The alignment is specified as
/// log2(bytes).
- void setAlignment(unsigned Align) { Alignment = Align; }
+ void setLogAlignment(unsigned A) { LogAlignment = A; }
/// Returns true if the block is a landing pad. That is this basic block is
/// entered via an exception handler.
diff --git a/llvm/include/llvm/CodeGen/MachineFunction.h b/llvm/include/llvm/CodeGen/MachineFunction.h
index c9325c746ba..b6c08f2bae7 100644
--- a/llvm/include/llvm/CodeGen/MachineFunction.h
+++ b/llvm/include/llvm/CodeGen/MachineFunction.h
@@ -277,7 +277,7 @@ class MachineFunction {
unsigned FunctionNumber;
/// Alignment - The alignment of the function.
- unsigned Alignment;
+ unsigned LogAlignment;
/// ExposesReturnsTwice - True if the function calls setjmp or related
/// functions with attribute "returns twice", but doesn't have
@@ -508,15 +508,16 @@ public:
const WinEHFuncInfo *getWinEHFuncInfo() const { return WinEHInfo; }
WinEHFuncInfo *getWinEHFuncInfo() { return WinEHInfo; }
- /// getAlignment - Return the alignment (log2, not bytes) of the function.
- unsigned getAlignment() const { return Alignment; }
+ /// getLogAlignment - Return the alignment of the function.
+ unsigned getLogAlignment() const { return LogAlignment; }
- /// setAlignment - Set the alignment (log2, not bytes) of the function.
- void setAlignment(unsigned A) { Alignment = A; }
+ /// setLogAlignment - Set the alignment of the function.
+ void setLogAlignment(unsigned A) { LogAlignment = A; }
/// ensureAlignment - Make sure the function is at least 1 << A bytes aligned.
- void ensureAlignment(unsigned A) {
- if (Alignment < A) Alignment = A;
+ void ensureLogAlignment(unsigned A) {
+ if (LogAlignment < A)
+ LogAlignment = A;
}
/// exposesReturnsTwice - Returns true if the function calls setjmp or
diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index 315f209417c..de82fd71736 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -1582,18 +1582,18 @@ public:
}
/// Return the minimum function alignment.
- unsigned getMinFunctionAlignment() const {
- return MinFunctionAlignment;
+ unsigned getMinFunctionLogAlignment() const {
+ return MinFunctionLogAlignment;
}
/// Return the preferred function alignment.
- unsigned getPrefFunctionAlignment() const {
- return PrefFunctionAlignment;
+ unsigned getPrefFunctionLogAlignment() const {
+ return PrefFunctionLogAlignment;
}
/// Return the preferred loop alignment.
- virtual unsigned getPrefLoopAlignment(MachineLoop *ML = nullptr) const {
- return PrefLoopAlignment;
+ virtual unsigned getPrefLoopLogAlignment(MachineLoop *ML = nullptr) const {
+ return PrefLoopLogAlignment;
}
/// Should loops be aligned even when the function is marked OptSize (but not
@@ -2105,23 +2105,23 @@ protected:
}
/// Set the target's minimum function alignment (in log2(bytes))
- void setMinFunctionAlignment(unsigned Align) {
- MinFunctionAlignment = Align;
+ void setMinFunctionLogAlignment(unsigned LogAlign) {
+ MinFunctionLogAlignment = LogAlign;
}
/// Set the target's preferred function alignment. This should be set if
/// there is a performance benefit to higher-than-minimum alignment (in
/// log2(bytes))
- void setPrefFunctionAlignment(unsigned Align) {
- PrefFunctionAlignment = Align;
+ void setPrefFunctionLogAlignment(unsigned LogAlign) {
+ PrefFunctionLogAlignment = LogAlign;
}
/// Set the target's preferred loop alignment. Default alignment is zero, it
/// means the target does not care about loop alignment. The alignment is
/// specified in log2(bytes). The target may also override
/// getPrefLoopAlignment to provide per-loop values.
- void setPrefLoopAlignment(unsigned Align) {
- PrefLoopAlignment = Align;
+ void setPrefLoopLogAlignment(unsigned LogAlign) {
+ PrefLoopLogAlignment = LogAlign;
}
/// Set the minimum stack alignment of an argument (in log2(bytes)).
@@ -2692,14 +2692,14 @@ private:
/// The minimum function alignment (used when optimizing for size, and to
/// prevent explicitly provided alignment from leading to incorrect code).
- unsigned MinFunctionAlignment;
+ unsigned MinFunctionLogAlignment;
/// The preferred function alignment (used when alignment unspecified and
/// optimizing for speed).
- unsigned PrefFunctionAlignment;
+ unsigned PrefFunctionLogAlignment;
- /// The preferred loop alignment.
- unsigned PrefLoopAlignment;
+ /// The preferred loop alignment (in log2 bot in bytes).
+ unsigned PrefLoopLogAlignment;
/// Size in bits of the maximum atomics size the backend supports.
/// Accesses larger than this will be expanded by AtomicExpandPass.
OpenPOWER on IntegriCloud