mirror of
https://github.com/asmjit/asmjit.git
synced 2025-12-18 04:54:36 +03:00
Coding style.
This commit is contained in:
@@ -78,7 +78,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Code-Generation and Operands
|
//! Code-Generation and Operands
|
||||||
//! ----------------------------
|
//! ----------------------------
|
||||||
//!
|
//!
|
||||||
//! List of the most useful code-generation and operand classes:
|
//! List of the most useful code-generation and operand classes:
|
||||||
//! - \ref asmjit::Assembler - Low-level code-generation.
|
//! - \ref asmjit::Assembler - Low-level code-generation.
|
||||||
//! - \ref asmjit::CodeGen - Astract code-generation that serializes to `Assembler`:
|
//! - \ref asmjit::CodeGen - Astract code-generation that serializes to `Assembler`:
|
||||||
|
|||||||
@@ -25,9 +25,9 @@
|
|||||||
#include "./base/zone.h"
|
#include "./base/zone.h"
|
||||||
|
|
||||||
#if !defined(ASMJIT_DISABLE_COMPILER)
|
#if !defined(ASMJIT_DISABLE_COMPILER)
|
||||||
#include "./base/hlstream.h"
|
|
||||||
#include "./base/compiler.h"
|
#include "./base/compiler.h"
|
||||||
#include "./base/compilerfunc.h"
|
#include "./base/compilerfunc.h"
|
||||||
|
#include "./base/hlstream.h"
|
||||||
#endif // !ASMJIT_DISABLE_COMPILER
|
#endif // !ASMJIT_DISABLE_COMPILER
|
||||||
|
|
||||||
// [Guard]
|
// [Guard]
|
||||||
|
|||||||
@@ -337,15 +337,15 @@ struct Utils {
|
|||||||
|
|
||||||
//! Generate a bit-mask that has `x` most significant bits set.
|
//! Generate a bit-mask that has `x` most significant bits set.
|
||||||
static ASMJIT_INLINE uint32_t bits(uint32_t x) {
|
static ASMJIT_INLINE uint32_t bits(uint32_t x) {
|
||||||
// Shifting more bits that the type has has undefined behavior. Everything
|
// Shifting more bits that the type has has undefined behavior. Everything
|
||||||
// we need is that application shouldn't crash because of that, but the
|
// we need is that application shouldn't crash because of that, but the
|
||||||
// content of register after shift is not defined. So in case that the
|
// content of register after shift is not defined. So in case that the
|
||||||
// requested shift is too large for the type we correct this undefined
|
// requested shift is too large for the type we correct this undefined
|
||||||
// behavior by setting all bits to ones (this is why we generate an overflow
|
// behavior by setting all bits to ones (this is why we generate an overflow
|
||||||
// mask).
|
// mask).
|
||||||
uint32_t overflow = static_cast<uint32_t>(
|
uint32_t overflow = static_cast<uint32_t>(
|
||||||
-static_cast<int32_t>(x >= sizeof(uint32_t) * 8));
|
-static_cast<int32_t>(x >= sizeof(uint32_t) * 8));
|
||||||
|
|
||||||
return ((static_cast<uint32_t>(1) << x) - 1U) | overflow;
|
return ((static_cast<uint32_t>(1) << x) - 1U) | overflow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -666,7 +666,7 @@ HLSentinel* X86Compiler::endFunc() {
|
|||||||
|
|
||||||
// Add local constant pool at the end of the function (if exist).
|
// Add local constant pool at the end of the function (if exist).
|
||||||
setCursor(func->getExitNode());
|
setCursor(func->getExitNode());
|
||||||
|
|
||||||
if (_localConstPoolLabel.isInitialized()) {
|
if (_localConstPoolLabel.isInitialized()) {
|
||||||
embedConstPool(_localConstPoolLabel, _localConstPool);
|
embedConstPool(_localConstPoolLabel, _localConstPool);
|
||||||
_localConstPoolLabel.reset();
|
_localConstPoolLabel.reset();
|
||||||
|
|||||||
@@ -444,7 +444,7 @@ struct X86CallNode : public HLCall {
|
|||||||
//! MyFunc func = asmjit_cast<MyFunc>(a.make());
|
//! MyFunc func = asmjit_cast<MyFunc>(a.make());
|
||||||
//! ~~~
|
//! ~~~
|
||||||
//!
|
//!
|
||||||
//! The snippet uses methods to create variables, to associate them with
|
//! The snippet uses methods to create variables, to associate them with
|
||||||
//! function arguments, and to use them to return from the generated function.
|
//! function arguments, and to use them to return from the generated function.
|
||||||
//!
|
//!
|
||||||
//! When a variable is created, the initial state is `kVarStateNone`, when
|
//! When a variable is created, the initial state is `kVarStateNone`, when
|
||||||
@@ -521,7 +521,7 @@ struct X86CallNode : public HLCall {
|
|||||||
//! generate in some cases a block at the end of the function that changes
|
//! generate in some cases a block at the end of the function that changes
|
||||||
//! the state of one branch. Usually the "taken" branch is embedded directly
|
//! the state of one branch. Usually the "taken" branch is embedded directly
|
||||||
//! before the jump, and "not-taken" branch has the separate code block.
|
//! before the jump, and "not-taken" branch has the separate code block.
|
||||||
//!
|
//!
|
||||||
//! The next example shows to the extra code block generated for a state change:
|
//! The next example shows to the extra code block generated for a state change:
|
||||||
//!
|
//!
|
||||||
//! ~~~
|
//! ~~~
|
||||||
@@ -1041,7 +1041,7 @@ struct ASMJIT_VIRTAPI X86Compiler : public Compiler {
|
|||||||
_newVar(&var, typeId, NULL, NULL); \
|
_newVar(&var, typeId, NULL, NULL); \
|
||||||
return var; \
|
return var; \
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ASMJIT_NEW_VAR_TYPE(newGpVar , X86GpVar , _kVarTypeIntStart , _kVarTypeIntEnd )
|
ASMJIT_NEW_VAR_TYPE(newGpVar , X86GpVar , _kVarTypeIntStart , _kVarTypeIntEnd )
|
||||||
ASMJIT_NEW_VAR_TYPE(newMmVar , X86MmVar , _kX86VarTypeMmStart , _kX86VarTypeMmEnd )
|
ASMJIT_NEW_VAR_TYPE(newMmVar , X86MmVar , _kX86VarTypeMmStart , _kX86VarTypeMmEnd )
|
||||||
|
|||||||
Reference in New Issue
Block a user