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

Unified Diff: src/IceCfgNode.cpp

Issue 1559243002: Suzero. X8664. NaCl Sandboxing. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fixes filetype=asm; addresses comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceAssemblerX86BaseImpl.h ('k') | src/IceELFObjectWriter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceCfgNode.cpp
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp
index ba50afb5e07f2e6f4e07d0504c19110a106fe9f0..9e3f23adf634394616a2804d6da7f79530490304 100644
--- a/src/IceCfgNode.cpp
+++ b/src/IceCfgNode.cpp
@@ -1107,6 +1107,11 @@ public:
return llvm::cast<InstBundleLock>(getBundleLockStart())->getOption() ==
InstBundleLock::Opt_AlignToEnd;
}
+ bool isPadToEnd() const {
+ assert(isInBundleLockRegion());
+ return llvm::cast<InstBundleLock>(getBundleLockStart())->getOption() ==
+ InstBundleLock::Opt_PadToEnd;
+ }
// Check whether the entire bundle_lock region falls within the same bundle.
bool isSameBundle() const {
assert(isInBundleLockRegion());
@@ -1172,7 +1177,17 @@ public:
}
}
}
- // Update bookkeeping when rolling back for the second pass.
+ // If pad_to_end is specified, add padding such that the first instruction
+ // after the instruction sequence starts at a bundle boundary.
+ void padForPadToEnd() {
+ assert(isInBundleLockRegion());
+ if (isPadToEnd()) {
+ if (intptr_t Offset = getPostAlignment()) {
+ Asm->padWithNop(BundleSize - Offset);
+ SizeSnapshotPre = Asm->getBufferSize();
+ }
+ }
+ } // Update bookkeeping when rolling back for the second pass.
void rollback() {
assert(isInBundleLockRegion());
Asm->setBufferSize(SizeSnapshotPre);
@@ -1261,6 +1276,7 @@ void CfgNode::emitIAS(Cfg *Func) const {
// If align_to_end is specified, make sure the next instruction begins
// the bundle.
assert(!Helper.isAlignToEnd() || Helper.getPostAlignment() == 0);
+ Helper.padForPadToEnd();
Helper.leaveBundleLockRegion();
Retrying = false;
} else {
« no previous file with comments | « src/IceAssemblerX86BaseImpl.h ('k') | src/IceELFObjectWriter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698